Source Models API¶
Classes for specific source models

class
pyxsim.source_models.
LineSourceModel
(e0, emission_field, sigma=None, prng=None)[source]¶ Initialize a source model from a single line.
 Parameters
e0 (float, (value, unit) tuple,
YTQuantity
, orQuantity
) – The location of the emission line in energy in the rest frame of the source. If units are not given, they are assumed to be in keV.emission_field (string or (ftype, fname) tuple) – The field corresponding to the photon count rate per cell or particle, in the rest frame of the source, which serves as the normalization for the line. Must be in counts/s.
sigma (float, (value, unit) tuple,
YTQuantity
, orQuantity
) – The standard intrinsic deviation of the emission line (not from Doppler broadening, which is handled in the projection step). Units of velocity or energy are accepted. If units are not given, they are assumed to be in keV. If set to a field name, the line broadening is assumed to be based on this field (in units of velocity or energy). If set to None (the default), it is assumed that the line is unbroadened.prng (integer or
RandomState
object) – A pseudorandom number generator. Typically will only be specified if you have a reason to generate the same set of random numbers, such as for a test. Default is to use thenumpy.random
module.
Examples
>>> location = (3.5, "keV") >>> sigma = (1000., "km/s") >>> line_model = LineEmissionSourceModel(location, "dark_matter_density_squared", sigma=sigma)

class
pyxsim.source_models.
PowerLawSourceModel
(e0, emin, emax, emission_field, alpha, prng=None)[source]¶ Initialize a source model from a powerlaw spectrum.
 Parameters
e0 (float, (value, unit) tuple,
YTQuantity
, orQuantity
) – The reference energy of the power law, in the rest frame of the source. If units are not given, they are assumed to be in keV.emin (float, (value, unit) tuple,
YTQuantity
, orQuantity
) – The minimum energy of the photons to be generated, in the rest frame of the source. If units are not given, they are assumed to be in keV.emax (float, (value, unit) tuple,
YTQuantity
, orQuantity
) – The maximum energy of the photons to be generated, in the rest frame of the source. If units are not given, they are assumed to be in keV.emission_field (string or (ftype, fname) tuple) – The field corresponding to the specific photon count rate per cell or particle, in the rest frame of the source, which serves as the normalization for the power law. Must be in counts/s/keV.
index (float, string, or (ftype, fname) tuple) – The powerlaw index of the spectrum. Either a float for a single power law or the name of a field that corresponds to the power law.
prng (integer or
RandomState
object) – A pseudorandom number generator. Typically will only be specified if you have a reason to generate the same set of random numbers, such as for a test. Default is to use thenumpy.random
module.
Examples
>>> e0 = (1.0, "keV") >>> emin = (0.01, "keV") >>> emax = (100., "keV") >>> plaw_model = PowerLawSourceModel(e0, emin, emax, ("gas", "norm"), ("gas", "index"))

class
pyxsim.source_models.
ThermalSourceModel
(spectral_model, emin, emax, nchan, Zmet, temperature_field=None, emission_measure_field=None, kT_min=0.025, kT_max=64.0, n_kT=10000, kT_scale='linear', max_density=5e25, var_elem=None, method='invert_cdf', thermal_broad=True, model_root=None, model_vers=None, nei=False, nolines=False, abund_table='angr', prng=None)[source]¶ Initialize a source model from a thermal spectrum.
 Parameters
spectral_model (string) – The thermal model spectrum type to use. Known options are “apec”.
emin (float) – The minimum energy for the spectrum in keV.
emax (float) – The maximum energy for the spectrum in keV.
nchan (integer) – The number of channels in the spectrum.
Zmet (float, string, or tuple of strings) – The metallicity. If a float, assumes a constant metallicity throughout in solar units. If a string or tuple of strings, is taken to be the name of the metallicity field.
temperature_field (string or (ftype, fname) tuple, optional) – The yt temperature field to use for the thermal modeling. Must have units of Kelvin. If not specified, the default temperature field for the dataset will be used.
emission_measure_field (string or (ftype, fname) tuple, optional) – The yt emission measure field to use for the thermal modeling. Must have units of cm^3. If not specified, the default emission measure field for the dataset will be used or derived.
kT_min (float, optional) – The default minimum temperature in keV to compute emission for. Default: 0.025
kT_max (float, optional) – The default maximum temperature in keV to compute emission for. Default: 64.0
n_kT (integer, optional) – The number of temperature bins to use when computing emission. Default: 10000
kT_scale (string, optional) – The scaling of the bins to use when computing emission, “linear” or “log”. Default: “linear”
max_density (float, (value, unit) tuple,
YTQuantity
, orQuantity
) – The maximum density of the cells or particles to use when generating photons. If a float, the units are assumed to be g/cm**3. Default: 5e25 g/cm**3.var_elem (dictionary, optional) – Elements that should be allowed to vary freely from the single abundance parameter. Each dictionary value, specified by the abundance symbol, corresponds to the abundance of that symbol. If a float, it is understood to be constant and in solar units. If a string or tuple of strings, it is assumed to be a spatially varying field. Default: None
method (string, optional) – The method used to generate the photon energies from the spectrum: “invert_cdf”: Invert the cumulative distribution function of the spectrum. “accept_reject”: Acceptancerejection method using the spectrum. The first method should be sufficient for most cases.
thermal_broad (boolean, optional) – Whether or not the spectral lines should be thermally broadened. Default: True
model_root (string, optional) – The directory root where the model files are stored. If not provided, a default location known to pyXSIM is used.
model_vers (string, optional) – The version identifier string for the model files, e.g. “2.0.2”. Default depends on the model used.
nei (boolean, optional) – If True, use the nonequilibrium ionization tables. These are not supplied with pyXSIM/SOXS but must be downloaded separately, in which case the apec_root parameter must also be set to their location. Default: False
nolines (boolean, optional) – Turn off lines entirely for generating emission. Default: False
abund_table (string or array_like, optional) – The abundance table to be used for solar abundances. Either a string corresponding to a builtin table or an array of 30 floats corresponding to the abundances of each element relative to the abundance of H. Default is “angr”. Builtin 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) “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)
prng (integer or
RandomState
object) – A pseudorandom number generator. Typically will only be specified if you have a reason to generate the same set of random numbers, such as for a test. Default is to use thenumpy.random
module.
Examples
>>> source_model = ThermalSourceModel("apec", 0.1, 10.0, 10000, ... ("gas", "metallicity"))