Thermal Spectra API

class soxs.thermal_spectra.ApecGenerator(emin, emax, nbins, binscale='linear', var_elem=None, apec_root=None, apec_vers=None, broadening=True, nolines=False, abund_table=None, nei=False)[source]

Create spectra assuming a thermal plasma emission model in collisional ionization equilibrium from the AtomDB APEC tables available at http://www.atomdb.org. This code borrows heavily from Python routines used to read the APEC tables developed by Adam Foster at the CfA (afoster@cfa.harvard.edu).

Parameters:
  • emin (float, (value, unit) tuple, or Quantity) – The minimum energy for the spectral model.

  • emax (float, (value, unit) tuple, or Quantity) – The maximum energy for the spectral model.

  • nbins (integer) – The number of bins in the spectral model.

  • binscale (string, optional) – The scale of the energy binning: “linear” or “log”. Default: “linear”

  • var_elem (list of strings, optional) – The names of elements to allow to vary freely from the single abundance parameter. These must be strings like [“O”, “N”, “He”], or if nei=True they must be elements with ionization states, e.g. [“O^1”, “O^2”, “N^4”]. Default: None

  • apec_root (string, optional) – The directory root where the APEC model files are stored. If not provided, the default is to grab them from the tables stored with SOXS.

  • apec_vers (string, optional) – The version identifier string for the APEC files. Default is set in the SOXS configuration file, the default for which is “3.0.9”.

  • broadening (boolean, optional) – Whether the spectral lines should be thermally and velocity broadened. Default: True

  • nolines (boolean, optional) – Turn off lines entirely for generating spectra. Default: False

  • abund_table (string or array_like, optional) – The abundance table to be used for solar abundances. Either a string corresponding to a built-in table or an array of 30 floats corresponding to the abundances of each element relative to the abundance of H. Default is set in the SOXS configuration file, the default for which is “angr”. Built-in options are: “angr” : from Anders E. & Grevesse N. (1989, Geochimica et Cosmochimica Acta 53, 197) “aspl” : from Asplund M., Grevesse N., Sauval A.J. & Scott P. (2009, ARAA, 47, 481) “feld” : from Feldman U. (1992, Physica Scripta, 46, 202) “wilm” : from Wilms, Allen & McCray (2000, ApJ 542, 914 except for elements not listed which are given zero abundance) “lodd” : from Lodders, K (2003, ApJ 591, 1220) “cl17.03” : the abundance table used in Cloudy v17.03.

  • nei (boolean, optional) – If True, use the non-equilibrium ionization tables.

Examples

>>> apec_model = ApecGenerator(0.05, 50.0, 1000, apec_vers="3.0.3",
...                            broadening=True)
class soxs.thermal_spectra.SpexGenerator(emin, emax, nbins, binscale='linear', var_elem=None, spex_vers=None, spex_root=None, broadening=True, nolines=False, abund_table=None)[source]

Create thermal spectral using the SPEX CIE model (https://spex-xray.github.io/spex-help/models/cie.html) The same underlying machinery as the APEC model is used, as the SPEX model has been converted to the APEC table format using the code at https://github.com/jeremysanders/spex_to_xspec.

Note that the default abundance table is Anders & Grevasse (1989), which can be changed using the abund_table keyword argument.

Parameters:
  • emin (float, (value, unit) tuple, or Quantity) – The minimum energy for the spectral model.

  • emax (float, (value, unit) tuple, or Quantity) – The maximum energy for the spectral model.

  • nbins (integer) – The number of bins in the spectral model.

  • binscale (string, optional) – The scale of the energy binning: “linear” or “log”. Default: “linear”

  • var_elem (list of strings, optional) – The names of elements to allow to vary freely from the single abundance parameter. These must be strings like [“O”, “N”, “He”]. Default: None

  • spex_root (string, optional) – The directory root where the SPEX model files are stored. If not provided, the default is to grab them from the tables stored with SOXS.

  • spex_vers (string, optional) – The version identifier string for the SPEX files. Default is set in the SOXS configuration file, the default for which is “3.07.03”.

  • broadening (boolean, optional) – Whether the spectral lines should be thermally and velocity broadened. Default: True

  • nolines (boolean, optional) – Turn off lines entirely for generating spectra. Default: False

  • abund_table (string or array_like, optional) – The abundance table to be used for solar abundances. Either a string corresponding to a built-in table or an array of 30 floats corresponding to the abundances of each element relative to the abundance of H. Default is set in the SOXS configuration file, the default for which is “angr”. Built-in options are: “angr” : from Anders E. & Grevesse N. (1989, Geochimica et Cosmochimica Acta 53, 197) “aspl” : from Asplund M., Grevesse N., Sauval A.J. & Scott P. (2009, ARAA, 47, 481) “feld” : from Feldman U. (1992, Physica Scripta, 46, 202) “wilm” : from Wilms, Allen & McCray (2000, ApJ 542, 914 except for elements not listed which are given zero abundance) “lodd” : from Lodders, K (2003, ApJ 591, 1220) “cl17.03” : the abundance table used in Cloudy v17.03.

Examples

>>> spex_model = SpexGenerator(0.05, 50.0, 1000, broadening=True)
get_nei_spectrum(kT, elem_abund, redshift, norm, velocity=0.0)[source]

Get a thermal emission spectrum assuming NEI.

Parameters:
  • kT (float, (value, unit) tuple, or Quantity) – The temperature in keV.

  • elem_abund (dict of element name, float pairs) – A dictionary of ionization state abundances in solar units to vary freely of the abund parameter, e.g. {“O^1”: 0.4, “O^4”: 0.6, “N^2”: 0.7} Default: None

  • redshift (float) – The redshift.

  • norm (float) – The normalization of the model, in the standard Xspec units of 1.0e-14*EM/(4*pi*(1+z)**2*D_A**2).

  • velocity (float, (value, unit) tuple, or Quantity, optional) – The velocity broadening parameter, in units of km/s. Default: 0.0

class soxs.thermal_spectra.MekalGenerator(emin, emax, nbins, binscale='linear', var_elem=None, abund_table='angr')[source]
class soxs.thermal_spectra.CloudyCIEGenerator(emin, emax, nbins, binscale='linear', var_elem=None, model_vers=None)[source]
class soxs.thermal_spectra.IGMGenerator(emin, emax, nbins, binscale='linear', resonant_scattering=False, cxb_factor=0.5, var_elem=None, model_vers=None)[source]
soxs.thermal_spectra.download_spectrum_tables(model, model_vers=None, loc=None)[source]

Download thermal model spectrum tables used for the various models supported by SOXS.

Parameters:
  • model (string) – Model string to specify which model files to download. Options are: “cie”, “igm”, “apec”, “spex”, “mekal”

  • model_vers (string) – The version of the model to download. If not specified, the default for the given model will be assumed, which are detailed in the docstrings for the various models.

  • loc (string or Path object, optional) – The path to download the files to. If not specified, it will download them to the current working directory.