tardis.visualization.tools.sdec_plot module¶
Spectral element DEComposition (SDEC) Plot for TARDIS simulation models.
This plot is a spectral diagnostics plot similar to those originally proposed by M. Kromer (see, for example, Kromer et al. 2013, figure 4).
- class tardis.visualization.tools.sdec_plot.SDECPlotter[source]¶
Bases:
object
Plotting interface for Spectral element DEComposition (SDEC) Plot.
It performs necessary calculations to generate SDEC Plot for a simulation model, and allows to plot it in matplotlib and plotly.
Initialize the SDECPlotter with required data of simulation model.
- classmethod from_hdf(hdf_fpath)[source]¶
Create an instance of SDECPlotter from a simulation HDF file.
- Parameters:
- hdf_fpathstr
Valid path to the HDF file where simulation is saved
- packets_mode{‘virtual’, ‘real’}, optional
Mode of packets to be considered, either real or virtual. If not specified, both modes are returned
- Returns:
- SDECPlotter
- classmethod from_simulation(sim)[source]¶
Create an instance of SDECPlotter from a TARDIS simulation object.
- Parameters:
- simtardis.simulation.Simulation
TARDIS Simulation object produced by running a simulation
- Returns:
- SDECPlotter
- generate_plot_mpl(packets_mode='virtual', packet_wvl_range=None, distance=None, observed_spectrum=None, show_modeled_spectrum=True, ax=None, figsize=(12, 7), cmapname='jet', nelements=None, species_list=None, blackbody_photosphere=True)[source]¶
Generate Spectral element DEComposition (SDEC) Plot using matplotlib.
- Parameters:
- packets_mode{‘virtual’, ‘real’}, optional
Mode of packets to be considered, either real or virtual. Default value is ‘virtual’
- packet_wvl_rangeastropy.Quantity or None, optional
Wavelength range to restrict the analysis of escaped packets. It should be a quantity having units of Angstrom, containing two values - lower lambda and upper lambda i.e. [lower_lambda, upper_lambda] * u.AA. Default value is None
- distanceastropy.Quantity or None, optional
Distance used to calculate flux instead of luminosity in the plot. It should have a length unit like m, Mpc, etc. Default value is None
- observed_spectrumtuple or list of astropy.Quantity, optional
Option to plot an observed spectrum in the SDEC plot. If given, the first element should be the wavelength and the second element should be flux, i.e. (wavelength, flux). The assumed units for wavelength and flux are angstroms and erg/(angstroms * s * cm^2), respectively. Default value is None.
- show_modeled_spectrumbool, optional
Whether to show modeled spectrum in SDEC Plot. Default value is True
- axmatplotlib.axes._subplots.AxesSubplot or None, optional
Axis on which to create plot. Default value is None which will create plot on a new figure’s axis.
- figsizetuple, optional
Size of the matplotlib figure to display. Default value is (12, 7)
- cmapnamestr, optional
Name of matplotlib colormap to be used for showing elements. Default value is “jet”
- nelements: int
Number of elements to include in plot. Determined by the largest contribution to total luminosity absorbed and emitted. Other elements are shown in silver. Default value is None, which displays all elements
- species_list: list of strings or None
list of strings containing the names of species that should be included in the SDEC plots. Must be given in Roman numeral format. Can include specific ions, a range of ions, individual elements, or any combination of these: e.g. [‘Si II’, ‘Ca II’, ‘C’, ‘Fe I-V’]
- blackbody_photosphere: bool
Whether to include the blackbody photosphere in the plot. Default value is True
- Returns:
- matplotlib.axes._subplots.AxesSubplot
Axis on which SDEC Plot is created
- generate_plot_ply(packets_mode='virtual', packet_wvl_range=None, distance=None, observed_spectrum=None, show_modeled_spectrum=True, fig=None, graph_height=600, cmapname='jet', nelements=None, species_list=None, blackbody_photosphere=True)[source]¶
Generate interactive Spectral element DEComposition (SDEC) Plot using plotly.
- Parameters:
- packets_mode{‘virtual’, ‘real’}, optional
Mode of packets to be considered, either real or virtual. Default value is ‘virtual’
- packet_wvl_rangeastropy.Quantity or None, optional
Wavelength range to restrict the analysis of escaped packets. It should be a quantity having units of Angstrom, containing two values - lower lambda and upper lambda i.e. [lower_lambda, upper_lambda] * u.AA. Default value is None
- distanceastropy.Quantity or None, optional
Distance used to calculate flux instead of luminosity in the plot. It should have a length unit like m, Mpc, etc. Default value is None
- observed_spectrumtuple or list of astropy.Quantity, optional
Option to plot an observed spectrum in the SDEC plot. If given, the first element should be the wavelength and the second element should be flux, i.e. (wavelength, flux). The assumed units for wavelength and flux are angstroms and erg/(angstroms * s * cm^2), respectively. Default value is None.
- show_modeled_spectrumbool, optional
Whether to show modeled spectrum in SDEC Plot. Default value is True
- figplotly.graph_objs._figure.Figure or None, optional
Figure object on which to create plot. Default value is None which will create plot on a new Figure object.
- graph_heightint, optional
Height (in px) of the plotly graph to display. Default value is 600
- cmapnamestr, optional
Name of the colormap to be used for showing elements. Default value is “jet”
- nelements: int
Number of elements to include in plot. Determined by the largest contribution to total luminosity absorbed and emitted. Other elements are shown in silver. Default value is None, which displays all elements
- species_list: list of strings or None
list of strings containing the names of species that should be included in the SDEC plots. Must be given in Roman numeral format. Can include specific ions, a range of ions, individual elements, or any combination of these: e.g. [‘Si II’, ‘Ca II’, ‘C’, ‘Fe I-V’]
- blackbody_photosphere: bool
Whether to include the blackbody photosphere in the plot. Default value is True
- Returns:
- plotly.graph_objs._figure.Figure
Figure object on which SDEC Plot is created