This notebook is available at https://github.com/tardis-sn/tardis/tree/master/docs/quickstart/quickstart.ipynb
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 is automatically downloaded
download_atom_data('kurucz_cd23_chianti_H_He')
[tardis.io.atom_data.atom_web_download][INFO ] Downloading atomic data from https://media.githubusercontent.com/media/tardis-sn/tardis-refdata/master/atom_data/kurucz_cd23_chianti_H_He.h5 to /home/runner/Downloads/tardis-data/kurucz_cd23_chianti_H_He.h5 (atom_web_download.py:46)
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 35000 0 --:--:-- --:--:-- --:--:-- 35000
Running the simulation (long output)¶
[4]:
#TARDIS now uses the data in the data repo
sim = run_tardis('tardis_example.yml')
[tardis.plasma.standard_plasmas][INFO ]
Reading Atomic Data from kurucz_cd23_chianti_H_He.h5 (standard_plasmas.py:91)
[tardis.io.atom_data.util][INFO ]
Atom Data kurucz_cd23_chianti_H_He.h5 not found in local path.
Exists in TARDIS Data repo /home/runner/Downloads/tardis-data/kurucz_cd23_chianti_H_He.h5 (util.py:34)
[tardis.io.atom_data.base][INFO ]
Reading Atom Data with:
UUID = 6f7b09e887a311e7a06b246e96350010
MD5 = 864f1753714343c41f99cb065710cace (base.py:189)
[tardis.io.atom_data.base][INFO ]
Non provided atomic data:
synpp_refs, photoionization_data, yg_data, two_photon_data (base.py:193)
[tardis.simulation.base][INFO ]
Starting iteration 1 of 20 (base.py:325)
[py.warnings ][WARNING] /usr/share/miniconda3/envs/tardis/lib/python3.7/site-packages/astropy/units/equivalencies.py:124: RuntimeWarning: divide by zero encountered in double_scalars
(si.m, si.Hz, lambda x: _si.c.value / x),
(warnings.py:110)
[tardis.simulation.base][INFO ]
Luminosity emitted = 7.942e+42 erg / s
Luminosity absorbed = 2.659e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:453)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:430)
[py.warnings ][WARNING] /usr/share/miniconda3/envs/tardis/lib/python3.7/site-packages/traitlets/traitlets.py:3036: 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)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 9.93e+03 | 1.01e+04 | 0.4 | 0.507 |
5 | 9.85e+03 | 1.02e+04 | 0.211 | 0.197 |
10 | 9.78e+03 | 1.01e+04 | 0.143 | 0.117 |
15 | 9.71e+03 | 9.87e+03 | 0.105 | 0.0869 |
[tardis.simulation.base][INFO ] None (base.py:433)
[tardis.simulation.base][INFO ]
Current t_inner = 9933.952 K
Expected t_inner for next iteration = 11472.471 K
(base.py:448)
[tardis.simulation.base][INFO ]
Starting iteration 2 of 20 (base.py:325)
[py.warnings ][WARNING] /usr/share/miniconda3/envs/tardis/lib/python3.7/site-packages/astropy/units/equivalencies.py:124: RuntimeWarning: divide by zero encountered in double_scalars
(si.m, si.Hz, lambda x: _si.c.value / x),
(warnings.py:110)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.405e+43 erg / s
Luminosity absorbed = 4.798e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:453)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:430)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.01e+04 | 1.15e+04 | 0.507 | 0.546 |
5 | 1.02e+04 | 1.15e+04 | 0.197 | 0.223 |
10 | 1.01e+04 | 1.13e+04 | 0.117 | 0.135 |
15 | 9.87e+03 | 1.1e+04 | 0.0869 | 0.101 |
[tardis.simulation.base][INFO ] None (base.py:433)
[tardis.simulation.base][INFO ]
Current t_inner = 11472.471 K
Expected t_inner for next iteration = 9960.403 K
(base.py:448)
[tardis.simulation.base][INFO ]
Starting iteration 3 of 20 (base.py:325)
[tardis.simulation.base][INFO ]
Luminosity emitted = 8.168e+42 erg / s
Luminosity absorbed = 2.550e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:453)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:430)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.15e+04 | 1.05e+04 | 0.546 | 0.442 |
5 | 1.15e+04 | 1.08e+04 | 0.223 | 0.165 |
10 | 1.13e+04 | 1.07e+04 | 0.135 | 0.101 |
15 | 1.1e+04 | 1.02e+04 | 0.101 | 0.0781 |
[tardis.simulation.base][INFO ] None (base.py:433)
[tardis.simulation.base][INFO ]
Current t_inner = 9960.403 K
Expected t_inner for next iteration = 11342.715 K
(base.py:448)
[tardis.simulation.base][INFO ]
Starting iteration 4 of 20 (base.py:325)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.356e+43 erg / s
Luminosity absorbed = 4.460e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:453)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:430)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.05e+04 | 1.16e+04 | 0.442 | 0.498 |
5 | 1.08e+04 | 1.17e+04 | 0.165 | 0.201 |
10 | 1.07e+04 | 1.14e+04 | 0.101 | 0.127 |
15 | 1.02e+04 | 1.1e+04 | 0.0781 | 0.0953 |
[tardis.simulation.base][INFO ] None (base.py:433)
[tardis.simulation.base][INFO ]
Current t_inner = 11342.715 K
Expected t_inner for next iteration = 10026.022 K
(base.py:448)
[tardis.simulation.base][INFO ]
Starting iteration 5 of 20 (base.py:325)
[tardis.simulation.base][INFO ]
Luminosity emitted = 8.318e+42 erg / s
Luminosity absorbed = 2.681e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:453)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:430)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.16e+04 | 1.06e+04 | 0.498 | 0.444 |
5 | 1.17e+04 | 1.09e+04 | 0.201 | 0.162 |
10 | 1.14e+04 | 1.07e+04 | 0.127 | 0.101 |
15 | 1.1e+04 | 1.03e+04 | 0.0953 | 0.0769 |
[tardis.simulation.base][INFO ] None (base.py:433)
[tardis.simulation.base][INFO ]
Current t_inner = 10026.022 K
Expected t_inner for next iteration = 11314.135 K
(base.py:448)
[tardis.simulation.base][INFO ]
Starting iteration 6 of 20 (base.py:325)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.343e+43 erg / s
Luminosity absorbed = 4.402e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:453)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:430)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.06e+04 | 1.15e+04 | 0.444 | 0.51 |
5 | 1.09e+04 | 1.17e+04 | 0.162 | 0.201 |
10 | 1.07e+04 | 1.14e+04 | 0.101 | 0.127 |
15 | 1.03e+04 | 1.1e+04 | 0.0769 | 0.0955 |
[tardis.simulation.base][INFO ] None (base.py:433)
[tardis.simulation.base][INFO ]
Current t_inner = 11314.135 K
Expected t_inner for next iteration = 10047.862 K
(base.py:448)
[tardis.simulation.base][INFO ]
Starting iteration 7 of 20 (base.py:325)
[tardis.simulation.base][INFO ]
Luminosity emitted = 8.399e+42 erg / s
Luminosity absorbed = 2.700e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:453)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:430)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.15e+04 | 1.06e+04 | 0.51 | 0.443 |
5 | 1.17e+04 | 1.1e+04 | 0.201 | 0.158 |
10 | 1.14e+04 | 1.07e+04 | 0.127 | 0.102 |
15 | 1.1e+04 | 1.03e+04 | 0.0955 | 0.0768 |
[tardis.simulation.base][INFO ] None (base.py:433)
[tardis.simulation.base][INFO ]
Current t_inner = 10047.862 K
Expected t_inner for next iteration = 11284.172 K
(base.py:448)
[tardis.simulation.base][INFO ]
Starting iteration 8 of 20 (base.py:325)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.334e+43 erg / s
Luminosity absorbed = 4.312e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:453)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:430)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.06e+04 | 1.15e+04 | 0.443 | 0.502 |
5 | 1.1e+04 | 1.17e+04 | 0.158 | 0.197 |
10 | 1.07e+04 | 1.14e+04 | 0.102 | 0.124 |
15 | 1.03e+04 | 1.1e+04 | 0.0768 | 0.0941 |
[tardis.simulation.base][INFO ] None (base.py:433)
[tardis.simulation.base][INFO ]
Current t_inner = 11284.172 K
Expected t_inner for next iteration = 10056.590 K
(base.py:448)
[tardis.simulation.base][INFO ]
Starting iteration 9 of 20 (base.py:325)
[tardis.simulation.base][INFO ]
Luminosity emitted = 8.442e+42 erg / s
Luminosity absorbed = 2.693e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:453)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:430)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.15e+04 | 1.06e+04 | 0.502 | 0.443 |
5 | 1.17e+04 | 1.1e+04 | 0.197 | 0.161 |
10 | 1.14e+04 | 1.07e+04 | 0.124 | 0.102 |
15 | 1.1e+04 | 1.04e+04 | 0.0941 | 0.0753 |
[tardis.simulation.base][INFO ] None (base.py:433)
[tardis.simulation.base][INFO ]
Current t_inner = 10056.590 K
Expected t_inner for next iteration = 11264.873 K
(base.py:448)
[tardis.simulation.base][INFO ]
Starting iteration 10 of 20 (base.py:325)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.327e+43 erg / s
Luminosity absorbed = 4.253e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:453)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:430)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.06e+04 | 1.15e+04 | 0.443 | 0.505 |
5 | 1.1e+04 | 1.17e+04 | 0.161 | 0.197 |
10 | 1.07e+04 | 1.15e+04 | 0.102 | 0.122 |
15 | 1.04e+04 | 1.11e+04 | 0.0753 | 0.0933 |
[tardis.simulation.base][INFO ] None (base.py:433)
[tardis.simulation.base][INFO ]
Current t_inner = 11264.873 K
Expected t_inner for next iteration = 10062.930 K
(base.py:448)
[tardis.simulation.base][INFO ]
Starting iteration 11 of 20 (base.py:325)
[tardis.simulation.base][INFO ]
Luminosity emitted = 8.521e+42 erg / s
Luminosity absorbed = 2.645e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:453)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:430)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.15e+04 | 1.06e+04 | 0.505 | 0.444 |
5 | 1.17e+04 | 1.1e+04 | 0.197 | 0.162 |
10 | 1.15e+04 | 1.09e+04 | 0.122 | 0.0958 |
15 | 1.11e+04 | 1.05e+04 | 0.0933 | 0.0744 |
[tardis.simulation.base][INFO ] None (base.py:433)
[tardis.simulation.base][INFO ]
Current t_inner = 10062.930 K
Expected t_inner for next iteration = 11220.057 K
(base.py:448)
[tardis.simulation.base][INFO ]
Starting iteration 12 of 20 (base.py:325)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.302e+43 erg / s
Luminosity absorbed = 4.230e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:453)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:430)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.06e+04 | 1.16e+04 | 0.444 | 0.486 |
5 | 1.1e+04 | 1.18e+04 | 0.162 | 0.19 |
10 | 1.09e+04 | 1.14e+04 | 0.0958 | 0.121 |
15 | 1.05e+04 | 1.11e+04 | 0.0744 | 0.089 |
[tardis.simulation.base][INFO ] None (base.py:433)
[tardis.simulation.base][INFO ]
Current t_inner = 11220.057 K
Expected t_inner for next iteration = 10121.498 K
(base.py:448)
[tardis.simulation.base][INFO ]
Starting iteration 13 of 20 (base.py:325)
[tardis.simulation.base][INFO ]
Luminosity emitted = 8.695e+42 erg / s
Luminosity absorbed = 2.731e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:453)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:430)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.16e+04 | 1.07e+04 | 0.486 | 0.438 |
5 | 1.18e+04 | 1.1e+04 | 0.19 | 0.162 |
10 | 1.14e+04 | 1.08e+04 | 0.121 | 0.101 |
15 | 1.11e+04 | 1.04e+04 | 0.089 | 0.0767 |
[tardis.simulation.base][INFO ] None (base.py:433)
[tardis.simulation.base][INFO ]
Current t_inner = 10121.498 K
Expected t_inner for next iteration = 11171.296 K
(base.py:448)
[tardis.simulation.base][INFO ]
Starting iteration 14 of 20 (base.py:325)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.284e+43 erg / s
Luminosity absorbed = 4.115e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:453)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:430)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.07e+04 | 1.15e+04 | 0.438 | 0.495 |
5 | 1.1e+04 | 1.17e+04 | 0.162 | 0.191 |
10 | 1.08e+04 | 1.14e+04 | 0.101 | 0.12 |
15 | 1.04e+04 | 1.1e+04 | 0.0767 | 0.0918 |
[tardis.simulation.base][INFO ] None (base.py:433)
[tardis.simulation.base][INFO ]
Current t_inner = 11171.296 K
Expected t_inner for next iteration = 10145.811 K
(base.py:448)
[tardis.simulation.base][INFO ]
Starting iteration 15 of 20 (base.py:325)
[tardis.simulation.base][INFO ]
Luminosity emitted = 8.705e+42 erg / s
Luminosity absorbed = 2.828e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:453)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:430)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.15e+04 | 1.07e+04 | 0.495 | 0.449 |
5 | 1.17e+04 | 1.1e+04 | 0.191 | 0.163 |
10 | 1.14e+04 | 1.09e+04 | 0.12 | 0.0997 |
15 | 1.1e+04 | 1.05e+04 | 0.0918 | 0.0768 |
[tardis.simulation.base][INFO ] None (base.py:433)
[tardis.simulation.base][INFO ]
Current t_inner = 10145.811 K
Expected t_inner for next iteration = 11191.850 K
(base.py:448)
[tardis.simulation.base][INFO ]
Starting iteration 16 of 20 (base.py:325)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.284e+43 erg / s
Luminosity absorbed = 4.234e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:453)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:430)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.07e+04 | 1.15e+04 | 0.449 | 0.495 |
5 | 1.1e+04 | 1.18e+04 | 0.163 | 0.184 |
10 | 1.09e+04 | 1.14e+04 | 0.0997 | 0.122 |
15 | 1.05e+04 | 1.11e+04 | 0.0768 | 0.0898 |
[tardis.simulation.base][INFO ] None (base.py:433)
[tardis.simulation.base][INFO ]
Current t_inner = 11191.850 K
Expected t_inner for next iteration = 10164.556 K
(base.py:448)
[tardis.simulation.base][INFO ]
Starting iteration 17 of 20 (base.py:325)
[tardis.simulation.base][INFO ]
Luminosity emitted = 8.803e+42 erg / s
Luminosity absorbed = 2.816e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:453)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:430)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.15e+04 | 1.07e+04 | 0.495 | 0.439 |
5 | 1.18e+04 | 1.11e+04 | 0.184 | 0.16 |
10 | 1.14e+04 | 1.1e+04 | 0.122 | 0.0962 |
15 | 1.11e+04 | 1.05e+04 | 0.0898 | 0.0763 |
[tardis.simulation.base][INFO ] None (base.py:433)
[tardis.simulation.base][INFO ]
Current t_inner = 10164.556 K
Expected t_inner for next iteration = 11150.010 K
(base.py:448)
[tardis.simulation.base][INFO ]
Starting iteration 18 of 20 (base.py:325)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.271e+43 erg / s
Luminosity absorbed = 4.117e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:453)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:430)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.07e+04 | 1.14e+04 | 0.439 | 0.492 |
5 | 1.11e+04 | 1.17e+04 | 0.16 | 0.186 |
10 | 1.1e+04 | 1.15e+04 | 0.0962 | 0.117 |
15 | 1.05e+04 | 1.11e+04 | 0.0763 | 0.0876 |
[tardis.simulation.base][INFO ] None (base.py:433)
[tardis.simulation.base][INFO ]
Current t_inner = 11150.010 K
Expected t_inner for next iteration = 10180.809 K
(base.py:448)
[tardis.simulation.base][INFO ]
Starting iteration 19 of 20 (base.py:325)
[tardis.simulation.base][INFO ]
Luminosity emitted = 8.820e+42 erg / s
Luminosity absorbed = 2.873e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:453)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:430)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.14e+04 | 1.07e+04 | 0.492 | 0.441 |
5 | 1.17e+04 | 1.11e+04 | 0.186 | 0.161 |
10 | 1.15e+04 | 1.09e+04 | 0.117 | 0.1 |
15 | 1.11e+04 | 1.05e+04 | 0.0876 | 0.0765 |
[tardis.simulation.base][INFO ] None (base.py:433)
[tardis.simulation.base][INFO ]
Current t_inner = 10180.809 K
Expected t_inner for next iteration = 11157.125 K
(base.py:448)
[tardis.simulation.base][INFO ]
Starting iteration 20 of 20 (base.py:325)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.272e+43 erg / s
Luminosity absorbed = 4.149e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:453)
[tardis.simulation.base][INFO ]
Simulation finished in 20 iterations
Simulation took 39.35 s
(base.py:384)
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 [erg/s/$\AA$]')
legend()
xlim(3000, 9000)
Populating the interactive namespace from numpy and matplotlib
[py.warnings ][WARNING] /usr/share/miniconda3/envs/tardis/lib/python3.7/site-packages/tardis_sn-3.0.dev4025-py3.7.egg/tardis/montecarlo/montecarlo_numba/formal_integral.py:277: UserWarning: The number of interpolate_shells was not specified. The value was set to 80.
"The number of interpolate_shells was not "
(warnings.py:110)
[5]:
(3000.0, 9000.0)
[ ]: