pynbody.analysis.ionfrac.calculate

Contents

pynbody.analysis.ionfrac.calculate#

pynbody.analysis.ionfrac.calculate(sim, ion='OVI')[source]#

Calculate the fractions for the specified ion in the given simulation.

Uses the currently loaded ion fraction table. If no table is loaded, the default is used. See use_custom_ion_table() for how to load a custom table.

For important notes on the way that ion fractions are estimated, see the module documentation (pynbody.analysis.ionfrac).

Parameters:
  • sim (pynbody.snapshot.SimSnap) – The simulation snapshot to calculate the ion fractions for. The gas particles must have ‘rho’ and ‘temp’ fields.

  • ion (str) – The name of the ion to calculate the fraction for, e.g. “HI”, “CIV”, “MgII” etc. Molecular hydrogen is “H2”. The default is ‘OVI’. Case insensitive.

Returns:

The ion fraction for each gas particle in the simulation, according to the table. This is defined as the number density of the specified ion divided by the number density of the element it is derived from. As such, the ion fractions for a particular element sum to 1.

Return type:

array-like