You can interact with this notebook online: Launch interactive version
Quickstart for TARDIS¶
Every simulation run requires the atomic database (for more info refer to atomic data) and a configuration file (more info at configuration). You can obtain a copy of the atomic database from the (https://github.com/tardis-sn/tardis-refdata) repository (atom_data
subfolder). We recommended to use the kurucz_cd23_chianti_H_He.h5
dataset (which is auto-downloaded in the second cell already). The
configuration file for this quickstart is tardis_example.yml
, which can be downloaded here), though this file is auto-downloaded in the third cell.
After the installation, start a Jupyter server executing jupyter notebook
on the command line in a directory that contains this quickstart.
[1]:
from tardis import run_tardis
from tardis.io.atom_data.util import download_atom_data
/usr/share/miniconda3/envs/tardis/lib/python3.7/importlib/_bootstrap.py:219: QAWarning: pyne.data is not yet QA compliant.
return f(*args, **kwds)
Downloading the atomic data¶
[2]:
# The data are automatically downloaded
download_atom_data('kurucz_cd23_chianti_H_He')
Downloading the example file¶
[3]:
!curl -O https://raw.githubusercontent.com/tardis-sn/tardis/master/docs/tardis_example.yml
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 980 100 980 0 0 7424 0 --:--:-- --:--:-- --:--:-- 7424
Running the simulation (long output)¶
Note
The progress of the simulation can be tracked using progress bars which are displayed when the notebook is run, but are not displayed in the documentation.
[4]:
sim = run_tardis('tardis_example.yml')
[py.warnings ][WARNING] /usr/share/miniconda3/envs/tardis/lib/python3.7/site-packages/traitlets/traitlets.py:3050: FutureWarning: --rc={'figure.dpi': 96} for dict-traits is deprecated in traitlets 5.0. You can pass --rc <key=value> ... multiple times to add items to a dict.
FutureWarning,
(warnings.py:110)
[py.warnings ][WARNING] /usr/share/miniconda3/envs/tardis/lib/python3.7/site-packages/tardis-2021.12.21.0.dev129+g098e24fc-py3.7.egg/tardis/plasma/properties/radiative_properties.py:92: RuntimeWarning: invalid value encountered in true_divide
(g_lower * n_upper) / (g_upper * n_lower)
(warnings.py:110)
[py.warnings ][WARNING] /usr/share/miniconda3/envs/tardis/lib/python3.7/site-packages/tardis-2021.12.21.0.dev129+g098e24fc-py3.7.egg/tardis/plasma/properties/radiative_properties.py:92: RuntimeWarning: invalid value encountered in true_divide
(g_lower * n_upper) / (g_upper * n_lower)
(warnings.py:110)
[py.warnings ][WARNING] /usr/share/miniconda3/envs/tardis/lib/python3.7/site-packages/tardis-2021.12.21.0.dev129+g098e24fc-py3.7.egg/tardis/plasma/properties/radiative_properties.py:92: RuntimeWarning: invalid value encountered in true_divide
(g_lower * n_upper) / (g_upper * n_lower)
(warnings.py:110)
[py.warnings ][WARNING] /usr/share/miniconda3/envs/tardis/lib/python3.7/site-packages/tardis-2021.12.21.0.dev129+g098e24fc-py3.7.egg/tardis/plasma/properties/radiative_properties.py:92: RuntimeWarning:
invalid value encountered in true_divide
(warnings.py:110)
Note
When running this notebook locally or in interactive mode, a convergence plot will show up.
Plotting the Spectrum¶
[5]:
%pylab inline
spectrum = sim.runner.spectrum
spectrum_virtual = sim.runner.spectrum_virtual
spectrum_integrated = sim.runner.spectrum_integrated
figure(figsize=(10,6))
spectrum.plot(label='normal packets')
spectrum_virtual.plot(label='virtual packets')
spectrum_integrated.plot(label='formal integral')
xlabel('Wavelength [$\AA$]')
ylabel('Luminosity Density [erg/s/$\AA$]')
legend()
xlim(500, 9000)
Populating the interactive namespace from numpy and matplotlib
[py.warnings ][WARNING] /usr/share/miniconda3/envs/tardis/lib/python3.7/site-packages/tardis-2021.12.21.0.dev129+g098e24fc-py3.7.egg/tardis/montecarlo/montecarlo_numba/formal_integral.py:322: UserWarning:
The number of interpolate_shells was not specified. The value was set to 80.
(warnings.py:110)
[5]:
(500.0, 9000.0)