yt.fields.xray_emission_fields module

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

Bases: YTException

add_note()

Exception.add_note(note) – add a note to the exception

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: YTException

add_note()

Exception.add_note(note) – add a note to the exception

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, dist=None, ftype='gas')[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.

  • dist ((value, unit) tuple or YTQuantity, optional) – The distance to the source, used for making intensity fields. You should only use this if your source is nearby (not cosmological). Default: None

  • ftype (string, optional) – The field type to use when creating the fields, default “gas”

  • fields (This will create at least three)

  • cm^-3) ("xray_photon_emissivity_{e_min}_{e_max}_keV" (photons s^-1)

  • s^-1) ("xray_luminosity_{e_min}_{e_max}_keV" (erg)

  • cm^-3)

  • others (and if a redshift or distance is specified it will create two)

  • arcsec^-2) ("xray_photon_intensity_{e_min}_{e_max}_keV" (photons s^-1 cm^-3)

  • arcsec^-2)

  • projections. (These latter two are really only useful when making)

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", ("gas", "xray_emissivity_0.5_2_keV"), table_type="apec"
... )
>>> p.save()