tardis.model.parse_input module¶
- tardis.model.parse_input.calculate_t_radiative_from_t_inner(geometry, packet_source)[source]¶
Calculates the radiative temperature based on the inner temperature and the geometry of the system.
- Parameters
- geometryGeometry
The geometry object.
- packet_sourcePacketSource
The packet source object.
- Returns
- Quantity
The calculated radiative temperature.
- tardis.model.parse_input.convert_to_nuclide_mass_fraction(isotopic_mass_fraction, mass_fraction)[source]¶
Convert the abundance and isotope abundance data to nuclide mass fraction.
- Parameters
- isotope_abundancepandas.DataFrame
The isotope abundance data.
- abundancepandas.DataFrame
The abundance data.
- Returns
- nuclide_mass_fractionpandas.DataFrame
The converted nuclide mass fraction.
- Raises
- None.
Notes
This function converts the abundance and isotope abundance data to nuclide mass fraction. If the abundance data is not None, it is converted to nuclide mass fraction by mapping the abundance index to nuclide indices using the ‘convert_element2nuclide_index’ function. The resulting abundance data is then concatenated with the isotope abundance data to obtain the final nuclide mass fraction.
- tardis.model.parse_input.initialize_packet_source(config, geometry, packet_source)[source]¶
Initialize the packet source based on config and geometry
- Parameters
- configConfig
The configuration object containing the supernova and plasma settings.
- geometryGeometry
The geometry object containing the inner radius information.
- packet_sourceBasePacketSource
The packet source object based on the configuration and geometry.
- Returns
- packet_sourceBasePacketSource
The packet source object based on the configuration and geometry.
- Raises
- ValueError
If both t_inner and luminosity_requested are None.
- tardis.model.parse_input.parse_abundance_config(config, geometry, time_explosion)[source]¶
Parse the abundance configuration data.
- Parameters
- configobject
The configuration data.
- geometryobject
The geometry of the model.
- time_explosionfloat
The time of the explosion.
- Returns
- nuclide_mass_fractionobject
The parsed nuclide mass fraction.
- raw_isotope_abundanceobject
The parsed raw isotope abundance. This is the isotope abundance data before decay.
- Raises
- None.
Notes
This function parses the abundance configuration data and returns the parsed nuclide mass fraction. The abundance configuration can be of type ‘uniform’ or ‘file’. If it is of type ‘uniform’, the abundance and isotope abundance are read using the ‘read_uniform_abundances’ function. If it is of type ‘file’, the abundance and isotope abundance 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.model.parse_input.parse_abundance_csvy(csvy_model_config, csvy_model_data, geometry, time_explosion)[source]¶
Parse the abundance 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
- abundancepd.DataFrame
The parsed abundance data.
- isotope_abundancepandas.DataFrame
The parsed isotope abundance data.
- Raises
- None.
Notes
This function parses the abundance data from a CSVY model. If the CSVY model configuration contains an ‘abundance’ attribute, it uses the ‘read_uniform_abundances’ function to parse the abundance and isotope abundance data. Otherwise, it uses the ‘parse_csv_abundances’ 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 abundance and isotope abundance arrays are returned.
- tardis.model.parse_input.parse_csvy_composition(atom_data, csvy_model_config, csvy_model_data, time_explosion, geometry)[source]¶
Parse the composition data from a CSVY model.
- Parameters
- atom_dataobject
The atom data used for parsing.
- csvy_model_configobject
The configuration data of the CSVY model.
- csvy_model_dataobject
The data of the CSVY model.
- time_explosionfloat
The time of the explosion.
- geometryobject
The geometry of the model.
- Returns
- densityobject
The parsed density data.
- abundanceobject
The parsed abundance data.
- isotope_abundanceobject
The parsed isotope abundance data.
- elemental_massobject
The elemental mass data.
- Raises
- None.
Notes
This function parses the composition data from a CSVY model. It calls the ‘parse_density_csvy’ function to parse the density data, and the ‘parse_abundance_csvy’ function to parse the abundance and isotope abundance data. The parsed data is returned as density, abundance, isotope_abundance, and elemental_mass.
- tardis.model.parse_input.parse_csvy_geometry(config, csvy_model_config, csvy_model_data, time_explosion)[source]¶
Parse the geometry data from a CSVY model.
- Parameters
- configobject
The configuration data.
- csvy_model_configobject
The configuration data of the CSVY model.
- csvy_model_dataobject
The data of the CSVY model.
- time_explosionfloat
The time of the explosion.
- Returns
- geometryobject
The parsed geometry.
- Raises
- None.
Notes
This function parses the geometry data from a CSVY model. It extracts the velocity information from the CSVY model configuration or data. The parsed velocity data is used to create a homologous radial 1D geometry object, which is returned.
- tardis.model.parse_input.parse_csvy_radiation_field_state(config, csvy_model_config, csvy_model_data, geometry, packet_source)[source]¶
- tardis.model.parse_input.parse_density_csvy(csvy_model_config, csvy_model_data, time_explosion)[source]¶
Parse the density 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.
- time_explosionfloat
The time of the explosion.
- Returns
- densityobject
The parsed density data.
- Raises
- None.
Notes
This function parses the density data from a CSVY model. If the CSVY model configuration contains a ‘density’ attribute, it uses the ‘parse_csvy_density’ function to parse the density data. Otherwise, it calculates the density data using the ‘calculate_density_after_time’ function. The parsed density data is returned.
- tardis.model.parse_input.parse_packet_source(config, geometry)[source]¶
Parse the packet source based on the given configuration and geometry.
- Parameters
- configConfig
The configuration object containing the supernova and plasma settings.
- geometryGeometry
The geometry object containing the inner radius information.
- Returns
- packet_sourceBlackBodySimpleSource
The packet source object based on the configuration and geometry.
- tardis.model.parse_input.parse_radiation_field_state(config, t_radiative, geometry, dilution_factor=None, packet_source=None)[source]¶
Parses the radiation field state based on the provided configuration, radiative temperature, geometry, dilution factor, and packet source.
- Parameters
- configConfig
The configuration object.
- t_radiative{None, Quantity}, optional
The radiative temperature. If None, it is calculated based on the initial_t_rad value in the plasma configuration.
- geometryGeometry
The geometry object.
- dilution_factor{None, ndarray}, optional
The dilution factor. If None, it is calculated based on the geometry.
- packet_source{None, PacketSource}, optional
The packet source object.
- Returns
- DiluteThermalRadiationFieldState
The parsed radiation field state.
- Raises
- AssertionError
If the length of t_radiative or dilution_factor is not compatible with the geometry.
- tardis.model.parse_input.parse_structure_config(config, time_explosion, enable_homology=True)[source]¶
Parse the structure configuration data.
- Parameters
- configobject
The configuration data.
- time_explosionfloat
The time of the explosion.
- enable_homologybool, optional
Whether to enable homology (default is True).
- Returns
- electron_densitiesobject
The parsed electron densities.
- temperatureobject
The parsed temperature.
- geometryobject
The parsed geometry.
- densityobject
The parsed density.
- Raises
- NotImplementedError
If the structure configuration type is not supported.
Notes
This function parses the structure configuration data and returns the parsed electron densities, temperature, geometry, and density. The structure configuration can be of type ‘specific’ or ‘file’. If it is of type ‘specific’, the velocity and density are parsed from the configuration. If it is of type ‘file’, the velocity and density are read from a file. The parsed data is used to create a homologous radial 1D geometry object.