tardis.visualization.tools.liv_plot module

class tardis.visualization.tools.liv_plot.LIVPlotter(data, time_explosion, velocity)[source]

Bases: object

Plotting interface for the last interaction velocity plot.

Initialize the plotter with required data from the simulation.

Parameters:
datadict of SDECData

Dictionary to store data required for last interaction velocity plot, for both packet modes (real, virtual).

time_explosionastropy.units.Quantity

Time of the explosion.

velocityastropy.units.Quantity

Velocity array from the simulation.

classmethod from_hdf(hdf_fpath)[source]

Create an instance of the Plotter from a simulation HDF file.

Parameters:
hdf_fpathstr

Valid path to the HDF file where simulation is saved.

Returns:
LIVPlotter
classmethod from_simulation(sim)[source]

Create an instance of the plotter from a TARDIS simulation object.

Parameters:
simtardis.simulation.Simulation

TARDIS simulation object produced by running a simulation.

Returns:
LIVPlotter
generate_plot_mpl(species_list=None, nelements=None, packets_mode='virtual', ax=None, figsize=(11, 5), cmapname='jet', xlog_scale=False, ylog_scale=False, num_bins=None, velocity_range=None)[source]

Generate the last interaction velocity distribution plot using matplotlib.

Parameters:
species_listlist of str, optional

List of species to plot. Default is None which plots all species in the model.

nelementsint, optional

Number of elements to include in plot. The most interacting elements are included. If None, displays all elements.

packets_modestr, optional

Packet mode, either ‘virtual’ or ‘real’. Default is ‘virtual’.

axmatplotlib.axes.Axes, optional

Axes object to plot on. If None, creates a new figure.

figsizetuple, optional

Size of the figure. Default is (11, 5).

cmapnamestr, optional

Colormap name. Default is ‘jet’. A specific colormap can be chosen, such as “jet”, “viridis”, “plasma”, etc.

xlog_scalebool, optional

If True, x-axis is scaled logarithmically. Default is False.

ylog_scalebool, optional

If True, y-axis is scaled logarithmically. Default is False.

num_binsint, optional

Number of bins for regrouping within the same range. Default is None.

velocity_rangetuple, optional

Limits for the x-axis. If specified, overrides any automatically determined limits.

Returns:
matplotlib.axes.Axes

Axes object with the plot.

generate_plot_ply(species_list=None, nelements=None, packets_mode='virtual', fig=None, graph_height=600, cmapname='jet', xlog_scale=False, ylog_scale=False, num_bins=None, velocity_range=None)[source]

Generate the last interaction velocity distribution plot using plotly.

Parameters:
species_listlist of str, optional

List of species to plot. Default is None which plots all species in the model.

nelementsint, optional

Number of elements to include in plot. The most interacting elements are included. If None, displays all elements.

packets_modestr, optional

Packet mode, either ‘virtual’ or ‘real’. Default is ‘virtual’.

figplotly.graph_objects.Figure, optional

Plotly figure object to add the plot to. If None, creates a new figure.

graph_heightint, optional

Height (in px) of the plotly graph to display. Default value is 600.

cmapnamestr, optional

Colormap name. Default is ‘jet’. A specific colormap can be chosen, such as “jet”, “viridis”, “plasma”, etc.

xlog_scalebool, optional

If True, x-axis is scaled logarithmically. Default is False.

ylog_scalebool, optional

If True, y-axis is scaled logarithmically. Default is False.

num_binsint, optional

Number of bins for regrouping within the same range. Default is None.

velocity_rangetuple, optional

Limits for the x-axis. If specified, overrides any automatically determined limits.

Returns:
plotly.graph_objects.Figure

Plotly figure object with the plot.