Skip to content

Commit e90f2df

Browse files
updating the docstrings
1 parent f8813be commit e90f2df

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

xga/generate/esass/spec.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def _spec_cmds(sources: Union[BaseSource, BaseSample], outer_radius: Union[str,
5555
inner_radius: Union[str, Quantity] = Quantity(0, 'arcsec'), group_spec: bool = True, min_counts: int = 5,
5656
min_sn: float = None, num_cores: int = NUM_CORES, disable_progress: bool = False,
5757
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):
5959
"""
6060
An internal function to generate all the commands necessary to produce a srctool spectrum, but is not
6161
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,
9292
:param bool combine_obs: Setting this to False will generate an image for each associated observation,
9393
instead of for one combined observation.
9494
: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.
96102
"""
97103
def _append_spec_info(evt_list):
98104
"""
@@ -738,7 +744,9 @@ def _append_spec_info(evt_list):
738744
def srctool_spectrum(sources: Union[BaseSource, BaseSample], outer_radius: Union[str, Quantity],
739745
inner_radius: Union[str, Quantity] = Quantity(0, 'arcsec'), group_spec: bool = True,
740746
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):
742750

743751
"""
744752
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
775783
telescope modules utilized for that ObsID. This can help to offset the low signal-to-noise nature of the
776784
survey data eROSITA takes. Default is True.
777785
: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.
778793
"""
779794
# All the workings of this function are in _spec_cmds so that the annular spectrum set generation function
780795
# can also use them
781796
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)
783798

784799

785800
# TODO I feel that I could combine this with the original SAS one, seeing as they essentially call existing

0 commit comments

Comments
 (0)