tardis.spectrum.formal_integral.formal_integral_solver module

class tardis.spectrum.formal_integral.formal_integral_solver.FormalIntegralSolver(integrator_settings)[source]

Bases: object

Initialize the formal integral solver.

Parameters:
integrator_settingsIntegratorSettings
The settings to use for the integrator, such as:

points (int): Number of points interpolate_shells (int): Number of shells to interpolate to method (str): Method to use for the formal integral solver (‘numba’ or ‘cuda’)

get_interpolated_quantities(source_function_state, interpolate_shells, simulation_state, transport, opacity_state, plasma)[source]

If needed, interpolate the quantities from the source function state, and prepare the results for use in the formal integral.

Parameters:
source_function_statetardis.spectrum.formal_integral.source_function.SourceFunctionState

Data class that hold the computed source function values which will be interpolated, if needed

interpolate_shellsint

The number of shells to interpolate to.

simulation_statetardis.model.SimulationState
transporttardis.transport.montecarlo.MonteCarloTransportSolver
opacity_statetardis.opacities.opacity_state.OpacityStateNumba
plasmatardis.plasma.Plasma
Returns:
tuple

(possibly interpolated) att_S_ul, Jred_lu, Jblue_lu, e_dot_u, r_inner, r_outer, tau_sobolevs, electron_densities

interpolate_integrator_quantities(att_S_ul, Jredlu, Jbluelu, e_dot_u, interpolate_shells, simulation_state, transport, opacity_state, electron_densities)[source]

Interpolate the integrator quantities to interpolate_shells.

Parameters:
source_function_statetardis.spectrum.formal_integral.source_function.SourceFunctionState

Data class that hold the computed source function values

interpolate_shellsint

number of shells to interpolate to

simulation_statetardis.model.SimulationState
transporttardis.transport.montecarlo.MonteCarloTransportSolver
opacity_statetardis.opacities.opacity_state.OpacityStateNumba
electron_densitiesnp.ndarray
Returns:
tuple

Interpolated values of att_S_ul, Jredlu, Jbluelu, e_dot_u, r_inner_i, r_outer_i, tau_sobolevs_integ, and electron_densities_integ

setup(transport, plasma, opacity_state=None, macro_atom_state=None)[source]

Prepares the necessary data for the formal integral solver.

Parameters:
plasmatardis.plasma.BasePlasma
transporttardis.transport.montecarlo.MontecarloTransport
Returns:
atomic_dataAtomicData
levels_indexnp.ndarray
opacity_stateOpacityStateNumba
setup_integrator(opacity_state, time_explosion, r_inner, r_outer)[source]

Setup the integrator depending on the choice of method

Parameters:
opacity_statetardis.opacities.opacity_state.OpacityStateNumba

The opacity state to use for the formal integral

time_explosionu.Quantity

The time of the explosion

r_innernp.ndarray

The inner radii of the shells

r_outernp.ndarray

The outer radii of the shells

solve(nu, simulation_state, transport, plasma, opacity_state=None, macro_atom_state=None)[source]

Solve the formal integral

Parameters:
nuu.Quantity

The frequency grid for the formal integral.

simulation_statetardis.model.SimulationState

State which hold information about each shell

transporttardis.transport.montecarlo.MonteCarloTransportSolver
plasmatardis.plasma.BasePlasma
opacity_statetardis.opacities.opacity_state.OpacityState or None

State of the line opacities

macro_atom_statetardis.opacities.macro_atom.macroatom_state.MacroAtomState or None

State of the macro atom

Returns:
TARDISSpectrum

the formal integral spectrum