tardis.opacities.macro_atom.absorbing_markov_chain module

Calculate absorption probabilities using absorbing Markov chain theory.

This module implements the mathematical framework of absorbing Markov chains to compute probabilities of photon absorption in each cell and the expected number of steps before absorption from each source state.

References:

Absorbing Markov chain theory: https://en.wikipedia.org/wiki/Absorbing_Markov_chain

tardis.opacities.macro_atom.absorbing_markov_chain.create_absorbing_probs(transition_probabilities: DataFrame, metadata: DataFrame) tuple[ndarray, DataFrame][source]

Calculate absorbing Markov chain probabilities and deactivation data.

Computes the absorption probability matrices for each cell and extracts deactivation probabilities by solving the absorbing Markov chain system. The fundamental matrix is computed to determine absorption probabilities and expected number of steps to absorption from each state.

WARNING: This is currently slower than it needs to be for many element sims. You should be able to slice out and process a subset of the probabilities based on some source state filtering. We have a draft PR open for this but it has not been finished.

Parameters:
transition_probabilitiespd.DataFrame

DataFrame with transition probabilities between states for each cell. Rows represent transitions, columns represent cells.

metadatapd.DataFrame

Metadata about transitions including source_level_idx, destination_level_idx, and transition_type. Values >= 0 for transition_type indicate internal transitions transitions that are not accompanied by reemission of the r-packet, and an end to the interaction handler chain. Negative values indicate deactivation, or reemitting from an absorbing state.

Returns:
tuple[np.ndarray, pd.DataFrame]
  • absorbing_probability_matrixnp.ndarray

    Array of shape (num_cells, num_states, num_states) containing absorption probabilities from each state for each cell.

  • deactivating_probspd.DataFrame

    DataFrame of deactivation transition probabilities from absorption states.