tardis.energy_input.samplers module

tardis.energy_input.samplers.create_energy_cdf(energy, intensity)[source]

Creates a CDF of given intensities

Parameters:
energyOne-dimensional Numpy Array, dtype float

Array of energies

intensityOne-dimensional Numpy Array, dtype float

Array of intensities

Returns:
One-dimensional Numpy Array, dtype float

Sorted energy array

One-dimensional Numpy Array, dtype float

CDF where each index corresponds to the energy in the sorted array

tardis.energy_input.samplers.sample_decay_time(start_tau, end_tau=0.0, decay_time_min=0.0, decay_time_max=0.0)[source]

Samples the decay time from the mean lifetime of the isotopes (needs restructuring for more isotopes)

Parameters:
start_taufloat64

Initial isotope mean lifetime

end_taufloat64, optional

Ending mean lifetime, by default 0 for single decays

Returns:
float64

Sampled decay time

tardis.energy_input.samplers.sample_energy(energy, intensity)[source]

Samples energy from energy and intensity

Parameters:
energyOne-dimensional Numpy Array, dtype float

Array of energies

intensityOne-dimensional Numpy Array, dtype float

Array of intensities

Returns:
float

Energy

tardis.energy_input.samplers.sample_energy_distribution(energy_sorted, cdf)[source]

Randomly samples a CDF of energies

Parameters:
energy_sortedOne-dimensional Numpy Array, dtype float

Sorted energy array

cdfOne-dimensional Numpy Array, dtype float

CDF

Returns:
float

Sampled energy

tardis.energy_input.samplers.sample_mass(masses, inner_radius, outer_radius)[source]

Samples location weighted by mass

Parameters:
massesarray

Shell masses

inner_radiusarray

Inner radii

outer_radiusarray

Outer radii

Returns:
float

Sampled radius

int

Sampled shell index