tardis.io.model.readers.util module

tardis.io.model.readers.util.read_csv_isotope_mass_fractions(fname, delimiter='\\s+', skip_columns=0, skip_rows=[1])[source]

A generic parser for a TARDIS composition stored as a CSV file

The parser can read in both elemental and isotopic mass fractions. The first column is always expected to contain a running index, labelling the grid cells. The parser also allows for additional information to be stored in the first skip_columns columns. These will be ignored if skip_columns > 0. Note that the first column, containing the cell index is not taken into account here.

Specific header lines can be skipped by the skip_rows keyword argument

It is expected that the first row of the date block (after skipping the rows specified in skip_rows) specifies the different elements and isotopes. Each row after contains the composition in the corresponding grid shell. The first composition row describes the composition of the photosphere and is essentially ignored (for the default value of skip_rows).

Example:

Index C O Ni56 0 1 1 1 1 0.4 0.3 0.2

Parameters:
fnamestr

filename or path with filename

Returns:
indexnp.ndarray
mass_fractionspandas.DataFrame
isotope_mass_fractionpandas.MultiIndex