11# This code is part of X-ray: Generate and Analyse (XGA), a module designed for the XMM Cluster Survey (XCS).
2- # Last modified by David J Turner (djturner@umbc.edu) 4/27 /26, 4:05 PM. Copyright (c) The Contributors.
2+ # Last modified by David J Turner (djturner@umbc.edu) 5/6 /26, 6:32 PM. Copyright (c) The Contributors.
33
44import os
55import sys
1111from astropy .units import Quantity , UnitBase , deg
1212from regions import EllipseSkyRegion
1313
14- from xga .exceptions import XGADeveloperError
14+ from xga .exceptions import XGADeveloperError , InvalidTelescopeError
1515from ..products import BaseProduct , Image , ExpMap , Spectrum , PSFGrid , EventList
1616from ..products .lightcurve import LightCurve
1717from ..sources import BaseSource
@@ -198,7 +198,7 @@ def _interloper_esass_string(reg: EllipseSkyRegion) -> str:
198198 return shape_str
199199
200200
201- def get_annular_esass_region (source : BaseSource , inner_radius : Quantity , outer_radius : Quantity , obs_id : str ,
201+ def get_annular_esass_region (source : BaseSource , inner_radius : Quantity , outer_radius : Quantity , obs_id : str , telescope : str ,
202202 output_unit : Union [UnitBase , str ] = deg , rot_angle : Quantity = Quantity (0 , 'deg' ),
203203 interloper_regions : np .ndarray = None , central_coord : Quantity = None ,
204204 bkg_reg : bool = False , rand_ident : int = None , out_root_path : str = None ) -> str :
@@ -215,6 +215,7 @@ def get_annular_esass_region(source: BaseSource, inner_radius: Quantity, outer_r
215215 quantity has multiple elements then an elliptical region will be generated, with the first element
216216 being the outer radius on the semi-major axis, and the second on the semi-minor axis.
217217 :param str obs_id: The ObsID of the observation you wish to generate the eSASS region for.
218+ :param str telescope: The particular eROSITA mission skew to create a region for; 'erosita' or 'erass'.
218219 :param UnitBase/str output_unit: The desired units for the region string/file to be written in.
219220 :param Quantity rot_angle: The rotation angle of the source region, default is zero degrees.
220221 :param np.ndarray interloper_regions: The interloper regions to remove from the source region,
@@ -233,6 +234,9 @@ def get_annular_esass_region(source: BaseSource, inner_radius: Quantity, outer_r
233234 contaminating regions.
234235 :rtype: str
235236 """
237+ if telescope not in ['erosita' , 'erass' ]:
238+ raise InvalidTelescopeError ("Pass either 'erosita' or 'erass' to this function's telescope argument." )
239+
236240 if central_coord is None :
237241 central_coord = source .default_coord
238242
@@ -260,9 +264,9 @@ def get_annular_esass_region(source: BaseSource, inner_radius: Quantity, outer_r
260264 # so that within_radii can just be called once externally for a set of ObsID-instrument combinations,
261265 # like in evselect_spectrum for instance.
262266 if interloper_regions is None and inner_radius .isscalar :
263- interloper_regions = source .regions_within_radii (inner_radius , outer_radius , "erosita" , central_coord )
267+ interloper_regions = source .regions_within_radii (inner_radius , outer_radius , telescope , central_coord )
264268 elif interloper_regions is None and not inner_radius .isscalar :
265- interloper_regions = source .regions_within_radii (min (inner_radius ), max (outer_radius ), "erosita" , central_coord )
269+ interloper_regions = source .regions_within_radii (min (inner_radius ), max (outer_radius ), telescope , central_coord )
266270
267271 # So now we convert our interloper regions into their eSASS equivalents
268272 esass_interloper = [_interloper_esass_string (i ) for i in interloper_regions ]
0 commit comments