trident.ion_balance.add_ion_density_field

trident.ion_balance.add_ion_density_field(atom, ion, ds, ftype='gas', ionization_table=None, field_suffix=False, sampling_type='local', particle_type=None)[source]

Add ion mass density field to a yt dataset for the desired ion.

Note

The preferred method for adding ion fields to a dataset is using add_ion_fields,

For example, add_ion_density_field(‘O’, 6, ds) creates a field called O_p5_density for dataset ds, which represents 5-ionized oxygen (O plus 5 = O VI).

Fields are added assuming collisional ionization equilibrium and photoionization in the optically thin limit from a redshift-dependent metagalactic ionizing background using the ionization_table specified.

Parameters

Atom:

string

Atomic species for desired ion fraction (e.g. ‘H’, ‘C’, ‘Mg’)

Ion:

integer

Ion number for desired species (e.g. 1 = neutral, 2 = singly ionized, 3 = doubly ionized, etc.)

Ds:

yt dataset object

This is the dataset to which the ion fraction field will be added.

Ftype:

string, optional

This is deprecated and no longer necessary since all relevant fields are aliased to the ‘gas’ ftype. Default: ‘gas’

Ionization_table:

string, optional

Path to an appropriately formatted HDF5 table that can be used to compute the ion fraction as a function of density, temperature, metallicity, and redshift. By default, it uses the table specified in ~/.trident/config

Field_suffix:

boolean, optional

Determines whether or not to append a suffix to the field name that indicates what ionization table was used

Sampling_type:

string, optional

This is deprecated and no longer necessary. Default: ‘local’

Particle_type:

boolean, optional

This is deprecated and no longer necessary. Default: ‘auto’

Example

Add C IV (triply-ionized carbon) mass density field to dataset

>>> import yt
>>> import trident
>>> ds = yt.load('path/to/file')
>>> trident.add_ion_density_field('C', 4, ds)
>>> yt.ProjectionPlot(ds, 'x', 'C_p3_density').save()