tardis.visualization.widgets.grotrian module

Grotrian Diagram Widget for TARDIS simulation models.

This widget displays a Grotrian Diagram of the last line interactions of the simulation packets

class tardis.visualization.widgets.grotrian.GrotrianPlot(atom_data, level_energy_data, level_population_data, line_interaction_analysis)[source]

Bases: object

Class for the Grotrian Diagram

Parameters:
atom_datapandas.DataFrame

Mapping from atomic number to symbol and name

level_energy_datapandas.Series

Level energies (in eV) indexed by (atomic_number, ion_number, level_number)

level_population_datapandas.DataFrame

Level populations indexed by (atomic_number, ion_number, level_number) and each column representing the supernova shell

line_interaction_analysistardis.analysis.LastLineInteraction

LastLineInteraction object with the appropriate filters

FILTER_MODES = ('packet_out_nu', 'packet_in_nu')
FILTER_MODES_DESC = ('Emitted Wavelength', 'Absorbed Wavelength')
Y_SCALE_OPTION = {'Linear': <function GrotrianPlot.<lambda>>, 'Log': <ufunc 'log'>}
property atomic_name
property atomic_number
property atomic_symbol
display()[source]

Function to draw the plot and the reference scales (calls other draw methods independently)

property filter_mode
classmethod from_simulation(sim, **kwargs)[source]

Creates a GrotrianPlot object from a Simulation object

Parameters:
simtardis.simulation.Simulation

TARDIS simulation object

Returns:
tardis.visualization.widgets.grotrian.GrotrianPlot

GrotrianPlot object

property ion_number
property level_diff_threshold
property max_levels
property max_wavelength
property min_wavelength
reset_selected_plot_wavelength_range()[source]

Resets the wavelength range of the selected plot

set_ion(atomic_number, ion_number)[source]

Sets the atomic number and ion number

property shell
property y_scale
class tardis.visualization.widgets.grotrian.GrotrianWidget(plot, num_shells, **kwargs)[source]

Bases: object

A wrapper class for the Grotrian Diagram, containing the Grotrian Plot and the IpyWidgets

Parameters:
plottardis.visualization.widgets.grotrian.GrotrianPlot

GrotrianPlot object

num_shellsint

Number of shells in the sim.simulation_state.v_inner

display()[source]

Function to render the Grotrian Widget containing the plot and IpyWidgets together

classmethod from_simulation(sim, **kwargs)[source]

Creates a GrotrianWidget object from a Simulation object

Parameters:
simtardis.simulation.Simulation

TARDIS simulation object

Returns:
tardis.visualization.widgets.grotrian.GrotrianWidget

GrotrianWidget object

tardis.visualization.widgets.grotrian.is_zero_defined(transform)[source]

Utility function to decide if a certain transform is defined at zero

Parameters:
transformfunction
Returns:
bool

True if transform is defined at 0 else False

tardis.visualization.widgets.grotrian.standardize(values, transform=<function <lambda>>, min_value=None, max_value=None, zero_undefined_offset=0)[source]

Utility function to standardize displayed values like wavelengths, num_packets, levels populations to the range [0, 1] This helps in computing visual elements like widths, colors, etc.

Parameters:
valuespandas.Series

The data to standardize

transformfunction, optional

Transformations like np.log, np.exp, etc. to apply on the data. Defaults to identity

min_valuefloat, optional

The lower bound of the range

max_valuefloat, optional

The upper bound of the range

zero_undefined_offsetint, optional

This is useful for log transformation because log(0) is -inf. Hence, value=0 gives y=0 while the output for other values start at zero_undefined_offset (y = log(value) + zero_undefined_offset) Default value is 0

Returns:
pandas.Series

Values after standardization