tardis.opacities.opacity_state module

class tardis.opacities.opacity_state.OpacityState(electron_density: DataFrame, t_electrons: ndarray[tuple[Any, ...], dtype[float64]], line_list_nu: Series, tau_sobolev: DataFrame, beta_sobolev: DataFrame | None, sobolev_optical_depth_coefficient: DataFrame | None = None)[source]

Bases: object

Store Python-native line opacity data for one iteration.

The state preserves labelled plasma data for the MC solver and formal-integral. Use to_numba() to produce the Numba-compatible transport representation.

Attributes:
sobolev_optical_depth_coefficientpandas.DataFrame or None

Velocity-gradient-independent coefficient for each line and shell [s^-1]. Dividing by the absolute projected velocity gradient gives the directional Sobolev optical depth.

Initialize the Python-native opacity state.

Parameters:
electron_densitypd.DataFrame

Electron number densities by shell.

t_electronsnumpy.ndarray

Electron temperatures in each shell [K].

line_list_nupd.Series

Rest-frame line frequencies.

tau_sobolevpd.DataFrame

Sobolev optical depths for each line and shell.

beta_sobolevpd.DataFrame or None

Sobolev escape probabilities for each line and shell.

sobolev_optical_depth_coefficientpd.DataFrame or None, optional

Velocity-gradient-independent coefficient for each line and shell [s^-1].

classmethod from_legacy_plasma(plasma: BasePlasma, tau_sobolev: DataFrame, sobolev_optical_depth_coefficient: DataFrame | None = None) → Self[source]

Construct an opacity state from a legacy plasma object.

Parameters:
plasmatardis.plasma.BasePlasma

Plasma object containing the line and continuum quantities.

tau_sobolevpd.DataFrame

Sobolev optical depths for each line and shell.

sobolev_optical_depth_coefficientpd.DataFrame or None, optional

Velocity-gradient-independent coefficient for each line and shell [s^-1].

Returns:
OpacityState

Python-native opacity state.

classmethod from_plasma(plasma: BasePlasma, tau_sobolev: DataFrame, beta_sobolev: DataFrame | None, sobolev_optical_depth_coefficient: DataFrame | None = None) → Self[source]

Construct an opacity state from a plasma object.

Parameters:
plasmatardis.plasma.base.BasePlasma

Plasma object containing the line and continuum quantities.

tau_sobolevpd.DataFrame

Sobolev optical depths for each line and shell.

beta_sobolevpd.DataFrame or None

Sobolev escape probabilities for each line and shell.

sobolev_optical_depth_coefficientpd.DataFrame or None, optional

Velocity-gradient-independent coefficient for each line and shell [s^-1].

Returns:
OpacityState

Python-native opacity state.

to_numba(macro_atom_state: MacroAtomState | None, line_interaction_type: str, continuum_processes_enabled: bool = False) → OpacityStateNumba[source]

Convert this state to the Numba-compatible transport representation.

Parameters:
macro_atom_statetardis.opacities.macro_atom.macroatom_state.MacroAtomState or None

Macro-atom transition data. It is required unless line_interaction_type is "scatter".

line_interaction_typestr

Configured line-interaction mode.

continuum_processes_enabledbool, optional

Use continuum-aware macro-atom deactivation probabilities.

Returns:
tardis.opacities.opacity_state_numba.OpacityStateNumba

Array-backed opacity and interaction data used by transport.