@@ -55,7 +55,7 @@ def _spec_cmds(sources: Union[BaseSource, BaseSample], outer_radius: Union[str,
55
55
inner_radius : Union [str , Quantity ] = Quantity (0 , 'arcsec' ), group_spec : bool = True , min_counts : int = 5 ,
56
56
min_sn : float = None , num_cores : int = NUM_CORES , disable_progress : bool = False ,
57
57
combine_tm : bool = True , combine_obs : bool = True , force_gen : bool = False ,
58
- custom_bkg : Union [str , List [ str ] ] = None ):
58
+ custom_bkg : Union [CircleSkyRegion , EllipseSkyRegion , dict , List ] = None ):
59
59
"""
60
60
An internal function to generate all the commands necessary to produce a srctool spectrum, but is not
61
61
decorated by the esass_call function, so the commands aren't immediately run. This means it can be used for
@@ -92,7 +92,13 @@ def _spec_cmds(sources: Union[BaseSource, BaseSample], outer_radius: Union[str,
92
92
:param bool combine_obs: Setting this to False will generate an image for each associated observation,
93
93
instead of for one combined observation.
94
94
:param bool force_gen: This boolean flag will force the regeneration of spectra, even if they already exist.
95
- :param str custom_bkg: A string to be input into the backreg argument of srctool.
95
+ :param Union[CircleSkyRegion, EllipseSkyRegion, dict, List] custom_bkg: A region to extract the
96
+ background spectrum from. If extracting a spectrum for a single source, and require unique
97
+ background regions for each obs_id and instrument, this argument can be input as a nested
98
+ dictionary with top level obs_id keys, and instrument keys on the next level
99
+ ({obs_id: {inst: reg}}). If extracting spectra from a sample, and require unique regions for
100
+ each source, a list of dictionaries should be input, with an entry for each source. By
101
+ default the background will be extracted from an annulus around the source.
96
102
"""
97
103
def _append_spec_info (evt_list ):
98
104
"""
@@ -738,7 +744,9 @@ def _append_spec_info(evt_list):
738
744
def srctool_spectrum (sources : Union [BaseSource , BaseSample ], outer_radius : Union [str , Quantity ],
739
745
inner_radius : Union [str , Quantity ] = Quantity (0 , 'arcsec' ), group_spec : bool = True ,
740
746
min_counts : int = 5 , min_sn : float = None , num_cores : int = NUM_CORES ,
741
- disable_progress : bool = False , combine_tm : bool = True , combine_obs : bool = True , force_gen : bool = False ):
747
+ disable_progress : bool = False , combine_tm : bool = True ,
748
+ combine_obs : bool = True , force_gen : bool = False ,
749
+ custom_bkg : Union [CircleSkyRegion , EllipseSkyRegion , dict , List ] = None ):
742
750
743
751
"""
744
752
A wrapper for all the eSASS and Heasoft processes necessary to generate an eROSITA spectrum that can be analysed
@@ -775,11 +783,18 @@ def srctool_spectrum(sources: Union[BaseSource, BaseSample], outer_radius: Union
775
783
telescope modules utilized for that ObsID. This can help to offset the low signal-to-noise nature of the
776
784
survey data eROSITA takes. Default is True.
777
785
:param bool force_gen: This boolean flag will force the regeneration of spectra, even if they already exist.
786
+ :param Union[CircleSkyRegion, EllipseSkyRegion, dict, List] custom_bkg: A region to extract the
787
+ background spectrum from. If extracting a spectrum for a single source, and require unique
788
+ background regions for each obs_id and instrument, this argument can be input as a nested
789
+ dictionary with top level obs_id keys, and instrument keys on the next level
790
+ ({obs_id: {inst: reg}}). If extracting spectra from a sample, and require unique regions for
791
+ each source, a list of dictionaries should be input, with an entry for each source. By
792
+ default the background will be extracted from an annulus around the source.
778
793
"""
779
794
# All the workings of this function are in _spec_cmds so that the annular spectrum set generation function
780
795
# can also use them
781
796
return _spec_cmds (sources , outer_radius , inner_radius , group_spec , min_counts , min_sn , num_cores , disable_progress ,
782
- combine_tm , combine_obs , force_gen = force_gen )
797
+ combine_tm , combine_obs , force_gen = force_gen , custom_bkg = custom_bkg )
783
798
784
799
785
800
# TODO I feel that I could combine this with the original SAS one, seeing as they essentially call existing
0 commit comments