sourcetools
sourcetools.density module
XGA submodule that implements methods to create sets of spatially resolved density measurements (e.g. profiles) for extended X-ray sources.
- xga.sourcetools.density.inv_abel_fitted_model(sources, model, fit_method='mcmc', outer_radius='r500', num_dens=True, use_peak=True, pix_step=1, min_snr=0.0, abund_table='angr', lo_en=<Quantity 0.5 keV>, hi_en=<Quantity 2. keV>, psf_corr=True, psf_model='ELLBETA', psf_bins=4, psf_algo='rl', psf_iter=15, num_walkers=20, num_steps=20000, num_samples=10000, group_spec=True, min_counts=5, min_sn=None, over_sample=None, obs_id=None, inst=None, conv_temp=None, conv_outer_radius='r500', conv_inner_radius=<Quantity 0. arcsec>, inv_abel_method=None, num_cores=1, show_warn=True, stacked_spectra=False, telescope=None, timeout=<Quantity 300. s>)[source]
A count-rate-map-based galaxy cluster gas density calculation method where a surface brightness profile is fit with a model and an inverse abel transform is used to infer the 3D count-rate/volume profile. Then a conversion factor calculated from simulated spectra is used to infer the number density profile.
Depending on the chosen surface brightness model, the inverse abel transform may be performed using an analytical solution, or numerical methods.
- Parameters:
sources (GalaxyCluster/ClusterSample) – A GalaxyCluster or ClusterSample object to measure density profiles for.
model (str/List[str]/BaseModel1D/List[BaseModel1D]) – The model(s) to be fit to the cluster surface profile(s). You may pass the string name of a model (for single or multiple clusters), a single instance of an XGA model class (for single or multiple clusters), a list of string names (one entry for each cluster being analysed), or a list of XGA model instances (one entry for each cluster being analysed).
fit_method (str) – The method for the profile object to use to fit the model, default is mcmc.
outer_radius (str/Quantity) – The radius to which the surface brightness profile should be generated. It can be a named radius (e.g. ‘r500’, ‘r200’) or a quantity containing a value (or values, if a sample of clusters has been passed).
num_dens (bool) – If True then a number density profile will be generated, otherwise a mass density profile will be generated.
use_peak (bool) – If True the measured peak will be used as the central coordinate of the profile.
pix_step (int) – The width (in pixels) of each annular bin for the profiles, default is 1.
min_snr (int/float) – The minimum allowed signal-to-noise for the surface brightness profiles. Default is 0, which disables automatic re-binning.
abund_table (str) – Which abundance table should be used for the XSPEC fit, FakeIt run, and for the electron/hydrogen number density ratio.
lo_en (Quantity) – The lower energy limit of the combined ratemap used to calculate density.
hi_en (Quantity) – The upper energy limit of the combined ratemap used to calculate density.
psf_corr (bool) – Default True, whether PSF corrected ratemaps will be used to make the surface brightness profile, and thus the density (if False density results could be incorrect).
psf_model (str) – If PSF corrected, the PSF model used.
psf_bins (int) – If PSF corrected, the number of bins per side.
psf_algo (str) – If PSF corrected, the algorithm used.
psf_iter (int) – If PSF corrected, the number of algorithm iterations.
num_walkers (int) – If using mcmc fitting, the number of walkers to use. Default is 20.
num_steps (int) – If using mcmc fitting, the number of steps each walker should take. Default is 20000.
num_samples (int) – The number of samples drawn from the posterior distributions of model parameters after the fitting process is complete.
group_spec (bool) – Whether the spectra that were used for fakeit were grouped.
min_counts (int) – The minimum counts per channel, if the spectra that were used for fakeit were grouped by minimum counts.
min_sn (int/float) – The minimum signal-to-noise per channel, if the spectra that were used for fakeit were grouped by minimum signal-to-noise.
over_sample (float) – The level of oversampling applied on the spectra that were used for fakeit.
obs_id (Dict[str, str]/Dict[str, list]) – A specific ObsID(s) to measure the density from. This should be a dictionary of strings if a single source is being analysed, or a dictionary of lists of ObsIDs the same length as the number of sources otherwise. The dictionary should have keys for every telescope associated to the Source/Sample. If a source in a sample doesn’t have data associated to one of the telescopes, use an empty string for its place in the list. The default is None, in which case the combined data will be used to measure the density profile.
inst (Dict[str, str]/Dict[str, list]) – A specific instruments(s) to measure the density from. This should be a dictionary of strings if a single source is being analysed, or if the same instrument should be used for every source in the sample, or a dictionary of lists of instruments the same length as the number of sources otherwise. The dictionary should have keys for every telescope associated to the Source/Sample. The default is None, in which case the combined data will be used to measure the density profile.
conv_temp (Quantity/Dict[str, Quantity]) – If set this will override XGA measured temperatures within the conv_outer_radius, and the fakeit run to calculate the normalisation conversion factor will use these temperatures. This can be set as a quantity, or a dictionary of quantities with telescope keys to specify telescope specific temperatures. The quantity should have an entry for each cluster being analysed. Default is None.
conv_outer_radius (str/Quantity) – The outer radius within which to generate spectra and measure temperatures for the conversion factor calculation, default is ‘r500’. An astropy quantity may also be passed, with either a single value or an entry for each cluster being analysed.
conv_inner_radius (str/Quantity) – The inner radius of spectra from which to measure temperatures for the conversion factor calculation. Default is 0 arcseconds, producing a core-included circular spectrum. Supports either a single value or an entry for each cluster being analysed.
inv_abel_method (str) – The method which should be used for the inverse abel transform of model which is fitted to the surface brightness profile. This overrides the default method for the model, which is either ‘analytical’ for models with an analytical solution to the inverse abel transform, or ‘direct’ for models which don’t have an analytical solution. Default is None.
num_cores (int) – The number of cores that the evselect call and XSPEC functions are allowed to use.
show_warn (bool) – Controls whether fit warnings are displayed. Default is False.
stacked_spectra (bool) – Whether stacked spectra (of all instruments for an ObsID) should be used for this XSPEC spectral fit. If a stacking procedure for a particular telescope is not supported, this function will instead use individual spectra for an ObsID. The default is False.
telescope (str/List[str]) – Telescope(s) to produce density profiles from. Default is None, in which case density profiles will be produced from all telescopes associated with a source.
timeout (Quantity) – Timeout argument for xspec functions.
- Returns:
A dictionary of 3D gas density profile lists measured by this function - the keys are telescope names. The values are lists with one entry per source, even if the source in question doesn’t have that telescope associated or the profile construction process failed.
- Return type:
Dict[str, List[Union[GasDensity3D, None]]]
- xga.sourcetools.density.inv_abel_data(sources, outer_radius, inv_abel_method, num_dens=True, use_peak=True, pix_step=1, min_snr=0.0, abund_table='angr', lo_en=<Quantity 0.5 keV>, hi_en=<Quantity 2. keV>, psf_corr=True, psf_model='ELLBETA', psf_bins=4, psf_algo='rl', psf_iter=15, num_samples=10000, group_spec=True, min_counts=5, min_sn=None, over_sample=None, obs_id=None, inst=None, conv_temp=None, conv_outer_radius='r500', conv_inner_radius=<Quantity 0. arcsec>, num_cores=1, stacked_spectra=False, telescope=None, timeout=<Quantity 300. s>)[source]
A count-rate-map-based galaxy cluster gas density calculation method where a surface brightness profile inverse abel transformed, thus inferring the 3D count-rate/volume profile. Then a conversion factor calculated from simulated spectra is used to infer the number density profile.
There are a number of choices of method for inverse abel transforming, provided by the Python package PyAbel:
direct - This attempts a direct integration of the inverse-Abel integral (see https://ned.ipac.caltech.edu/level5/March02/Sarazin/Sarazin5_5_4.html). No assumptions are made other than cylindrical symmetry, and fine sampling is required. This is the only method that supports non-uniform radius sampling, and if the surface brightness profile is detected to have non-uniform radius sampling (if generated for a minimum signal-to-noise for instance) then this is the method that will be used.
basex - This method (basis set expansion) uses functions with a known analytic inverse-abel transform (gaussian-like in this case).
hansen_law_ho0 - A fast transform method (the PyAbel authors describe it ‘a hidden gem of the field’, using a coordinate transformation to model the Abel transform as a set of linear differential equation. This particular choice uses hold_order=0, which assumes a constant intensity across a pixel (between grid points) for the driving function (the image gradient for the inverse transform).
hansen_law_ho1 - A fast transform method (the PyAbel authors describe it ‘a hidden gem of the field’, using a coordinate transformation to model the Abel transform as a set of linear differential equation. This particular choice uses hold_order=1, which assumes a linear intensity variation between grid points, which may yield a more accurate transform for some functions
onion_peeling - In the onion-peeling method the projection is approximated by rings of constant property, see the PyAbel documentation for the mathematical explanation.
two_point - The Abel integral is broken into intervals between the radius points, with the function assumed to be constant within the points.
three_point - This method exploits the observation that the value of the Abel inverted data at any radial position r is primarily determined from changes in the projection data in the neighborhood of r. The projection data (raw data) is expanded as a quadratic function of in the neighborhood of each data point, which allows an analytical deprojection.
daun - Similar to onion peeling, but uses ‘Tikhonov regularization’.
The PyAbel documentation provides a useful discussion of when and when not to use different methods (https://pyabel.readthedocs.io/en/latest/transform_methods.html), and the authors also wrote a paper comparing the various methods (https://arxiv.org/abs/1902.09007).
- Parameters:
sources (GalaxyCluster/ClusterSample) – A GalaxyCluster or ClusterSample object to measure density profiles for.
outer_radius (str/Quantity) – The radius to which the surface brightness profile should be generated. It can be a named radius (e.g. ‘r500’, ‘r200’) or a quantity containing a value (or values, if a sample of clusters has been passed).
inv_abel_method (str) – The method/algorithm which should be used for the inverse abel transform of the surface brightness profile data. We advise reading the information in the docstring before making a choice, as well as experimenting a little.
num_dens (bool) – If True then a number density profile will be generated, otherwise a mass density profile will be generated.
use_peak (bool) – If true the measured peak will be used as the central coordinate of the profile.
pix_step (int) – The width (in pixels) of each annular bin for the profiles, default is 1.
min_snr (int/float) – The minimum allowed signal-to-noise for the surface brightness profiles. Default is 0, which disables automatic re-binning.
abund_table (str) – Which abundance table should be used for the XSPEC fit, FakeIt run, and for the electron/hydrogen number density ratio.
lo_en (Quantity) – The lower energy limit of the combined ratemap used to calculate density.
hi_en (Quantity) – The upper energy limit of the combined ratemap used to calculate density.
psf_corr (bool) – Default True, whether PSF corrected ratemaps will be used to make the surface brightness profile, and thus the density (if False density results could be incorrect).
psf_model (str) – If PSF corrected, the PSF model used.
psf_bins (int) – If PSF corrected, the number of bins per side.
psf_algo (str) – If PSF corrected, the algorithm used.
psf_iter (int) – If PSF corrected, the number of algorithm iterations.
num_samples (int) – The number of samples drawn from the posterior distributions of model parameters after the fitting process is complete.
group_spec (bool) – Whether the spectra that were used for fakeit were grouped.
min_counts (int) – The minimum counts per channel, if the spectra that were used for fakeit were grouped by minimum counts.
min_sn (int/float) – The minimum signal-to-noise per channel, if the spectra that were used for fakeit were grouped by minimum signal-to-noise.
over_sample (float) – The level of oversampling applied on the spectra that were used for fakeit.
obs_id (Dict[str, str]/Dict[str, list]) – A specific ObsID(s) to measure the density from. This should be a dictionary of strings if a single source is being analysed, or a dictionary of lists of ObsIDs the same length as the number of sources otherwise. The dictionary should have keys for every telescope associated to the Source/Sample. If a source in a sample doesn’t have data associated to one of the telescopes, use an empty string for its place in the list. The default is None, in which case the combined data will be used to measure the density profile.
inst (Dict[str, str]/Dict[str, list]) – A specific instruments(s) to measure the density from. This should be a dictionary of strings if a single source is being analysed, or if the same instrument should be used for every source in the sample, or a dictionary of lists of instruments the same length as the number of sources otherwise. The dictionary should have keys for every telescope associated to the Source/Sample. The default is None, in which case the combined data will be used to measure the density profile.
conv_temp (Quantity/Dict[str, Quantity]) – If set this will override XGA measured temperatures within the conv_outer_radius, and the fakeit run to calculate the normalisation conversion factor will use these temperatures. This can be set as a quantity, or a dictionary of quantities with telescope keys to specify telescope specific temperatures. The quantity should have an entry for each cluster being analysed. Default is None.
conv_outer_radius (str/Quantity) – The outer radius within which to generate spectra and measure temperatures for the conversion factor calculation, default is ‘r500’. An astropy quantity may also be passed, with either a single value or an entry for each cluster being analysed.
conv_inner_radius (str/Quantity) – The inner radius of spectra from which to measure temperatures for the conversion factor calculation. Default is 0 arcseconds, producing a core-included circular spectrum. Supports either a single value or an entry for each cluster being analysed.
num_cores (int) – The number of cores that the evselect call and XSPEC functions are allowed to use.
stacked_spectra (bool) – Whether stacked spectra (of all instruments for an ObsID) should be used for this XSPEC spectral fit. If a stacking procedure for a particular telescope is not supported, this function will instead use individual spectra for an ObsID. The default is False.
telescope (str/List[str]) – Telescope(s) to produce density profiles from. Default is None, in which case density profiles will be produced from all telescopes associated with a source.
timeout (Quantity) – Timeout argument for XSPEC functions.
- Returns:
A dictionary of 3D gas density profile lists measured by this function - the keys are telescope names. The values are lists with one entry per source, even if the source in question doesn’t have that telescope associated or the profile construction process failed.
- Return type:
Dict[str, List[Union[GasDensity3D, None]]]
- xga.sourcetools.density.ann_spectra_apec_norm(sources, outer_radii, num_dens=True, annulus_method='min_snr', min_snr=30, min_cnt=<Quantity 1000. ct>, min_width=<Quantity 20. arcsec>, use_combined=True, use_worst=False, lo_en=<Quantity 0.5 keV>, hi_en=<Quantity 2. keV>, psf_corr=False, psf_model='ELLBETA', psf_bins=4, psf_algo='rl', psf_iter=15, allow_negative=False, exp_corr=True, group_spec=True, min_counts=5, min_sn=None, over_sample=None, one_rmf=True, freeze_met=True, abund_table='angr', temp_lo_en=<Quantity 0.3 keV>, temp_hi_en=<Quantity 7.9 keV>, num_data_real=10000, sigma=1, num_cores=1, stacked_spectra=False, telescope=None)[source]
A method of measuring density profiles using XSPEC fits of a set of Annular Spectra. First checks whether the required annular spectra already exist and have been fit using XSPEC, if not then they are generated and fitted, and APEC normalisation profiles will be produced (with projected temperature profiles also being made as a useful extra). Then the apec normalisation profile will be used, with knowledge of the source’s redshift and chosen analysis cosmology, to produce a density profile from the APEC normalisation.
- Parameters:
sources (GalaxyCluster/ClusterSample) – An individual or sample of sources to calculate 3D gas density profiles for.
outer_radii (str/Quantity) – The name or value of the outer radius to use for the generation of the spectrum (for instance ‘r200’ would be acceptable for a GalaxyCluster, or Quantity(1000, ‘kpc’)). If ‘region’ is chosen (to use the regions in region files), then any inner radius will be ignored. If you are generating for multiple sources, then you can also pass a Quantity with one entry per source.
num_dens (bool) – If True then a number density profile will be generated, otherwise a mass density profile will be generated.
annulus_method (str) – The method by which the annuli are designated, this can be ‘min_snr’ (which will use the min_snr_proj_temp_prof function), or ‘min_cnt’ (which will use the min_cnt_proj_temp_prof function).
min_snr (int/float) – The minimum signal-to-noise which is allowable in a given annulus, used if annulus_method is set to ‘min_snr’.
min_cnt (int/Quantity) – The minimum background subtracted counts which are allowable in a given annulus, used if annulus_method is set to ‘min_cnt’.
min_width (Quantity) – The minimum allowable width of an annulus. The default is set to 20 arcseconds to try and avoid PSF effects.
use_combined (bool) – If True (and annulus_method is set to ‘min_snr’) then the combined RateMap will be used for signal-to-noise annulus calculations, this is overridden by use_worst. If True (and annulus_method is set to ‘min_cnt’) then combined RateMaps will be used for annulus count calculations, if False then the median observation (in terms of counts) will be used.
use_worst (bool) – If True then the worst observation of the cluster (ranked by global signal-to-noise) will be used for signal-to-noise annulus calculations. Used if annulus_method is set to ‘min_snr’.
lo_en (Quantity) – The lower energy bound of the RateMap to use for the signal-to-noise or background subtracted count calculations.
hi_en (Quantity) – The upper energy bound of the RateMap to use for the signal-to-noise or background subtracted count calculations.
psf_corr (bool) – Sets whether you wish to use a PSF corrected RateMap or not.
psf_model (str) – If the RateMap you want to use is PSF corrected, this is the PSF model used.
psf_bins (int) – If the RateMap you want to use is PSF corrected, this is the number of PSFs per side in the PSF grid.
psf_algo (str) – If the RateMap you want to use is PSF corrected, this is the algorithm used.
psf_iter (int) – If the RateMap you want to use is PSF corrected, this is the number of iterations.
allow_negative (bool) – Should pixels in the background subtracted count map be allowed to go below zero, which results in a lower signal-to-noise (and can result in a negative signal-to-noise).
exp_corr (bool) – Should signal-to-noises be measured with exposure time correction, default is True. I recommend that this be true for combined observations, as exposure time could change quite dramatically across the combined product.
group_spec (bool) – A boolean flag that sets whether generated spectra are grouped or not.
min_counts (int) – If generating a grouped spectrum, this is the minimum number of counts per channel. To disable minimum counts, set this parameter to None.
min_sn (int/float) – If generating a grouped spectrum, this is the minimum signal-to-noise in each channel. To disable minimum signal-to-noise, set this parameter to None.
over_sample (float) – The minimum energy resolution for each group, set to None to disable. e.g. if over_sample=3 then the minimum width of a group is 1/3 of the resolution FWHM at that energy.
one_rmf (bool) – This flag tells the method whether it should only generate one RMF for a particular ObsID-instrument combination - this is much faster in some circumstances, however the RMF does depend slightly on position on the detector.
freeze_met (bool) – Whether the metallicity parameter in the fits to annuli in XSPEC should be frozen.
abund_table (str) – The abundance table to use both for the conversion from n_exn_p to n_e^2 during density calculation, and the XSPEC fit.
temp_lo_en (Quantity) – The lower energy limit for the XSPEC fits to annular spectra.
temp_hi_en (Quantity) – The upper energy limit for the XSPEC fits to annular spectra.
num_data_real (int) – The number of random realisations to generate when propagating profile uncertainties.
sigma (int) – What sigma uncertainties should newly created profiles have, the default is 2σ.
num_cores (int) – The number of cores to use (if running locally), default is set to 90% of available.
stacked_spectra (bool) – Whether stacked spectra (of all instruments for an ObsID) should be used for this XSPEC spectral fit. If a stacking procedure for a particular telescope is not supported, this function will instead use individual spectra for an ObsID. The default is False.
telescope (str/List[str]) – Telescope(s) to produce density profiles from. Default is None, in which case density profiles will be produced from all telescopes associated with a source.
- Returns:
A list of the 3D gas density profiles measured by this function, though if the measurement was not successful, an entry of None will be added to the list.
- Return type:
List[GasDensity3D]
sourcetools.temperature module
This submodule implements methods to build sets of spatially resolved temperature measurements (e.g. profiles) for extended sources.
- xga.sourcetools.temperature.min_snr_proj_temp_prof(sources, outer_radii, min_snr=20, min_width=<Quantity 20. arcsec>, use_combined=True, use_worst=False, lo_en=<Quantity 0.5 keV>, hi_en=<Quantity 2. keV>, psf_corr=False, psf_model='ELLBETA', psf_bins=4, psf_algo='rl', psf_iter=15, allow_negative=False, exp_corr=True, group_spec=True, min_counts=5, min_sn=None, over_sample=None, one_rmf=True, freeze_met=True, abund_table='angr', temp_lo_en=<Quantity 0.3 keV>, temp_hi_en=<Quantity 7.9 keV>, num_cores=1, telescope=None, stacked_spectra=False)[source]
This is a convenience function that allows you to quickly and easily start measuring projected temperature profiles of galaxy clusters, deciding on the annular bins using signal to noise measurements from photometric products. This function calls single_temp_apec_profile, but doesn’t expose all of the more in depth variables, so if you want more control then use single_temp_apec_profile directly. The projected temperature profiles which are generated are added to their source’s storage structure.
- Parameters:
sources (GalaxyCluster/ClusterSample) – An individual or sample of sources to measure projected temperature profiles for.
outer_radii (str/Quantity) – The name or value of the outer radius to use for the generation of the spectra (for instance ‘r200’ would be acceptable for a GalaxyCluster, or Quantity(1000, ‘kpc’)). If ‘region’ is chosen (to use the regions in region files), then any inner radius will be ignored. If you are generating for multiple sources then you can also pass a Quantity with one entry per source.
min_snr (float) – The minimum signal to noise which is allowable in a given annulus.
min_width (Quantity) – The minimum allowable width of an annulus. The default is set to 20 arcseconds to try and avoid PSF effects.
use_combined (bool) – If True then the combined RateMap will be used for signal to noise annulus calculations, this is overridden by use_worst.
use_worst (bool) – If True then the worst observation of the cluster (ranked by global signal to noise) will be used for signal to noise annulus calculations.
lo_en (Quantity) – The lower energy bound of the ratemap to use for the signal to noise calculations.
hi_en (Quantity) – The upper energy bound of the ratemap to use for the signal to noise calculations.
psf_corr (bool) – Sets whether you wish to use a PSF corrected ratemap or not.
psf_model (str) – If the ratemap you want to use is PSF corrected, this is the PSF model used.
psf_bins (int) – If the ratemap you want to use is PSF corrected, this is the number of PSFs per side in the PSF grid.
psf_algo (str) – If the ratemap you want to use is PSF corrected, this is the algorithm used.
psf_iter (int) – If the ratemap you want to use is PSF corrected, this is the number of iterations.
allow_negative (bool) – Should pixels in the background subtracted count map be allowed to go below zero, which results in a lower signal to noise (and can result in a negative signal to noise).
exp_corr (bool) – Should signal to noises be measured with exposure time correction, default is True. I recommend that this be true for combined observations, as exposure time could change quite dramatically across the combined product.
group_spec (bool) – A boolean flag that sets whether generated spectra are grouped or not.
min_counts (int) – If generating a grouped spectrum, this is the minimum number of counts per channel. To disable minimum counts set this parameter to None.
min_sn (int/float) – If generating a grouped spectrum, this is the minimum signal to noise in each channel. To disable minimum signal to noise set this parameter to None.
over_sample (float) – The minimum energy resolution for each group, set to None to disable. e.g. if over_sample=3 then the minimum width of a group is 1/3 of the resolution FWHM at that energy.
one_rmf (bool) – This flag tells the method whether it should only generate one RMF for a particular ObsID-instrument combination - this is much faster in some circumstances, however the RMF does depend slightly on position on the detector.
freeze_met (bool) – Whether the metallicity parameter in the fits to annuli in XSPEC should be frozen.
abund_table (str) – The abundance table to use during the XSPEC fits.
temp_lo_en (Quantity) – The lower energy limit for the XSPEC fits to annular spectra.
temp_hi_en (Quantity) – The upper energy limit for the XSPEC fits to annular spectra.
num_cores (int) – The number of cores to use (if running locally), default is set to 90% of available.
telescope (str/List[str]) – Telescope(s) to produce projected temperature profiles from. Default is None, in which case projected temperature profiles will be produced from all telescopes associated with a source.
stacked_spectra (bool) – Whether stacked spectra (of all instruments for an ObsID) should be used for this XSPEC spectral fit. If a stacking procedure for a particular telescope is not supported, this function will instead use individual spectra for an ObsID. The default is False.
- Returns:
A dictionary of lists of non-scalar astropy quantities containing the annular radii used to generate the projected temperature profiles created by this function. Each Quantity element of the list corresponds to a source. Each key corresponds to a telescope.
- Return type:
Dict[str, List[Quantity]]
- xga.sourcetools.temperature.min_cnt_proj_temp_prof(sources, outer_radii, min_cnt=<Quantity 1000. ct>, min_width=<Quantity 20. arcsec>, use_combined=True, lo_en=<Quantity 0.5 keV>, hi_en=<Quantity 2. keV>, psf_corr=False, psf_model='ELLBETA', psf_bins=4, psf_algo='rl', psf_iter=15, group_spec=True, min_counts=5, min_sn=None, over_sample=None, one_rmf=True, freeze_met=True, abund_table='angr', temp_lo_en=<Quantity 0.3 keV>, temp_hi_en=<Quantity 7.9 keV>, num_cores=1, telescope=None, stacked_spectra=False)[source]
This is a convenience function that allows you to quickly and easily start measuring projected temperature profiles of galaxy clusters, deciding on the annular bins using X-ray count measurements from photometric products. This function calls single_temp_apec_profile, but doesn’t necessarily expose all of single_temp_apec_profile’s variables, so if you want more control, then use single_temp_apec_profile directly. The projected temperature profiles which are generated are added to their source’s storage structure.
- Parameters:
sources (GalaxyCluster/ClusterSample) – An individual or sample of sources to measure projected temperature profiles for.
outer_radii (str/Quantity) – The name or value of the outer radius to use for the generation of the spectra (for instance ‘r200’ would be acceptable for a GalaxyCluster, or Quantity(1000, ‘kpc’)). If ‘region’ is chosen (to use the regions in region files), then any inner radius will be ignored. If you are generating for multiple sources then you can also pass a Quantity with one entry per source.
min_cnt (int/Quantity) – The minimum counts allowable in a given annulus.
min_width (Quantity) – The minimum allowable width of an annulus. The default is set to 20 arcseconds to try and avoid PSF effects.
use_combined (bool) – If True then the combined RateMap will be used for count annulus calculations. Default is True, if False then the median ObsID-Instrument combo (in terms of background-subtracted counts within outer_radii) will be used to generate the annuli.
lo_en (Quantity) – The lower energy bound of the ratemap to use for the count calculations.
hi_en (Quantity) – The upper energy bound of the ratemap to use for the count calculations.
psf_corr (bool) – Sets whether you wish to use a PSF corrected ratemap or not.
psf_model (str) – If the ratemap you want to use is PSF corrected, this is the PSF model used.
psf_bins (int) – If the ratemap you want to use is PSF corrected, this is the number of PSFs per side in the PSF grid.
psf_algo (str) – If the ratemap you want to use is PSF corrected, this is the algorithm used.
psf_iter (int) – If the ratemap you want to use is PSF corrected, this is the number of iterations.
group_spec (bool) – A boolean flag that sets whether generated spectra are grouped or not.
min_counts (int) – If generating a grouped spectrum, this is the minimum number of counts per channel. To disable minimum counts set this parameter to None.
min_sn (int/float) – If generating a grouped spectrum, this is the minimum signal to noise in each channel. To disable minimum signal to noise set this parameter to None.
over_sample (float) – The minimum energy resolution for each group, set to None to disable. e.g. if over_sample=3 then the minimum width of a group is 1/3 of the resolution FWHM at that energy.
one_rmf (bool) – This flag tells the method whether it should only generate one RMF for a particular ObsID-instrument combination - this is much faster in some circumstances, however the RMF does depend slightly on position on the detector.
freeze_met (bool) – Whether the metallicity parameter in the fits to annuli in XSPEC should be frozen.
abund_table (str) – The abundance table to use during the XSPEC fits.
temp_lo_en (Quantity) – The lower energy limit for the XSPEC fits to annular spectra.
temp_hi_en (Quantity) – The upper energy limit for the XSPEC fits to annular spectra.
num_cores (int) – The number of cores to use (if running locally), default is set to 90% of available.
telescope (str/List[str]) – Telescope(s) to produce projected temperature profiles from. Default is None, in which case projected temperature profiles will be produced from all telescopes associated with a source.
stacked_spectra (bool) – Whether stacked spectra (of all instruments for an ObsID) should be used for this XSPEC spectral fit. If a stacking procedure for a particular telescope is not supported, this function will instead use individual spectra for an ObsID. The default is False.
- Returns:
A dictionary of lists of non-scalar astropy quantities containing the annular radii used to generate the projected temperature profiles created by this function. Each Quantity element of the list corresponds to a source. Each key corresponds to a telescope.
- Return type:
Dict[str, List[Quantity]]
- xga.sourcetools.temperature.onion_deproj_temp_prof(sources, outer_radii, annulus_method='min_snr', min_snr=30, min_cnt=<Quantity 1000. ct>, min_width=<Quantity 20. arcsec>, use_combined=True, use_worst=False, lo_en=<Quantity 0.5 keV>, hi_en=<Quantity 2. keV>, psf_corr=False, psf_model='ELLBETA', psf_bins=4, psf_algo='rl', psf_iter=15, allow_negative=False, exp_corr=True, group_spec=True, min_counts=5, min_sn=None, over_sample=None, one_rmf=True, freeze_met=True, abund_table='angr', temp_lo_en=<Quantity 0.3 keV>, temp_hi_en=<Quantity 7.9 keV>, num_data_real=3000, conf_level=68.2, num_cores=1, stacked_spectra=False, telescope=None)[source]
This function will generate de-projected, three-dimensional, gas temperature profiles of galaxy clusters using the ‘onion peeling’ deprojection method. It will also generate any projected temperature profiles that may be necessary, using the method specified in the function call (the default is the minimum signal to noise annuli method). As a side effect of that process APEC normalisation profiles will also be created, as well as Emission Measure profiles. The function is an implementation of a fairly old technique, though it has been used recently in https://doi.org/10.1051/0004-6361/201731748. For a more in depth discussion of this technique and its uses I would currently recommend https://doi.org/10.1051/0004-6361:20020905.
- Parameters:
sources (GalaxyCluster/ClusterSample) – An individual or sample of sources to calculate 3D temperature profiles for.
outer_radii (str/Quantity) – The name or value of the outer radius to use for the generation of the spectra (for instance ‘r200’ would be acceptable for a GalaxyCluster, or Quantity(1000, ‘kpc’)). If ‘region’ is chosen (to use the regions in region files), then any inner radius will be ignored. If you are generating for multiple sources then you can also pass a Quantity with one entry per source.
annulus_method (str) – The method by which the annuli are designated, this can be ‘min_snr’ (which will use the min_snr_proj_temp_prof function), or ‘min_cnt’ (which will use the min_cnt_proj_temp_prof function).
min_snr (int/float) – The minimum signal-to-noise which is allowable in a given annulus, used if annulus_method is set to ‘min_snr’.
min_cnt (int/Quantity) – The minimum background subtracted counts which are allowable in a given annulus, used if annulus_method is set to ‘min_cnt’.
min_width (Quantity) – The minimum allowable width of an annulus. The default is set to 20 arcseconds to try and avoid PSF effects.
use_combined (bool) – If True (and annulus_method is set to ‘min_snr’) then the combined RateMap will be used for signal-to-noise annulus calculations, this is overridden by use_worst. If True (and annulus_method is set to ‘min_cnt’) then combined RateMaps will be used for annulus count calculations, if False then the median observation (in terms of counts) will be used.
use_worst (bool) – If True then the worst observation of the cluster (ranked by global signal-to-noise) will be used for signal-to-noise annulus calculations. Used if annulus_method is set to ‘min_snr’.
lo_en (Quantity) – The lower energy bound of the RateMap to use for the signal-to-noise or background subtracted count calculations.
hi_en (Quantity) – The upper energy bound of the RateMap to use for the signal-to-noise or background subtracted count calculations.
psf_corr (bool) – Sets whether you wish to use a PSF corrected RateMap or not.
psf_model (str) – If the RateMap you want to use is PSF corrected, this is the PSF model used.
psf_bins (int) – If the RateMap you want to use is PSF corrected, this is the number of PSFs per side in the PSF grid.
psf_algo (str) – If the RateMap you want to use is PSF corrected, this is the algorithm used.
psf_iter (int) – If the RateMap you want to use is PSF corrected, this is the number of iterations.
allow_negative (bool) – Should pixels in the background subtracted count map be allowed to go below zero, which results in a lower signal-to-noise (and can result in a negative signal-to-noise).
exp_corr (bool) – Should signal to noises be measured with exposure time correction, default is True. I recommend that this be true for combined observations, as exposure time could change quite dramatically across the combined product.
group_spec (bool) – A boolean flag that sets whether generated spectra are grouped or not.
min_counts (int) – If generating a grouped spectrum, this is the minimum number of counts per channel. To disable minimum counts set this parameter to None.
min_sn (int/float) – If generating a grouped spectrum, this is the minimum signal to noise in each channel. To disable minimum signal to noise set this parameter to None.
over_sample (float) – The minimum energy resolution for each group, set to None to disable. e.g. if over_sample=3 then the minimum width of a group is 1/3 of the resolution FWHM at that energy.
one_rmf (bool) – This flag tells the method whether it should only generate one RMF for a particular ObsID-instrument combination - this is much faster in some circumstances, however the RMF does depend slightly on position on the detector.
freeze_met (bool) – Whether the metallicity parameter in the fits to annuli in XSPEC should be frozen.
abund_table (str) – The abundance table to use both for the conversion from n_exn_p to n_e^2 during density calculation, and the XSPEC fit.
temp_lo_en (Quantity) – The lower energy limit for the XSPEC fits to annular spectra.
temp_hi_en (Quantity) – The upper energy limit for the XSPEC fits to annular spectra.
num_data_real (int) – The number of random realisations to generate when propagating profile uncertainties, the default is 3000.
conf_level (int) – What sigma uncertainties should the newly created profiles have, the default is 1σ.
num_cores (int) – The number of cores to use (if running locally), default is set to 90% of available.
stacked_spectra (bool) – Whether stacked spectra (of all instruments for an ObsID) should be used for this XSPEC spectral fit. If a stacking procedure for a particular telescope is not supported, this function will instead use individual spectra for an ObsID. The default is False.
telescope (str/List[str]) – Telescope(s) to produce deprojected temperature profiles from. Default is None, in which case deprojected temperature profiles will be produced from all telescopes associated with a source.
- Returns:
A dictionary of lists of the 3D temperature profiles measured by this function (keys are telescope names), though if the measurement was not successful, an entry of None will be added to the list.
- Return type:
Dict[str, List[GasTemperature3D]]
sourcetools.entropy module
Functions for measuring specific entropy profiles of galaxy clusters.
- xga.sourcetools.entropy.entropy_inv_abel_dens_onion_temp(sources, outer_radius, sb_model, dens_model, temp_model, global_radius, fit_method='mcmc', num_walkers=20, num_steps=20000, sb_pix_step=1, sb_min_snr=0.0, inv_abel_method=None, temp_annulus_method='min_snr', temp_min_snr=30, temp_min_cnt=<Quantity 1000. ct>, temp_min_width=<Quantity 20. arcsec>, temp_use_combined=True, temp_use_worst=False, freeze_met=True, abund_table='angr', temp_lo_en=<Quantity 0.3 keV>, temp_hi_en=<Quantity 7.9 keV>, group_spec=True, spec_min_counts=5, spec_min_sn=None, over_sample=None, one_rmf=True, num_cores=1, show_warn=True, psf_bins=4, stacked_spectra=False, telescope=None, global_temp_success_check=False)[source]
A convenience function that should allow the user to easily measure specific entropy profiles for a sample of galaxy clusters, elegantly dealing with any sources that have inadequate data or aren’t fit properly. For the sake of convenience, I have taken away a lot of choices that can be passed into the density and temperature measurement routines, and if you would like more control then please manually define a specific entropy profile object.
This function uses the inv_abel_fitted_model density measurement function, and the onion_deproj_temp_prof temperature measurement function (with the minimum signal to noise criteria for deciding on the annular spectra sizes).
The bulk of this code is the same as the hydrostatic mass measurement convenience function that also uses the inverse Abel density method, and the onion peeling temperature method, as the same physical information is required to measure the entropy.
- Parameters:
sources (GalaxyCluster/ClusterSample) – The galaxy cluster, or sample of galaxy clusters, that you wish to measure specific entropy profiles for.
outer_radius (str/Quantity) – The radius out to which you wish to measure gas density and temperature profiles. This can either be a string radius name (like ‘r500’) or an astropy quantity. That quantity should have as many entries as there are sources.
sb_model (str/List[str]/BaseModel1D/List[BaseModel1D]) – The model(s) to be fit to the cluster surface profile(s). You may pass the string name of a model (for single or multiple clusters), a single instance of an XGA model class (for single or multiple clusters), a list of string names (one entry for each cluster being analysed), or a list of XGA model instances (one entry for each cluster being analysed).
dens_model (str/List[str]/BaseModel1D/List[BaseModel1D]) – The model(s) to be fit to the cluster density profile(s). You may pass the string name of a model (for single or multiple clusters), a single instance of an XGA model class (for single or multiple clusters), a list of string names (one entry for each cluster being analysed), or a list of XGA model instances (one entry for each cluster being analysed).
temp_model (str/List[str]/BaseModel1D/List[BaseModel1D]) – The model(s) to be fit to the cluster temperature profile(s). You may pass the string name of a model (for single or multiple clusters), a single instance of an XGA model class (for single or multiple clusters), a list of string names (one entry for each cluster being analysed), or a list of XGA model instances (one entry for each cluster being analysed).
global_radius (str/Quantity) – This is a radius for a ‘global’ temperature measurement, which is both used as an initial check of data quality, and feeds into the conversion factor required for density measurements. This may also be passed as either a named radius or a quantity.
fit_method (str) – The method to use for fitting profiles within this function, default is ‘mcmc’.
num_walkers (int) – If fit_method is ‘mcmc’ this is the number of walkers to initialise for the ensemble sampler.
num_steps (int) – If fit_method is ‘mcmc’ this is the number steps for each walker to take.
sb_pix_step (int) – The width (in pixels) of each annular bin for the surface brightness profiles, default is 1.
sb_min_snr (int/float) – The minimum allowed signal to noise for the surface brightness profiles. Default is 0, which disables automatic re-binning.
inv_abel_method (str) – The method which should be used for the inverse abel transform of the model which is fitted to the surface brightness profile. This overrides the default method for the model, which is either ‘analytical’ for models with an analytical solution to the inverse abel transform, or ‘direct’ for models which don’t have an analytical solution. Default is None.
temp_annulus_method (str) – The method by which the temperature profile annuli are designated, this can be ‘min_snr’ (which will use the min_snr_proj_temp_prof function), or ‘min_cnt’ (which will use the min_cnt_proj_temp_prof function).
temp_min_snr (int/float) – The minimum signal-to-noise for a temperature measurement annulus, default is 30.
temp_min_cnt (int/Quantity) – The minimum background subtracted counts which are allowable in a given temperature annulus, used if temp_annulus_method is set to ‘min_cnt’.
temp_min_width (Quantity) – The minimum allowable width of a temperature annulus. The default is set to 20 arcseconds to try and avoid PSF effects.
temp_use_combined (bool) – If True (and temp_annulus_method is set to ‘min_snr’) then the combined RateMap will be used for signal-to-noise annulus calculations, this is overridden by temp_use_worst. If True (and temp_annulus_method is set to ‘min_cnt’) then combined RateMaps will be used for temperature annulus count calculations, if False then the median observation (in terms of counts) will be used.
temp_use_worst (bool) – If True then the worst observation of the cluster (ranked by global signal-to-noise) will be used for signal-to-noise temperature annulus calculations. Used if temp_annulus_method is set to ‘min_snr’.
freeze_met (bool) – Whether the metallicity parameter in the fits to annuli in XSPEC should be frozen.
abund_table (str) – The abundance table to use for fitting, and the conversion factor required during density calculations.
temp_lo_en (Quantity) – The lower energy limit for the XSPEC fits to annular spectra.
temp_hi_en (Quantity) – The upper energy limit for the XSPEC fits to annular spectra.
group_spec (bool) – A boolean flag that sets whether generated spectra are grouped or not.
spec_min_counts (int) – If generating a grouped spectrum, this is the minimum number of counts per channel. To disable minimum counts set this parameter to None.
spec_min_sn (int/float) – If generating a grouped spectrum, this is the minimum signal to noise in each channel. To disable minimum signal to noise set this parameter to None.
over_sample (bool) – The minimum energy resolution for each group, set to None to disable. e.g. if over_sample=3 then the minimum width of a group is 1/3 of the resolution FWHM at that energy.
one_rmf (bool) – This flag tells the method whether it should only generate one RMF for a particular ObsID-instrument combination - this is much faster in some circumstances, however the RMF does depend slightly on position on the detector.
num_cores (int) – The number of cores on your local machine which this function is allowed, default is 90% of the cores in your system.
show_warn (bool) – Should profile fit warnings be shown, or only stored in the profile models.
psf_bins (int) – The number of bins per side when generating a grid of PSFs for image correction prior to surface brightness profile (and thus density) measurements.
stacked_spectra (bool) – Whether stacked spectra (of all instruments for an ObsID) should be used for this XSPEC spectral fit. If a stacking procedure for a particular telescope is not supported, this function will instead use individual spectra for an ObsID. The default is False.
telescope (str/List[str]) – Telescope(s) to produce entropy profiles from. Default is None, in which case entropy profiles will be produced from all telescopes associated with a source.
global_temp_success_check (bool) – If True then this function will only attempt to measure an entropy profile from a particular telescope if a single temperature apec fit to a global spectrum within an aperture of radius ‘global_radius’ produced a successfully measured temperature - in many cases the failure of a global temperature fit indicates that annular spectral fits will also fail. HOWEVER, if you have very high signal-to-noise spectra then global fits can also fail because there are too many resolvable temperature components to get a good fit from a single temperature apec model, so be cautious. Default is False.
- Returns:
A dictionary of entropy profile lists measured by this function - the keys are telescope names. The values are lists with one entry per source, even if the source in question doesn’t have that telescope associated or the profile construction process failed.
- Return type:
Dict[str, List[Union[SpecificEntropy, None]]]/List[Union[SpecificEntropy, None]]
sourcetools.mass module
Functions for measuring hydrostatic mass profiles and overdensity masses of galaxy clusters.
- xga.sourcetools.mass.inv_abel_dens_onion_temp(sources, outer_radius, sb_model, dens_model, temp_model, global_radius, fit_method='mcmc', num_walkers=20, num_steps=20000, sb_pix_step=1, sb_min_snr=0.0, inv_abel_method=None, temp_annulus_method='min_snr', temp_min_snr=30, temp_min_cnt=<Quantity 1000. ct>, temp_min_width=<Quantity 20. arcsec>, temp_use_combined=True, temp_use_worst=False, freeze_met=True, abund_table='angr', temp_lo_en=<Quantity 0.3 keV>, temp_hi_en=<Quantity 7.9 keV>, group_spec=True, spec_min_counts=5, spec_min_sn=None, over_sample=None, one_rmf=True, num_cores=1, show_warn=True, psf_bins=4, stacked_spectra=False, telescope=None, global_temp_success_check=False)[source]
A convenience function that should allow the user to easily measure hydrostatic masses of a sample of galaxy clusters, elegantly dealing with any sources that have inadequate data or aren’t fit properly. For the sake of convenience, I have taken away a lot of choices that can be passed into the density and temperature measurement routines, and if you would like more control then please manually define a hydrostatic mass profile object.
This function uses the inv_abel_fitted_model density measurement function, and the onion_deproj_temp_prof temperature measurement function (with the minimum signal to noise criteria for deciding on the annular spectra sizes).
- Parameters:
sources (GalaxyCluster/ClusterSample) – The galaxy cluster, or sample of galaxy clusters, that you wish to measure hydrostatic masses for.
outer_radius (str/Quantity) – The radius out to which you wish to measure gas density and temperature profiles. This can either be a string radius name (like ‘r500’) or an astropy quantity. That quantity should have as many entries as there are sources.
sb_model (str/List[str]/BaseModel1D/List[BaseModel1D]) – The model(s) to be fit to the cluster surface profile(s). You may pass the string name of a model (for single or multiple clusters), a single instance of an XGA model class (for single or multiple clusters), a list of string names (one entry for each cluster being analysed), or a list of XGA model instances (one entry for each cluster being analysed).
dens_model (str/List[str]/BaseModel1D/List[BaseModel1D]) – The model(s) to be fit to the cluster density profile(s). You may pass the string name of a model (for single or multiple clusters), a single instance of an XGA model class (for single or multiple clusters), a list of string names (one entry for each cluster being analysed), or a list of XGA model instances (one entry for each cluster being analysed).
temp_model (str/List[str]/BaseModel1D/List[BaseModel1D]) – The model(s) to be fit to the cluster temperature profile(s). You may pass the string name of a model (for single or multiple clusters), a single instance of an XGA model class (for single or multiple clusters), a list of string names (one entry for each cluster being analysed), or a list of XGA model instances (one entry for each cluster being analysed).
global_radius (str/Quantity) – This is a radius for a ‘global’ temperature measurement, which is both used as an initial check of data quality, and feeds into the conversion factor required for density measurements. This may also be passed as either a named radius or a quantity.
fit_method (str) – The method to use for fitting profiles within this function, default is ‘mcmc’.
num_walkers (int) – If fit_method is ‘mcmc’ this is the number of walkers to initialise for the ensemble sampler.
num_steps (int) – If fit_method is ‘mcmc’ this is the number steps for each walker to take.
sb_pix_step (int) – The width (in pixels) of each annular bin for the surface brightness profiles, default is 1.
sb_min_snr (int/float) – The minimum allowed signal to noise for the surface brightness profiles. Default is 0, which disables automatic re-binning.
inv_abel_method (str) – The method which should be used for the inverse abel transform of the model which is fitted to the surface brightness profile. This overrides the default method for the model, which is either ‘analytical’ for models with an analytical solution to the inverse abel transform, or ‘direct’ for models which don’t have an analytical solution. Default is None.
temp_annulus_method (str) – The method by which the temperature profile annuli are designated, this can be ‘min_snr’ (which will use the min_snr_proj_temp_prof function), or ‘min_cnt’ (which will use the min_cnt_proj_temp_prof function).
temp_min_snr (int/float) – The minimum signal-to-noise for a temperature measurement annulus, default is 30.
temp_min_cnt (int/Quantity) – The minimum background subtracted counts which are allowable in a given temperature annulus, used if temp_annulus_method is set to ‘min_cnt’.
temp_min_width (Quantity) – The minimum allowable width of a temperature annulus. The default is set to 20 arcseconds to try and avoid PSF effects.
temp_use_combined (bool) – If True (and temp_annulus_method is set to ‘min_snr’) then the combined RateMap will be used for signal-to-noise annulus calculations, this is overridden by temp_use_worst. If True (and temp_annulus_method is set to ‘min_cnt’) then combined RateMaps will be used for temperature annulus count calculations, if False then the median observation (in terms of counts) will be used.
temp_use_worst (bool) – If True then the worst observation of the cluster (ranked by global signal-to-noise) will be used for signal-to-noise temperature annulus calculations. Used if temp_annulus_method is set to ‘min_snr’.
freeze_met (bool) – Whether the metallicity parameter in the fits to annuli in XSPEC should be frozen.
abund_table (str) – The abundance table to use for fitting, and the conversion factor required during density calculations.
temp_lo_en (Quantity) – The lower energy limit for the XSPEC fits to annular spectra.
temp_hi_en (Quantity) – The upper energy limit for the XSPEC fits to annular spectra.
group_spec (bool) – A boolean flag that sets whether generated spectra are grouped or not.
spec_min_counts (int) – If generating a grouped spectrum, this is the minimum number of counts per channel. To disable minimum counts set this parameter to None.
spec_min_sn (int/float) – If generating a grouped spectrum, this is the minimum signal to noise in each channel. To disable minimum signal to noise set this parameter to None.
over_sample (bool) – The minimum energy resolution for each group, set to None to disable. e.g. if over_sample=3 then the minimum width of a group is 1/3 of the resolution FWHM at that energy.
one_rmf (bool) – This flag tells the method whether it should only generate one RMF for a particular ObsID-instrument combination - this is much faster in some circumstances, however the RMF does depend slightly on position on the detector.
num_cores (int) – The number of cores on your local machine which this function is allowed, default is 90% of the cores in your system.
show_warn (bool) – Should profile fit warnings be shown, or only stored in the profile models.
psf_bins (int) – The number of bins per side when generating a grid of PSFs for image correction prior to surface brightness profile (and thus density) measurements.
stacked_spectra (bool) – Whether stacked spectra (of all instruments for an ObsID) should be used for this XSPEC spectral fit. If a stacking procedure for a particular telescope is not supported, this function will instead use individual spectra for an ObsID. The default is False.
telescope (str/List[str]) – Telescope(s) to produce hydrostatic mass profiles from. Default is None, in which case hydrostatic mass profiles will be produced from all telescopes associated with a source.
global_temp_success_check (bool) – If True then this function will only attempt to measure a mass profile from a particular telescope if a single temperature apec fit to a global spectrum within an aperture of radius ‘global_radius’ produced a successfully measured temperature - in many cases the failure of a global temperature fit indicates that annular spectral fits will also fail. HOWEVER, if you have very high signal-to-noise spectra then global fits can also fail because there are too many resolvable temperature components to get a good fit from a single temperature apec model, so be cautious. Default is False.
- Returns:
A dictionary of hydrostatic mass profile lists measured by this function - the keys are telescope names. The values are lists with one entry per source, even if the source in question doesn’t have that telescope associated or the profile construction process failed.
- Return type:
Dict[str, List[Union[HydrostaticMass, None]]]/List[Union[HydrostaticMass, None]]
sourcetools.match module
Functions for matching input source coordinates to available X-ray observations and source regions.
- xga.sourcetools.match.census_match(telescope=None, obs_ids=None)[source]
Returns XGA census entries (with ObsID, ra, and dec) that are not completely blacklisted, for the specified telescope(s). This is an extremely simple function, and could be largely replicated by just working with the CENSUS directly - however this does check against the blacklist, and will return things in the same style as the ‘proper’ matching functions.
The user can also pass a list of strings (or a dictionary of lists of strings in the case of multiple telescopes being considered) to limit the ObsIDs from the census that are to be considered.
- Parameters:
telescope (str/List[str]) – The telescope censuses that should be searched for matches, the default is None, in which case all telescopes that have been set up with this installation of XGA will be used. The user may pass a single telescope name, or a list of telescope names, to control which are used.
obs_ids (List[str]/dict) – ObsIDs that are to be considered
- Returns:
A dictionary of dataframes of matching ObsIDs, where the dictionary keys correspond to different telescopes. The second return is structured exactly the same, but represents observations that were completely excluded in the blacklist.
- Return type:
Tuple[dict, dict]
- xga.sourcetools.match.separation_match(src_ra, src_dec, distance=None, telescope=None, num_cores=1, show_warnings=True, return_flat=False)[source]
Returns XGA census entries (with ObsID, ra, and dec) that match to the input coordinates (either a single coordinate or a set). This is done for a set of telescopes (or a single telescope), and a match is made by the source coordinates being within specified search distances for the different telescopes.
- Parameters:
src_ra (float/np.ndarray) – RA coordinate(s) of the source(s), in degrees. To find matches for multiple coordinate pairs, pass an array.
src_dec (float/np.ndarray) – DEC coordinate(s) of the source(s), in degrees. To find matches for multiple coordinate pairs, pass an array.
distance (Quantity/dict) – The radius to search for observations within, the default is None in which case standard search distances for different telescopes are used. The user may pass a single Quantity to use for all telescopes, a dictionary with keys corresponding to ALL or SOME of the telescopes specified by the ‘telescope’ argument. In the case where only SOME of the telescopes are specified in a distance dictionary, the default XGA values will be used for any that are missing.
telescope (str/List[str]) – The telescope censuses that should be searched for matches, the default is None, in which case all telescopes that have been set up with this installation of XGA will be used. The user may pass a single telescope name, or a list of telescope names, to control which are used.
num_cores (int) – The number of cores to use, default is set to 90% of system cores. This is only relevant if multiple coordinate pairs are passed.
show_warnings (bool) – If False, then any warnings that occur will not be displayed. Default is True.
return_flat (bool) – If True, then a flat DataFrame will be returned instead of a sparse dictionary or list of dictionaries. Default is False.
- Returns:
A list of dictionaries (or single dictionary for one coordinate) of dataframes of matching ObsIDs, where each dictionary corresponds to an input RA-Dec (in the same order), and the dictionary keys correspond to different telescopes. The second return is structured exactly the same, but represents observations that were completely excluded in the blacklist.
- Return type:
Tuple[Union[dict, List[dict], pd.DataFrame], Union[dict, List[dict], pd.DataFrame]]
- xga.sourcetools.match.on_detector_match(src_ra, src_dec, distance=None, telescope=None, num_cores=1)[source]
A matching function that checks whether supplied coordinates lie on a detector by using exposure maps to determine the exposure time at the supplied coordinates. Of course, this means that we need an idea of which observations should be checked, so we first run the ‘separation_match’ function.
- Parameters:
src_ra (float/np.ndarray) – RA coordinate(s) of the source(s), in degrees. To find matches for multiple coordinate pairs, pass an array.
src_dec (float/np.ndarray) – Dec coordinate(s) of the source(s), in degrees. To find matches for multiple coordinate pairs, pass an array.
distance (Quantity/dict) – As this function calls ‘separation_match’, we have to supply the distance to search for observations within, the default is None in which case standard search distances for different telescopes are used. The user may pass a single Quantity to use for all telescopes, a dictionary with keys corresponding to ALL or SOME of the telescopes specified by the ‘telescope’ argument. In the case where only SOME of the telescopes are specified in a distance dictionary, the default XGA values will be used for any that are missing.
telescope (str/List[str]) – The telescope censuses that should be searched for matches, the default is None, in which case all telescopes that have been set up with this installation of XGA will be used. The user may pass a single telescope name, or a list of telescope names, to control which are used.
num_cores (int) – The number of cores to use, default is set to 90% of system cores. This is only relevant if multiple coordinate pairs are passed.
- Returns:
For a single input coordinate, a dictionary (with telescope names as keys) of numpy arrays of ObsID(s) will be returned. For multiple input coordinates an array of dictionaries (with telescope names as keys) of arrays of ObsID(s) and None values will be returned. Each entry corresponds to the input coordinate array, a None value indicates that the coordinate did not fall on an telescope observation at all.
- Return type:
Union[dict, np.ndarray]
- xga.sourcetools.match.region_match(src_ra, src_dec, src_type, distance=None, telescope=None, num_cores=1)[source]
A function which, if XGA has been configured with access to pre-generated region files, will search for region matches for a set of source coordinates passed in by the user. A region match is defined as when a source coordinate falls within a source region with a particular colour (largely used to represent point vs extended) - the type of region that should be matched to can be defined using the src_type argument.
The separation_match function will be run before the source matching process, to narrow down the sources which need to have the more expensive region matching performed, as well as to identify which ObsID(s) should be examined for each source.
- Parameters:
src_ra (float/np.ndarray) – RA coordinate(s) of the source(s), in degrees. To find matches for multiple coordinate pairs, pass an array.
src_dec (float/np.ndarray) – Dec coordinate(s) of the source(s), in degrees. To find matches for multiple coordinate pairs, pass an array.
src_type (str/List[str]) – The type(s) of region that should be matched to. Pass either ‘ext’ or ‘pnt’ or a list containing both.
distance (Quantity/dict) – The distance to search for observations within, the default is None in which case standard search distances for different telescopes are used. The user may pass a single Quantity to use for all telescopes, a dictionary with keys corresponding to ALL or SOME of the telescopes specified by the ‘telescope’ argument. In the case where only SOME of the telescopes are specified in a distance dictionary, the default XGA values will be used for any that are missing.
telescope (str/List[str]) – The telescope censuses that should be searched for matches, the default is None, in which case all telescopes that have been set up with this installation of XGA will be used. The user may pass a single telescope name, or a list of telescope names, to control which are used.
num_cores (int) – The number of cores that can be used for the matching process.
- Returns:
An array the same length as the sets of input coordinates (ordering is the same). If there are no matches for a source then the element will be None, if there are matches then the element will be a dictionary, with top key(s) being telescope names, lower level keys being ObsID(s), and the values being a list of region objects (or more likely just one object).
- Return type:
np.ndarray
- xga.sourcetools.match.simple_xmm_match(src_ra, src_dec, distance=<Quantity 30. arcmin>, num_cores=1)[source]
Returns XMM ObsIDs within a given distance from the input ra and dec values.
- Parameters:
src_ra (float/np.ndarray) – RA coordinate(s) of the source(s), in degrees. To find matches for multiple coordinate pairs, pass an array.
src_dec (float/np.ndarray) – DEC coordinate(s) of the source(s), in degrees. To find matches for multiple coordinate pairs, pass an array.
distance (Quantity) – The distance to search for XMM observations within, default should be able to match a source on the edge of an observation to the centre of the observation.
num_cores (int) – The number of cores to use, default is set to 90% of system cores. This is only relevant if multiple coordinate pairs are passed.
- Returns:
A dataframe containing ObsID, RA_PNT, and DEC_PNT of matching XMM observations, and a dataframe containing information on observations that would have been a match, but that are in the blacklist.
- Return type:
Tuple[Union[DataFrame, List[DataFrame]], Union[DataFrame, List[DataFrame]]]
sourcetools.misc module
Miscellaneous utility functions for source analysis, coordinate conversion, and nH lookup.
- xga.sourcetools.misc.nh_lookup(coord_pair)[source]
Uses HEASoft to lookup hydrogen column density for given coordinates.
- Parameters:
coord_pair (Quantity) – An astropy quantity with RA and DEC of interest.
- Returns:
Average and weighted average nH values.
- Return type:
Quantity
- xga.sourcetools.misc.rad_to_ang(rad, z, cosmo=LambdaCDM(name=None, H0=<Quantity 70. km / (Mpc s)>, Om0=0.3, Ode0=0.7, Tcmb0=<Quantity 0. K>, Neff=3.04, m_nu=None, Ob0=0.0))[source]
Converts radius in length units to radius on sky in degrees.
- Parameters:
rad (Quantity) – Radius for conversion.
cosmo (Cosmology) – An instance of an astropy cosmology, the default is a flat LambdaCDM concordance model.
z (float) – The redshift of the source.
- Returns:
The radius in degrees.
- Return type:
Quantity
- xga.sourcetools.misc.ang_to_rad(ang, z, cosmo=LambdaCDM(name=None, H0=<Quantity 70. km / (Mpc s)>, Om0=0.3, Ode0=0.7, Tcmb0=<Quantity 0. K>, Neff=3.04, m_nu=None, Ob0=0.0))[source]
The counterpart to rad_to_ang, this converts from an angle to a radius in kpc.
- Parameters:
ang (Quantity) – Angle to be converted to radius.
cosmo (Cosmology) – An instance of an astropy cosmology, the default is a flat LambdaCDM concordance model.
z (float) – The _redshift of the source.
- Returns:
The radius in kpc.
- Return type:
Quantity
- xga.sourcetools.misc.name_to_coord(name)[source]
Takes a standard format name (e.g. XMMXCS J041853.9+555333.7) and returns RA and DEC in degrees. The sexagesimal coordinates are parsed from the string and converted to decimal degrees.
- Parameters:
name (str) – Standard format name of an object.
- Returns:
An astropy quantity containing RA and DEC in degrees.
- Return type:
Quantity
- xga.sourcetools.misc.coord_to_name(coord_pair, survey=None)[source]
This was originally just written in the init of BaseSource, but I figured I should split it out into its own function really. This will take a coordinate pair, and optional survey name, and spit out an object name in the standard format.
- Parameters:
coord_pair (Quantity) – The coordinate pair for which we want to generate a name.
survey (str) – The name of the survey to prefix the name with, default is None.
- Returns:
Source name based on coordinates.
- Return type:
str
- xga.sourcetools.misc.model_check(sources, model)[source]
Very simple function that checks if a passed set of models is appropriately structured for the number of sources that have been passed. There is no reason a user would need this directly, it’s only here as these checks have to be performed in multiple places in sourcetools.
- Parameters:
sources (BaseSource/BaseSample/List[BaseSource]) – The source(s) for which we are checking models.
model (str/List[str]/BaseModel1D/List[BaseModel1D]) – The model(s).
- Returns:
A list of model instances, or names of models.
- Return type:
Union[List[BaseModel1D], List[str]]
sourcetools.stack module
Functions for scaling and stacking 2D images and radial profiles across samples of extended sources.
- xga.sourcetools.stack.stacked_radial_brightness(sources, scale_radius='r200', lo_en=<Quantity 0.5 keV>, hi_en=<Quantity 2. keV>, psf_corr=False, psf_model='ELLBETA', psf_bins=4, psf_algo='rl', psf_iter=15, num_bins=100, max_scale=1.5, num_cores=1, telescope=None)[source]
This function will scale the radial brightness profiles of a sample of clusters by a given over-density radius, interpolate them onto a common radial grid, then stack them to find the average profile of the sample.
- Parameters:
sources (ClusterSample) – The source objects that will contribute to the stacked brightness profile.
scale_radius (str) – The over-density radius to scale the cluster radii by, all GalaxyCluster objects must have an entry for this radius.
lo_en (Quantity) – The lower energy bound of the ratemaps to use.
hi_en (Quantity) – The upper energy bound of the ratemaps to use.
psf_corr (bool) – If True, the PSF corrected ratemaps will be used.
psf_model (str) – If using PSF corrected ratemaps, the PSF model used to correct them.
psf_bins (int) – If using PSF corrected ratemaps, the number of bins per side.
psf_algo (str) – If using PSF corrected ratemaps, the algorithm used.
psf_iter (int) – If using PSF corrected ratemaps, the number of iterations.
num_bins (int) – The number of radial bins for the common grid, default is 100.
max_scale (float) – The maximum scaled radius to include in the stack, default is 1.5.
num_cores (int) – The number of cores to use, default is set to 90% of system cores.
telescope (str) – The telescope to retrieve ratemaps, images, and masks for, e.g. ‘xmm’ or ‘erosita’. Default is None, in which case the default telescope associated with the source/sample will be used.
- Returns:
A dictionary containing the stacked brightness profile, the radii it was calculated at, and the standard deviation of the stacked profile.
- Return type:
dict
- xga.sourcetools.stack.radial_data_stack(sources, scale_radius='r200', use_peak=True, pix_step=1, radii=None, min_snr=0.0, lo_en=<Quantity 0.5 keV>, hi_en=<Quantity 2. keV>, custom_temps=None, sim_met=0.3, abund_table='angr', psf_corr=False, psf_model='ELLBETA', psf_bins=4, psf_algo='rl', psf_iter=15, num_cores=1, telescope=None)[source]
Creates and scales radial brightness profiles for a set of galaxy clusters so that they can be combined and compared, like for like. This particular function does not fit models, and outputs a mean brightness profile, as well as the scaled stack data and covariance matrices. This is based on the method in https://doi.org/10.1093/mnras/stv1366, though modified to work with profiles rather than 2D images.
- Parameters:
sources (ClusterSample) – The source objects that will contribute to the stacked brightness profile.
scale_radius (str) – The overdensity radius to scale the cluster radii by, all GalaxyCluster objects must have an entry for this radius.
use_peak (bool) – Controls whether the peak position is used as the centre of the brightness profile for each GalaxyCluster object.
pix_step (int) – The width (in pixels) of each annular bin for the individual profiles, default is 1.
radii (ndarray) – The radii (in units of scale_radius) at which to measure and stack surface brightness. Default is None, in which case np.linspace(0.01, 1, 20) is used.
min_snr (int/float) – The minimum allowed signal to noise for individual cluster profiles. Default is 0, which disables automatic rebinning.
lo_en (Quantity) – The lower energy bound of the ratemaps to use.
hi_en (Quantity) – The upper energy bound of the ratemaps to use.
custom_temps (Quantity) – Temperatures at which to calculate conversion factors for each cluster in sources, they will overwrite any temperatures measured by XGA. A single temperature can be passed to be used for all clusters in sources. If None, appropriate temperatures will be retrieved from the source objects.
sim_met (float/List) – The metallicity(s) to use when calculating the conversion factor. Pass a single float to use the same value for all sources, or pass a list to use a different value for each.
abund_table (str) – The abundance table to use for the temperature fit and conversion factor calculation.
psf_corr (bool) – If True, PSF corrected ratemaps will be used to make the brightness profile stack.
psf_model (str) – If PSF corrected, the PSF model used.
psf_bins (int) – If PSF corrected, the number of bins per side.
psf_algo (str) – If PSF corrected, the algorithm used.
psf_iter (int) – If PSF corrected, the number of algorithm iterations.
num_cores (int) – The number of cores to use when calculating the brightness profiles, the default is 90% of available cores.
telescope (str) – The telescope to retrieve ratemaps, images, and masks for, e.g. ‘xmm’ or ‘erosita’. Default is None, in which case the default telescope associated with the source/sample will be used.
- Returns:
This function returns the average profile, the scaled brightness profiles with the cluster changing along the y direction and the bin changing along the x direction, an array of the radii at which the brightness was measured (in units of scale_radius), and finally the covariance matrix and normalised covariance matrix. I also return a list of source names that WERE included in the stack.
- Return type:
Tuple[ndarray, ndarray, ndarray, ndarray, ndarray, list]
- xga.sourcetools.stack.view_radial_data_stack(sources, scale_radius='r200', use_peak=True, pix_step=1, radii=None, min_snr=0.0, lo_en=<Quantity 0.5 keV>, hi_en=<Quantity 2. keV>, custom_temps=None, sim_met=0.3, abund_table='angr', psf_corr=False, psf_model='ELLBETA', psf_bins=4, psf_algo='rl', psf_iter=15, num_cores=1, show_images=False, figsize=(14, 14), telescope=None)[source]
A convenience function that calls radial_data_stack and makes plots of the average profile, individual profiles, covariance, and normalised covariance matrix.
- Parameters:
sources (ClusterSample) – The source objects that will contribute to the stacked brightness profile.
scale_radius (str) – The overdensity radius to scale the cluster radii by, all GalaxyCluster objects must have an entry for this radius.
use_peak (bool) – Controls whether the peak position is used as the centre of the brightness profile for each GalaxyCluster object.
pix_step (int) – The width (in pixels) of each annular bin for the individual profiles, default is 1.
radii (ndarray) – The radii (in units of scale_radius) at which to measure and stack surface brightness. Default is None, in which case np.linspace(0.01, 1, 20) is used.
min_snr (int/float) – The minimum allowed signal to noise for individual cluster profiles. Default is 0, which disables automatic rebinning.
lo_en (Quantity) – The lower energy limit of the data that goes into the stacked profiles.
hi_en (Quantity) – The upper energy limit of the data that goes into the stacked profiles.
custom_temps (Quantity) – Temperatures at which to calculate conversion factors for each cluster in sources, they will overwrite any temperatures measured by XGA. A single temperature can be passed to be used for all clusters in sources. If None, appropriate temperatures will be retrieved from the source objects.
sim_met (float/List) – The metallicity(s) to use when calculating the conversion factor. Pass a single float to use the same value for all sources, or pass a list to use a different value for each.
abund_table (str) – The abundance table to use for the temperature fit and conversion factor calculation.
psf_corr (bool) – If True, PSF corrected ratemaps will be used to make the brightness profile stack.
psf_model (str) – If PSF corrected, the PSF model used.
psf_bins (int) – If PSF corrected, the number of bins per side.
psf_algo (str) – If PSF corrected, the algorithm used.
psf_iter (int) – If PSF corrected, the number of algorithm iterations.
num_cores (int) – The number of cores to use when calculating the brightness profiles, the default is 90% of available cores.
show_images (bool) – If true then for each source in the stack an image and profile will be displayed side by side, with annuli overlaid on the image.
figsize (tuple) – The desired figure size for the plot.
telescope (str) – The telescope to retrieve ratemaps, images, and masks for, e.g. ‘xmm’ or ‘erosita’. Default is None, in which case the default telescope associated with the source/sample will be used.
- xga.sourcetools.stack.radial_model_stack(sources, model, scale_radius='r200', fit_method='mcmc', use_peak=True, pix_step=1, radii=None, min_snr=0.0, lo_en=<Quantity 0.5 keV>, hi_en=<Quantity 2. keV>, custom_temps=None, sim_met=0.3, abund_table='angr', psf_corr=False, psf_model='ELLBETA', psf_bins=4, psf_algo='rl', psf_iter=15, num_cores=1, num_walkers=20, num_steps=20000, telescope=None)[source]
Creates, fits, and scales radial brightness profiles for a set of galaxy clusters so that they can be combined and compared, like for like. This function fits models of a user’s choice, and then uses the models to retrieve brightness values at user-defined radii as a fraction of the scale radius. From that point it functions much as radial_data_stack does.
- Parameters:
sources (ClusterSample) – The source objects that will contribute to the stacked brightness profile.
model (str) – The model to fit to the brightness profiles.
scale_radius (str) – The overdensity radius to scale the cluster radii by, all GalaxyCluster objects must have an entry for this radius.
fit_method (str) – The method for the profile object to use to fit the model, default is mcmc.
use_peak (bool) – Controls whether the peak position is used as the centre of the brightness profile for each GalaxyCluster object.
pix_step (int) – The width (in pixels) of each annular bin for the individual profiles, default is 1.
radii (ndarray) – The radii (in units of scale_radius) at which to measure and stack surface brightness. Default is None, in which case np.linspace(0.01, 1, 20) is used.
min_snr (int/float) – The minimum allowed signal to noise for individual cluster profiles. Default is 0, which disables automatic rebinning.
lo_en (Quantity) – The lower energy limit of the data that goes into the stacked profiles.
hi_en (Quantity) – The upper energy limit of the data that goes into the stacked profiles.
custom_temps (Quantity) – Temperatures at which to calculate conversion factors for each cluster in sources, they will overwrite any temperatures measured by XGA. A single temperature can be passed to be used for all clusters in sources. If None, appropriate temperatures will be retrieved from the source objects.
sim_met (float/List) – The metallicity(s) to use when calculating the conversion factor. Pass a single float to use the same value for all sources, or pass a list to use a different value for each.
abund_table (str) – The abundance table to use for the temperature fit and conversion factor calculation.
psf_corr (bool) – If True, PSF corrected ratemaps will be used to make the brightness profile stack.
psf_model (str) – If PSF corrected, the PSF model used.
psf_bins (int) – If PSF corrected, the number of bins per side.
psf_algo (str) – If PSF corrected, the algorithm used.
psf_iter (int) – If PSF corrected, the number of algorithm iterations.
num_cores (int) – The number of cores to use when calculating the brightness profiles, the default is 90% of available cores.
num_walkers (int) – The number of walkers in the MCMC ensemble sampler.
num_steps (int) – The number of steps in the chain that each walker should take.
telescope (str) – The telescope to retrieve ratemaps, images, and masks for, e.g. ‘xmm’ or ‘erosita’. Default is None, in which case the default telescope associated with the source/sample will be used.
- Returns:
This function returns the average profile, the scaled brightness profiles with the cluster changing along the y direction and the bin changing along the x direction, an array of the radii at which the brightness was measured (in units of scale_radius), and finally the covariance matrix and normalised covariance matrix. I also return a list of source names that WERE included in the stack.
- Return type:
Tuple[ndarray, ndarray, ndarray, ndarray, ndarray, list]
- xga.sourcetools.stack.view_radial_model_stack(sources, model, scale_radius='r200', fit_method='mcmc', use_peak=True, pix_step=1, radii=None, min_snr=0.0, lo_en=<Quantity 0.5 keV>, hi_en=<Quantity 2. keV>, custom_temps=None, sim_met=0.3, abund_table='angr', psf_corr=False, psf_model='ELLBETA', psf_bins=4, psf_algo='rl', psf_iter=15, num_cores=1, num_walkers=30, num_steps=20000, show_images=False, figsize=(14, 14), telescope=None)[source]
A convenience function that calls radial_model_stack and makes plots of the average profile, individual profiles, covariance, and normalised covariance matrix.
- Parameters:
sources (ClusterSample) – The source objects that will contribute to the stacked brightness profile.
model (str) – The model to fit to the brightness profiles.
scale_radius (str) – The overdensity radius to scale the cluster radii by, all GalaxyCluster objects must have an entry for this radius.
fit_method (str) – The method to use when fitting the model to the profile.
use_peak (bool) – Controls whether the peak position is used as the centre of the brightness profile for each GalaxyCluster object.
pix_step (int) – The width (in pixels) of each annular bin for the individual profiles, default is 1.
radii (ndarray) – The radii (in units of scale_radius) at which to measure and stack surface brightness. Default is None, in which case np.linspace(0.01, 1, 20) is used.
min_snr (int/float) – The minimum allowed signal to noise for individual cluster profiles. Default is 0, which disables automatic rebinning.
lo_en (Quantity) – The lower energy limit of the data that goes into the stacked profiles.
hi_en (Quantity) – The upper energy limit of the data that goes into the stacked profiles.
custom_temps (Quantity) – Temperatures at which to calculate conversion factors for each cluster in sources, they will overwrite any temperatures measured by XGA. A single temperature can be passed to be used for all clusters in sources. If None, appropriate temperatures will be retrieved from the source objects.
sim_met (float/List) – The metallicity(s) to use when calculating the conversion factor. Pass a single float to use the same value for all sources, or pass a list to use a different value for each.
abund_table (str) – The abundance table to use for the temperature fit and conversion factor calculation.
psf_corr (bool) – If True, PSF corrected ratemaps will be used to make the brightness profile stack.
psf_model (str) – If PSF corrected, the PSF model used.
psf_bins (int) – If PSF corrected, the number of bins per side.
psf_algo (str) – If PSF corrected, the algorithm used.
psf_iter (int) – If PSF corrected, the number of algorithm iterations.
num_cores (int) – The number of cores to use when calculating the brightness profiles, the default is 90% of available cores.
num_walkers (int) – The number of walkers in the MCMC ensemble sampler.
num_steps (int) – The number of steps in the chain that each walker should take.
show_images (bool) – If true then for each source in the stack an image and profile will be displayed side by side, with annuli overlaid on the image.
figsize (tuple) – The desired figure size for the plot.
telescope (str) – The telescope to retrieve ratemaps, images, and masks for, e.g. ‘xmm’ or ‘erosita’. Default is None, in which case the default telescope associated with the source/sample will be used.
sourcetools.deproj module
Functions for geometric deprojection and shell-annulus volume intersection calculations.
- xga.sourcetools.deproj.shell_ann_vol_intersect(shell_radii, ann_radii)[source]
This function calculates the volume intersection matrix of a set of circular annuli and a set of spherical shells. It is assumed that the annuli and shells have the same x and y origin. The intersection is derived using simple geometric considerations, have a look in the appendix of DOI 10.1086/300836.
- Parameters:
shell_radii (ndarray/Quantity) – The radii of the spherical shells.
ann_radii (ndarray/Quantity) – The radii of the circular annuli (DOES NOT need to be the same length as shell_radii).
- Returns:
A 2D array containing the volumes of intersections between the circular annuli defined by i_ann and o_ann, and the spherical shells defined by i_sph and o_sph. Annular radii are along the ‘x’ axis and shell radii are along the ‘y’ axis.
- Return type:
Union[np.ndarray, Quantity]
- xga.sourcetools.deproj.shell_volume(inn_radius, out_radius)[source]
Silly little function that calculates the volume of a spherical shell with inner radius inn_radius and outer radius out_radius.
- Parameters:
inn_radius (Quantity/np.ndarray) – The inner radius of the spherical shell.
out_radius (Quantity/np.ndarray) – The outer radius of the spherical shell.
- Returns:
The volume of the specified shell
- Return type:
Union[Quantity, np.ndarray]