tardis.plasma.equilibrium.matrix_assembly module

Shared helpers for assembling rate matrices.

tardis.plasma.equilibrium.matrix_assembly.construct_rate_matrices(rates: DataFrame, shape: tuple[int, int], source_level: str, destination_level: str) ndarray[tuple[Any, ...], dtype[float64]][source]

Construct dense destination-row/source-column matrices.

Parameters:
ratespandas.DataFrame

Rates indexed by source and destination levels, with one column per shell.

shapetuple of int

Matrix row and column dimensions.

source_level, destination_levelstr

Index level names identifying matrix columns and rows.

Returns:
numpy.typing.NDArray

One dense matrix per rate-frame column.

tardis.plasma.equilibrium.matrix_assembly.normalize_rate_matrices(matrices: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]

Add balance diagonals and the population-normalization row.

tardis.plasma.equilibrium.matrix_assembly.sum_duplicate_rates(rates: DataFrame) DataFrame[source]

Sum duplicate ion transitions in a rate frame.

tardis.plasma.equilibrium.matrix_assembly.sum_rate_frames(rate_frames: Iterable[DataFrame], multipliers: Sequence[float] | None = None) DataFrame[source]

Align rate frames on their union of indexes and add them.

Parameters:
rate_framesiterable of pandas.DataFrame

Rate frames with matching columns.

multiplierssequence of float, optional

Factors applied to the corresponding rate frames before summation.

Returns:
pandas.DataFrame

The aligned sum of the rate frames.