yt.fields.xray_emission_fields module

Integrator classes to deal with interpolation and integration of input spectral bins. Currently only supports Cloudy and APEC-style data.

exception yt.fields.xray_emission_fields.EnergyBoundsException(lower, upper)[source]

Bases: yt.utilities.exceptions.YTException

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception yt.fields.xray_emission_fields.ObsoleteDataException(table_type)[source]

Bases: yt.utilities.exceptions.YTException

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class yt.fields.xray_emission_fields.XrayEmissivityIntegrator(table_type, redshift=0.0, data_dir=None, use_metals=True)[source]

Bases: object

Class for making X-ray emissivity fields. Uses hdf5 data tables generated from Cloudy and AtomDB/APEC.

Initialize an XrayEmissivityIntegrator object.

Parameters:
  • table_type (string) – The type of data to use when computing the emissivity values. If “cloudy”, a file called “cloudy_emissivity.h5” is used, for photoionized plasmas. If, “apec”, a file called “apec_emissivity.h5” is used for collisionally ionized plasmas. These files contain emissivity tables for primordial elements and for metals at solar metallicity for the energy range 0.1 to 100 keV.
  • redshift (float, optional) – The cosmological redshift of the source of the field. Default: 0.0.
  • data_dir (string, optional) – The location to look for the data table in. If not supplied, the file will be looked for in the location of the YT_DEST environment variable or in the current working directory.
  • use_metals (boolean, optional) – If set to True, the emissivity will include contributions from metals. Default: True
get_interpolator(data_type, e_min, e_max, energy=True)[source]
yt.fields.xray_emission_fields.add_xray_emissivity_field(ds, e_min, e_max, redshift=0.0, metallicity=('gas', 'metallicity'), table_type='cloudy', data_dir=None, cosmology=None, **kwargs)[source]

Create X-ray emissivity fields for a given energy range.

Parameters:
  • e_min (float) – The minimum energy in keV for the energy band.
  • e_min – The maximum energy in keV for the energy band.
  • redshift (float, optional) – The cosmological redshift of the source of the field. Default: 0.0.
  • metallicity (str or tuple of str or float, optional) – Either the name of a metallicity field or a single floating-point number specifying a spatially constant metallicity. Must be in solar units. If set to None, no metals will be assumed. Default: (“gas”, “metallicity”)
  • table_type (string, optional) – The type of emissivity table to be used when creating the fields. Options are “cloudy” or “apec”. Default: “cloudy”
  • data_dir (string, optional) – The location to look for the data table in. If not supplied, the file will be looked for in the location of the YT_DEST environment variable or in the current working directory.
  • cosmology (Cosmology, optional) – If set and redshift > 0.0, this cosmology will be used when computing the cosmological dependence of the emission fields. If not set, yt’s default LCDM cosmology will be used.
  • will create three fields (This) –
  • (erg s^-1 cm^-3) ("xray_emissivity_{e_min}_{e_max}_keV") –
  • (erg s^-1) ("xray_luminosity_{e_min}_{e_max}_keV") –
  • (photons s^-1 cm^-3) ("xray_photon_emissivity_{e_min}_{e_max}_keV") –

Examples

>>> import yt
>>> ds = yt.load("sloshing_nomag2_hdf5_plt_cnt_0100")
>>> yt.add_xray_emissivity_field(ds, 0.5, 2)
>>> p = yt.ProjectionPlot(ds, 'x', "xray_emissivity_0.5_2_keV")
>>> p.save()