tardis.io.model.readers.generic_readers module

exception tardis.io.model.readers.generic_readers.ConfigurationError[source]

Bases: Exception

tardis.io.model.readers.generic_readers.read_csv_composition(fname: str, delimiter='\\s+')[source]

Read composition from a simple CSV file

The CSV file can contain specific isotopes or elemental mass fractions in the different columns. The first row must contain the header in which the contents of each column is specified by the elemental symbol (for elemental mass fractions) or by the symbol plus mass number (for isotopic mass fractions).

Example: C O Fe Ni56 Co

The i-th row specifies the composition in the i-th shell

fname

filename of the csv file

tardis.io.model.readers.generic_readers.read_simple_ascii_density(fname: str) tuple[Quantity, Quantity, Quantity][source]

Reading a density file of the following structure (example; lines starting with a hash will be ignored): The first density describes the mean density in the center of the model and is not used. 5 s #index velocity [km/s] density [g/cm^3] 0 1.1e4 1.6e8 1 1.2e4 1.7e8

Parameters:
fname

Filename or path with filename.

Returns:
time_of_model

Time at which the model is valid.

velocity

Velocity.

mean_density

Mean density.

tardis.io.model.readers.generic_readers.read_simple_ascii_mass_fractions(fname: str) tuple[ndarray, DataFrame][source]

Reading a mass fraction file of the following structure (example; lines starting with hash will be ignored): The first line of mass fractions describe the mass fractions in the center of the model and are not used. #index element1, element2, …, element30 0 0.4 0.3, .. 0.2

Parameters:
fname

Filename or path with filename.

Returns:
index

Array containing the indices.

mass_fractions

Data frame containing index, element1 - element30 and columns according to the shells.

tardis.io.model.readers.generic_readers.read_uniform_mass_fractions(mass_fractions_section, no_of_shells)[source]

Read uniform mass fractions from configuration.

Parameters:
mass_fractions_section

Mass fractions section from config.model.abundances.

no_of_shells

Number of shells.

Returns:
mass_fractions

Elemental mass fractions DataFrame.

isotope_mass_fractions

Isotopic mass fractions DataFrame.