tardis.opacities.macro_atom.macroatom_state module¶
- class tardis.opacities.macro_atom.macroatom_state.LegacyMacroAtomState(*args: Any, **kwargs: Any)[source]¶
Bases:
HDFWriterMixin
Initialize a LegacyMacroAtomState object.
- Parameters:
- transition_probabilitiespd.DataFrame
Macro Atom transition probabilities between levels.
- transition_typepd.Series
Macro Atom transition types.
- destination_level_idpd.Series
ID of destination levels of the Macro Atom.
- transition_line_idpd.Series
ID of lines corresponding to Macro Atom transitions.
- macro_block_referencespd.DataFrame | pd.Series
Index references to the Macro Atom blocks.
- line2macro_level_upper
Mapping from lines to Macro Atom upper levels.
- classmethod from_legacy_plasma(plasma) Self [source]¶
Generate a LegacyMacroAtomState object from a tardis BasePlasma.
- Parameters:
- plasmatardis.plasma.BasePlasma
Legacy base plasma object.
- Returns:
- LegacyMacroAtomState
A LegacyMacroAtomState object created from the plasma data.
- hdf_name = 'macro_atom_state'¶
- hdf_properties = ['transition_probabilities', 'transition_type', 'destination_level_id', 'transition_line_id', 'macro_block_references', 'line2macro_level_upper']¶
- class tardis.opacities.macro_atom.macroatom_state.MacroAtomState(transition_probabilities: DataFrame, transition_metadata: DataFrame, line2macro_level_upper: Series, macro_block_references: Series | None = None, references_index: Series | None = None)[source]¶
Bases:
object
Initialize a MacroAtomState object.
- Parameters:
- transition_probabilitiespd.DataFrame
Transition probabilities for the macro atom, indexed by source and destination levels.
- transition_metadatapd.DataFrame
Metadata for the macro atom, including atomic number, ion number, level numbers for the transition, destination, and source.
- line2macro_level_upperpd.Series
Mapping from lines to the upper levels of the macro atom transitions.
- macro_block_referencespd.Series, optional
Index references to the Macro Atom blocks. Default is None.
- hdf_name = 'macro_atom_state'¶
- hdf_properties = ['transition_probabilities', 'transition_metadata', 'line2macro_level_upper']¶
- recreate_legacy_macro_atom_state(legacy_state: LegacyMacroAtomState, lines: DataFrame) LegacyMacroAtomState [source]¶
Recreate the legacy MacroAtomState with new transition probabilities and unique transition IDs.
- Parameters:
- legacy_stateLegacyMacroAtomState
The original legacy state to recreate from.
- linespd.DataFrame
DataFrame containing line information.
- Returns:
- LegacyMacroAtomState
The recreated legacy MacroAtomState with updated transition data.
- sort_to_legacy(legacy_state: LegacyMacroAtomState, lines: DataFrame)[source]¶
Sort the current MacroAtomState to match the legacy MacroAtomState order.
- Parameters:
- legacy_stateLegacyMacroAtomState
The legacy state to match the ordering of.
- linespd.DataFrame
DataFrame containing line information.
- Returns:
- MacroAtomState
A new MacroAtomState with transitions sorted to match the legacy state order.
- to_legacy_format() LegacyMacroAtomState [source]¶
Convert the current state of the MacroAtom to legacy format.
This method transforms the modern MacroAtomState structure into the legacy LegacyMacroAtomState format for backward compatibility. It extracts individual components from the consolidated transition_metadata DataFrame and converts them to the separate arrays/DataFrames expected by the legacy format.
- Returns:
- LegacyMacroAtomState
The MacroAtomState converted to legacy format.