tardis.io.model.parse_density_configuration module¶
- tardis.io.model.parse_density_configuration.calculate_density_after_time(densities: Quantity, time_0: Quantity, time_explosion: Quantity) Quantity[source]¶
Scale the density from an initial time of the model to the time of the explosion by ^-3.
- Parameters:
- densities
Densities.
- time_0
Time of the model.
- time_explosion
Time to be scaled to.
- Returns:
- scaled_density
Scaled density in g / cm^3.
- tardis.io.model.parse_density_configuration.calculate_exponential_density(velocities: Quantity, velocity_0: Quantity, rho_0: Quantity) Quantity[source]¶
Compute the exponential density profile.
\(\rho = \rho_0 \times \exp \left( -\frac{v}{v_0} \right)\)
- Parameters:
- velocities
Array like velocity profile.
- velocity_0
Reference velocity.
- rho_0
Reference density.
- Returns:
- densities
Computed densities.
- tardis.io.model.parse_density_configuration.calculate_power_law_density(velocities: Quantity, velocity_0: Quantity, rho_0: Quantity, exponent: float) Quantity[source]¶
Compute a discrete exponential density profile.
\(\rho = \rho_0 \times \left( \frac{v}{v_0} \right)^n\)
- Parameters:
- velocities
Array like velocity profile.
- velocity_0
Reference velocity.
- rho_0
Reference density.
- exponent
Exponent used in the powerlaw.
- Returns:
- densities
Computed densities.
- tardis.io.model.parse_density_configuration.parse_density_from_csvy(csvy_model_config: Configuration, csvy_model_data: DataFrame | None, time_explosion: Quantity) Quantity[source]¶
Parse the density data from a CSVY model.
- Parameters:
- csvy_model_config
The configuration data of the CSVY model.
- csvy_model_data
The data of the CSVY model.
- time_explosion
The time of the explosion.
- Returns:
- density
The parsed density data.
Notes
This function parses the density data from a CSVY model. If the CSVY model configuration contains a ‘density’ attribute, it uses the ‘parse_density_section_csvy’ 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.io.model.parse_density_configuration.parse_density_section_config(density_configuration: ConfigurationNameSpace, v_middle: Quantity, time_explosion: Quantity) tuple[Quantity, Quantity][source]¶
Parse the density section of the configuration file and produce a density at time_explosion.
- Parameters:
- density_configuration
Density configuration namespace.
- v_middle
Middle of the velocity bins.
- time_explosion
Time of the explosion.
- Returns:
- density_0
Density at time_0.
- time_0
Time of the density profile.
- tardis.io.model.parse_density_configuration.parse_density_section_csvy(csvy_model_config: Configuration, time_explosion: Quantity) Quantity[source]¶
Parse the density section of the csvy file and produce a density at time_explosion.
- Parameters:
- csvy_model_config
CSVY model configuration.
- time_explosion
Time of the explosion.
- Returns:
- density
Density at time_explosion.