tardis.energy_input.main_gamma_ray_loop module
- tardis.energy_input.main_gamma_ray_loop.calculate_electron_number_density(simulation_state: SimulationState, ejecta_volume: ndarray[tuple[Any, ...], dtype[float64]], effective_time_array: ndarray[tuple[Any, ...], dtype[float64]], legacy: bool = False, legacy_atom_data: AtomData | None = None) ndarray[tuple[Any, ...], dtype[float64]][source]
Calculate the time-dependent electron number density.
- Parameters:
- simulation_stateSimulationState
State containing the ejecta geometry and composition.
- ejecta_volumenumpy.ndarray
Shell volumes in cubic centimeters at the simulation-state time.
- effective_time_arraynumpy.ndarray
Effective times in seconds at which to evaluate the density.
- legacybool, optional
If
True, calculate the elemental number density through the legacy simulation-state interface.- legacy_atom_dataAtomData or None, optional
Atomic data supplying elemental masses for the legacy calculation. Required when
legacyisTrue.
- Returns:
- numpy.ndarray
Electron number density in inverse cubic centimeters, indexed by shell and effective time.
- Raises:
- ValueError
If legacy mode is requested without
legacy_atom_data.
- tardis.energy_input.main_gamma_ray_loop.get_effective_time_array(time_start: float, time_end: float, time_space: str, time_steps: int) tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]][source]
Create time-bin boundaries and representative effective times.
- Parameters:
- time_startfloat
Start time in days.
- time_endfloat
End time in days.
- time_spacestr
Time-bin spacing, either
"linear"or"log".- time_stepsint
Number of time bins.
- Returns:
- timesnumpy.ndarray
Time-bin boundaries in days. The array has
time_steps + 1entries.- effective_time_arraynumpy.ndarray
Representative time of each bin in days. Logarithmic bins use the geometric mean and linear bins use the arithmetic mean.
- Raises:
- AssertionError
If
time_startis not smaller thantime_end.
- tardis.energy_input.main_gamma_ray_loop.get_packet_properties(number_of_shells: int, times: ndarray[tuple[Any, ...], dtype[float64]], time_steps: int, packets: list[GXPacket]) tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]][source]
Bin packet frequencies and energies by shell and time.
- Parameters:
- number_of_shellsint
Number of ejecta shells.
- timesnumpy.ndarray
Time-bin boundaries in the same units as each packet’s current time.
- time_stepsint
Number of time bins.
- packetslist of GXPacket
Gamma-ray packets to bin by shell and time.
- Returns:
- packets_nu_cmf_arraynumpy.ndarray
Sum of comoving-frame frequencies in each shell and time bin.
- packets_nu_rf_arraynumpy.ndarray
Sum of rest-frame frequencies in each shell and time bin.
- packets_energy_cmf_arraynumpy.ndarray
Sum of comoving-frame energies in each shell and time bin.
- packets_energy_rf_arraynumpy.ndarray
Sum of rest-frame energies in each shell and time bin.
- packets_positron_energy_arraynumpy.ndarray
Sum of positron energies in each shell and time bin.
- tardis.energy_input.main_gamma_ray_loop.run_gamma_ray_loop(simulation_state: SimulationState, legacy_isotope_decacy_df: DataFrame, cumulative_decays_df: DataFrame, number_of_packets: int, times: ndarray[tuple[Any, ...], dtype[float64]], effective_time_array: ndarray[tuple[Any, ...], dtype[float64]], seed: int, positronium_fraction: float, spectrum_bins: int, grey_opacity: float, photoabsorption_opacity: str = 'tardis', pair_creation_opacity: str = 'tardis', legacy: bool = False, legacy_atom_data: AtomData | None = None) tuple[DataFrame, DataFrame, DataFrame, DataFrame, DataFrame, DataFrame][source]
Propagate gamma-ray packets through homologously expanding ejecta.
- Parameters:
- simulation_stateSimulationState
State containing the ejecta geometry, density, and composition.
- legacy_isotope_decacy_dfpandas.DataFrame
Radioactive-decay transition data used to compute packet energies and isotope-specific positron fractions.
- cumulative_decays_dfpd.DataFrame
Time-dependent radioactive-decay data from which packets are sampled.
- number_of_packetsint
Number of Monte Carlo packets to propagate.
- timesnumpy.ndarray
Time-bin boundaries in days.
- effective_time_arraynumpy.ndarray
Representative time of each time bin in days.
- seedint
Seed for the random number generator.
- positronium_fractionfloat
Fraction of positrons that form positronium.
- spectrum_binsint
Number of logarithmically spaced escaping-spectrum energy bins.
- grey_opacityfloat
Grey opacity in square centimeters per gram. A negative value enables the detailed interaction opacities.
- photoabsorption_opacity{“kasen”, “tardis”}, optional
Photoabsorption opacity prescription used when
grey_opacityis negative.- pair_creation_opacity{“artis”, “tardis”}, optional
Pair-creation opacity prescription used when
grey_opacityis negative.- legacybool, optional
Whether to use the legacy elemental-density and packet-energy calculations.
- legacy_atom_dataAtomData or None, optional
Atomic data used by the legacy elemental-density calculation. Required when
legacyisTrue.
- Returns:
- escape_energypandas.DataFrame
Escaping spectral luminosity, indexed by energy in keV with time-bin columns in seconds.
- escape_energy_cosipandas.DataFrame
Escaping photon rate per energy bin, indexed by energy in keV with time-bin columns in seconds.
- packets_df_escapedpandas.DataFrame
Final packet diagnostics, including status, frequencies, energies, and shell number.
- gamma_ray_deposited_energypandas.DataFrame
Gamma-ray energy deposited in each shell and time bin, in ergs.
- total_deposited_energypandas.DataFrame
Gamma-ray plus positron energy deposition rate in each shell and time bin, in ergs per second.
- positron_energy_dfpandas.DataFrame
Positron energy deposited in each shell and time bin, in ergs.