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, 3:37 PM . Copyright (c) The Contributors.
2+ # Last modified by David J Turner (djturner@umbc.edu) 4/28 /26, 10:22 AM . Copyright (c) The Contributors.
33
44import gc
55import os
@@ -2240,12 +2240,13 @@ def _interloper_sas_string(reg: EllipseSkyRegion, im: Image, output_unit: Union[
22402240 return shape_str
22412241
22422242 def _get_phot_prod (self , prod_type : str , obs_id : str = None , inst : str = None , lo_en : Quantity = None ,
2243- hi_en : Quantity = None , psf_corr : bool = False , psf_model : str = "ELLBETA" ,
2244- psf_bins : int = 4 , psf_algo : str = "rl" , psf_iter : int = 15 , telescope : str = None ) \
2243+ hi_en : Quantity = None , psf_corr : bool = False , psf_model : str = "ELLBETA" , psf_bins : int = 4 , psf_algo : str = "rl" ,
2244+ psf_iter : int = 15 , telescope : str = None ) \
22452245 -> Union [Image , ExpMap , RateMap , List [Image ], List [ExpMap ], List [RateMap ]]:
22462246 """
22472247 An internal method which is the basis of the get_images, get_expmaps, and get_ratemaps methods.
22482248
2249+ :param str prod_type: XGA name for the type of phot product to be retrieved.
22492250 :param str obs_id: Optionally, a specific obs_id to search for can be supplied. The default is None,
22502251 which means all images/expmaps/ratemaps matching the other criteria will be returned.
22512252 :param str inst: Optionally, a specific instrument to search for can be supplied. The default is None,
@@ -2282,7 +2283,8 @@ def _get_phot_prod(self, prod_type: str, obs_id: str = None, inst: str = None, l
22822283 # We have energy limits here so we assemble the key that describes the energy range
22832284 energy_key = "bound_{l}-{h}" .format (l = lo_en .to ('keV' ).value , h = hi_en .to ('keV' ).value )
22842285 else :
2285- raise ValueError ("lo_en and hi_en must be either BOTH None or BOTH an Astropy quantity." )
2286+ raise ValueError (f"'lo_en' ({ lo_en } ) and hi_en ({ hi_en } ) must be either BOTH"
2287+ f" None or BOTH an Astropy quantity." )
22862288
22872289 # If we are looking for a PSF corrected image/ratemap then we assemble the extra key with PSF details
22882290 if psf_corr and prod_type in ["image" , "ratemap" ]:
@@ -3194,10 +3196,10 @@ def get_ratemaps(self, obs_id: str = None, inst: str = None, lo_en: Quantity = N
31943196 return self ._get_phot_prod ("ratemap" , obs_id , inst , lo_en , hi_en , psf_corr , psf_model , psf_bins , psf_algo ,
31953197 psf_iter , telescope )
31963198
3197- def get_combined_images (self , obs_id : str = 'combined' , inst : str = None , lo_en : Quantity = None ,
3198- hi_en : Quantity = None , psf_corr : bool = False , psf_model : str = "ELLBETA" ,
3199+ def get_combined_images (self , lo_en : Quantity = None , hi_en : Quantity = None ,
3200+ psf_corr : bool = False , psf_model : str = "ELLBETA" ,
31993201 psf_bins : int = 4 , psf_algo : str = "rl" , psf_iter : int = 15 ,
3200- telescope : str = None ) -> Union [Image , List [Image ]]:
3202+ telescope : str = None , obs_id : str = 'combined' , inst : str = None ) -> Union [Image , List [Image ]]:
32013203 """
32023204 Convenience method to retrieve combined (multi-observation and/or multi-instrument) XGA Image objects.
32033205 This is equivalent to calling get_images() with obs_id='combined' and/or inst='combined'.
@@ -3208,10 +3210,6 @@ def get_combined_images(self, obs_id: str = 'combined', inst: str = None, lo_en:
32083210 - obs_id=specific, inst='combined': Single obs + multi-inst
32093211 - obs_id=None, inst=None: All combined images
32103212
3211- :param str obs_id: The obs_id to search for. Default is 'combined' for multi-observation images.
3212- :param str inst: Optionally, a specific instrument to search for. The default is None, which means all
3213- combined images matching the other criteria will be returned. Pass 'combined' to retrieve
3214- multi-instrument combined images, or a specific instrument name for single-instrument combined.
32153213 :param Quantity lo_en: The lower energy limit of the image you wish to retrieve, the default
32163214 is None (which will retrieve all images regardless of energy limit).
32173215 :param Quantity hi_en: The upper energy limit of the image you wish to retrieve, the default
@@ -3224,6 +3222,10 @@ def get_combined_images(self, obs_id: str = 'combined', inst: str = None, lo_en:
32243222 :param int psf_iter: If the image you want is PSF corrected, this is the number of iterations.
32253223 :param str telescope: Optionally, a specific telescope to search for combined images can be supplied. The
32263224 default is None, which means all combined images matching the other criteria will be returned.
3225+ :param str obs_id: The obs_id to search for. Default is 'combined' for multi-observation images.
3226+ :param str inst: Optionally, a specific instrument to search for. The default is None, which means all
3227+ combined images matching the other criteria will be returned. Pass 'combined' to retrieve
3228+ multi-instrument combined images, or a specific instrument name for single-instrument combined.
32273229 :return: An XGA Image object (if there is an exact match), or a list of XGA Image objects (if there
32283230 were multiple matching products).
32293231 :rtype: Union[Image, List[Image]]
@@ -3232,41 +3234,39 @@ def get_combined_images(self, obs_id: str = 'combined', inst: str = None, lo_en:
32323234 psf_model = psf_model , psf_bins = psf_bins , psf_algo = psf_algo , psf_iter = psf_iter ,
32333235 telescope = telescope )
32343236
3235- def get_combined_expmaps (self , obs_id : str = 'combined' , inst : str = None , lo_en : Quantity = None ,
3236- hi_en : Quantity = None , telescope : str = None ) -> Union [ExpMap , List [ExpMap ]]:
3237+ def get_combined_expmaps (self , lo_en : Quantity = None , hi_en : Quantity = None ,
3238+ telescope : str = None , obs_id : str = 'combined' ,
3239+ inst : str = None ) -> Union [ExpMap , List [ExpMap ]]:
32373240 """
32383241 Convenience method to retrieve combined (multi-observation and/or multi-instrument) XGA ExpMap objects.
32393242 This is equivalent to calling get_expmaps() with obs_id='combined' and/or inst='combined'.
32403243
3241- :param str obs_id: The obs_id to search for. Default is 'combined' for multi-observation exposure maps.
3242- :param str inst: Optionally, a specific instrument to search for. The default is None, which means all
3243- combined exposure maps matching the other criteria will be returned. Pass 'combined' to retrieve
3244- multi-instrument combined exposure maps.
32453244 :param Quantity lo_en: The lower energy limit of the exposure maps you wish to retrieve, the default
32463245 is None (which will retrieve all images regardless of energy limit).
32473246 :param Quantity hi_en: The upper energy limit of the exposure maps you wish to retrieve, the default
32483247 is None (which will retrieve all images regardless of energy limit).
32493248 :param str telescope: Optionally, a specific telescope to search for combined exposure maps can be
32503249 supplied. The default is None, which means all combined exposure maps matching the other criteria
32513250 will be returned.
3251+ :param str obs_id: The obs_id to search for. Default is 'combined' for multi-observation exposure maps.
3252+ :param str inst: Optionally, a specific instrument to search for. The default is None, which means all
3253+ combined exposure maps matching the other criteria will be returned. Pass 'combined' to retrieve
3254+ multi-instrument combined exposure maps.
32523255 :return: An XGA ExpMap object (if there is an exact match), or a list of XGA ExpMap objects (if there
32533256 were multiple matching products).
32543257 :rtype: Union[ExpMap, List[ExpMap]]
32553258 """
32563259 return self .get_expmaps (obs_id = obs_id , inst = inst , lo_en = lo_en , hi_en = hi_en , telescope = telescope )
32573260
3258- def get_combined_ratemaps (self , obs_id : str = 'combined' , inst : str = None , lo_en : Quantity = None ,
3259- hi_en : Quantity = None , psf_corr : bool = False , psf_model : str = "ELLBETA" ,
3261+ def get_combined_ratemaps (self , lo_en : Quantity = None , hi_en : Quantity = None ,
3262+ psf_corr : bool = False , psf_model : str = "ELLBETA" ,
32603263 psf_bins : int = 4 , psf_algo : str = "rl" , psf_iter : int = 15 ,
3261- telescope : str = None ) -> Union [RateMap , List [RateMap ]]:
3264+ telescope : str = None , obs_id : str = 'combined' ,
3265+ inst : str = None ) -> Union [RateMap , List [RateMap ]]:
32623266 """
32633267 Convenience method to retrieve combined (multi-observation and/or multi-instrument) XGA RateMap objects.
32643268 This is equivalent to calling get_ratemaps() with obs_id='combined' and/or inst='combined'.
32653269
3266- :param str obs_id: The obs_id to search for. Default is 'combined' for multi-observation ratemaps.
3267- :param str inst: Optionally, a specific instrument to search for. The default is None, which means all
3268- combined ratemaps matching the other criteria will be returned. Pass 'combined' to retrieve
3269- multi-instrument combined ratemaps.
32703270 :param Quantity lo_en: The lower energy limit of the ratemaps you wish to retrieve, the default
32713271 is None (which will retrieve all ratemaps regardless of energy limit).
32723272 :param Quantity hi_en: The upper energy limit of the ratemaps you wish to retrieve, the default
@@ -3279,6 +3279,10 @@ def get_combined_ratemaps(self, obs_id: str = 'combined', inst: str = None, lo_e
32793279 :param int psf_iter: If the ratemap you want is PSF corrected, this is the number of iterations.
32803280 :param str telescope: Optionally, a specific telescope to search for combined ratemaps can be supplied. The
32813281 default is None, which means all combined ratemaps matching the other criteria will be returned.
3282+ :param str obs_id: The obs_id to search for. Default is 'combined' for multi-observation ratemaps.
3283+ :param str inst: Optionally, a specific instrument to search for. The default is None, which means all
3284+ combined ratemaps matching the other criteria will be returned. Pass 'combined' to retrieve
3285+ multi-instrument combined ratemaps.
32823286 :return: An XGA RateMap object (if there is an exact match), or a list of XGA RateMap objects (if there
32833287 were multiple matching products).
32843288 :rtype: Union[RateMap, List[RateMap]]
0 commit comments