tardis.io.model.parse_mass_fraction_configuration module

tardis.io.model.parse_mass_fraction_configuration.convert_to_nuclide_mass_fractions(isotopic_mass_fractions, mass_fractions)[source]

Convert the mass fraction and isotope mass fraction data to nuclide mass fraction.

Parameters:
isotope_mass_fractionpandas.DataFrame

The isotope mass fraction data.

mass_fractionspandas.DataFrame

The mass fraction data.

Returns:
nuclide_mass_fractionpandas.DataFrame

The converted nuclide mass fraction.

Raises:
None.

Notes

This function converts the mass fraction and isotope mass fraction data to nuclide mass fraction. If the mass fraction data is not None, it is converted to nuclide mass fraction by mapping the mass fraction index to nuclide indices using the ‘convert_element2nuclide_index’ function. The resulting mass fraction data is then concatenated with the isotope mass fraction data to obtain the final nuclide mass fraction.

tardis.io.model.parse_mass_fraction_configuration.parse_mass_fractions_from_config(config, geometry, time_explosion)[source]

Parse the mass fraction configuration data.

Parameters:
configobject

The configuration data.

geometryobject

The geometry of the model.

time_explosionfloat

The time of the explosion.

Returns:
nuclide_mass_fractionsobject

The parsed nuclide mass fraction.

raw_isotope_mass_fractionsobject

The parsed raw isotope mass fraction. This is the isotope mass fraction data before decay.

Raises:
None.

Notes

This function parses the abundance configuration data and returns the parsed nuclide mass fraction. The mass fraction configuration can be of type ‘uniform’ or ‘file’. If it is of type ‘uniform’, the mass fraction and isotope mass fraction are read using the ‘read_uniform_mass fractions’ function. If it is of type ‘file’, the mass fraction and isotope mass fraction are read from a file using the ‘read_abundances_file’ function. The parsed data is then processed to replace NaN values with 0.0, remove rows with zero sum, and normalize the data if necessary. The resulting nuclide mass fraction is returned.

tardis.io.model.parse_mass_fraction_configuration.parse_mass_fractions_from_csvy(csvy_model_config, csvy_model_data, geometry, time_explosion)[source]

Parse the mass fraction data from a CSVY model.

Parameters:
csvy_model_configobject

The configuration data of the CSVY model.

csvy_model_dataobject

The data of the CSVY model.

geometryobject

The geometry of the model.

Returns:
mass_fractionspd.DataFrame

The parsed mass fraction data.

isotope_mass_fractionspandas.DataFrame

The parsed isotope mass fraction data.

Raises:
None.

Notes

This function parses the mass fraction data from a CSVY model. If the CSVY model configuration contains an ‘abundance’ attribute, it uses the ‘read_uniform_mass_fractions’ function to parse the mass fraction and isotope mass fraction data. Otherwise, it uses the ‘parse_csv_mass_fractions’ function to parse the data. The parsed data is then processed to replace NaN values with 0.0, remove rows with zero sum, and normalize the data if necessary. The resulting mass fraction and isotope mass fraction arrays are returned.