You can interact with this notebook online: Launch notebook
Generating the Plasma Graph¶
After running a simulation, TARDIS has the ability to create a graph showcasing how each variable used to compute the plasma state is connected and calculated (see the Plasma Documentation for more information). To do so, one needs to utilize the write_to_tex
command to generate a .tex file that displays the graph. This tutorial aims to showcase how the .tex file can be generated and
what options can be inputted to display the graph in a preferred method. To start, TARDIS needs to perform a simulation. Here the tardis_example.yml
configuration file is used as in the quickstart guide.
[1]:
#downloading necessary modules
from tardis import run_tardis
from tardis.io.atom_data.util import download_atom_data
import networkx as nx
from IPython.core.display import Image, display
/usr/share/miniconda3/envs/tardis/lib/python3.11/site-packages/setuptools_scm/git.py:162: UserWarning: "/home/runner/work/tardis/tardis" is shallow and may cause errors
warnings.warn(f'"{wd.path}" is shallow and may cause errors')
/tmp/ipykernel_3431/3520658749.py:7: DeprecationWarning: Importing display from IPython.core.display is deprecated since IPython 7.14, please import from IPython display
from IPython.core.display import Image, display
[2]:
#downloading atom data
download_atom_data('kurucz_cd23_chianti_H_He')
Atomic Data kurucz_cd23_chianti_H_He already exists in /home/runner/Downloads/tardis-data/kurucz_cd23_chianti_H_He.h5. Will not download - override with force_download=True.
[3]:
#running simulation
sim = run_tardis('tardis_example.yml')
[tardis.simulation.base][INFO ]
Reading Atomic Data from kurucz_cd23_chianti_H_He.h5 (base.py:681)
[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:36)
[tardis.io.atom_data.base][INFO ]
Reading Atom Data with: UUID = 6f7b09e887a311e7a06b246e96350010 MD5 = 864f1753714343c41f99cb065710cace (base.py:258)
[tardis.io.atom_data.base][INFO ]
Non provided Atomic Data: synpp_refs, photoionization_data, yg_data, two_photon_data, linelist (base.py:262)
[tardis.model.parse_input][WARNING]
Number of density points larger than number of shells. Assuming inner point irrelevant (parse_input.py:143)
[tardis.model.matter.decay][INFO ]
Decaying abundances for 1123200.0 seconds (decay.py:101)
[py.warnings ][WARNING]
/home/runner/work/tardis/tardis/tardis/plasma/properties/radiative_properties.py:93: RuntimeWarning: invalid value encountered in divide
(g_lower * n_upper) / (g_upper * n_lower)
(warnings.py:109)
[py.warnings ][WARNING]
/home/runner/work/tardis/tardis/tardis/plasma/properties/radiative_properties.py:93: RuntimeWarning: invalid value encountered in divide
(g_lower * n_upper) / (g_upper * n_lower)
(warnings.py:109)
[tardis.simulation.base][INFO ]
Starting iteration 1 of 20 (base.py:398)
[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:580)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:548)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 9.93e+03 K | 1.01e+04 K | 0.4 | 0.507 |
5 | 9.85e+03 K | 1.02e+04 K | 0.211 | 0.197 |
10 | 9.78e+03 K | 1.01e+04 K | 0.143 | 0.117 |
15 | 9.71e+03 K | 9.87e+03 K | 0.105 | 0.0869 |
[tardis.simulation.base][INFO ]
Current t_inner = 9933.952 K
Expected t_inner for next iteration = 10703.212 K
(base.py:575)
[py.warnings ][WARNING]
/home/runner/work/tardis/tardis/tardis/plasma/properties/radiative_properties.py:93: RuntimeWarning: invalid value encountered in divide
(g_lower * n_upper) / (g_upper * n_lower)
(warnings.py:109)
[tardis.simulation.base][INFO ]
Starting iteration 2 of 20 (base.py:398)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.071e+43 erg / s
Luminosity absorbed = 3.576e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:580)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:548)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.01e+04 K | 1.08e+04 K | 0.507 | 0.525 |
5 | 1.02e+04 K | 1.1e+04 K | 0.197 | 0.203 |
10 | 1.01e+04 K | 1.08e+04 K | 0.117 | 0.125 |
15 | 9.87e+03 K | 1.05e+04 K | 0.0869 | 0.0933 |
[tardis.simulation.base][INFO ]
Current t_inner = 10703.212 K
Expected t_inner for next iteration = 10673.712 K
(base.py:575)
[py.warnings ][WARNING]
/home/runner/work/tardis/tardis/tardis/plasma/properties/radiative_properties.py:93: RuntimeWarning: invalid value encountered in divide
(g_lower * n_upper) / (g_upper * n_lower)
(warnings.py:109)
[tardis.simulation.base][INFO ]
Starting iteration 3 of 20 (base.py:398)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.074e+43 erg / s
Luminosity absorbed = 3.391e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:580)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:548)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.08e+04 K | 1.1e+04 K | 0.525 | 0.483 |
5 | 1.1e+04 K | 1.12e+04 K | 0.203 | 0.189 |
10 | 1.08e+04 K | 1.1e+04 K | 0.125 | 0.118 |
15 | 1.05e+04 K | 1.06e+04 K | 0.0933 | 0.0895 |
[tardis.simulation.base][INFO ]
Current t_inner = 10673.712 K
Expected t_inner for next iteration = 10635.953 K
(base.py:575)
[py.warnings ][WARNING]
/home/runner/work/tardis/tardis/tardis/plasma/properties/radiative_properties.py:93: RuntimeWarning: invalid value encountered in divide
(g_lower * n_upper) / (g_upper * n_lower)
(warnings.py:109)
[tardis.simulation.base][INFO ]
Starting iteration 4 of 20 (base.py:398)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.058e+43 erg / s
Luminosity absorbed = 3.352e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:580)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:548)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.1e+04 K | 1.1e+04 K | 0.483 | 0.469 |
5 | 1.12e+04 K | 1.12e+04 K | 0.189 | 0.182 |
10 | 1.1e+04 K | 1.1e+04 K | 0.118 | 0.113 |
15 | 1.06e+04 K | 1.07e+04 K | 0.0895 | 0.0861 |
[tardis.simulation.base][INFO ]
Current t_inner = 10635.953 K
Expected t_inner for next iteration = 10638.407 K
(base.py:575)
[py.warnings ][WARNING]
/home/runner/work/tardis/tardis/tardis/plasma/properties/radiative_properties.py:93: RuntimeWarning: invalid value encountered in divide
(g_lower * n_upper) / (g_upper * n_lower)
(warnings.py:109)
[tardis.simulation.base][INFO ]
Starting iteration 5 of 20 (base.py:398)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.055e+43 erg / s
Luminosity absorbed = 3.399e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:580)
[tardis.simulation.base][INFO ]
Iteration converged 1/4 consecutive times. (base.py:268)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:548)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.1e+04 K | 1.1e+04 K | 0.469 | 0.479 |
5 | 1.12e+04 K | 1.13e+04 K | 0.182 | 0.178 |
10 | 1.1e+04 K | 1.1e+04 K | 0.113 | 0.113 |
15 | 1.07e+04 K | 1.07e+04 K | 0.0861 | 0.0839 |
[tardis.simulation.base][INFO ]
Current t_inner = 10638.407 K
Expected t_inner for next iteration = 10650.202 K
(base.py:575)
[py.warnings ][WARNING]
/home/runner/work/tardis/tardis/tardis/plasma/properties/radiative_properties.py:93: RuntimeWarning: invalid value encountered in divide
(g_lower * n_upper) / (g_upper * n_lower)
(warnings.py:109)
[tardis.simulation.base][INFO ]
Starting iteration 6 of 20 (base.py:398)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.061e+43 erg / s
Luminosity absorbed = 3.398e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:580)
[tardis.simulation.base][INFO ]
Iteration converged 2/4 consecutive times. (base.py:268)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:548)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.1e+04 K | 1.1e+04 K | 0.479 | 0.47 |
5 | 1.13e+04 K | 1.12e+04 K | 0.178 | 0.185 |
10 | 1.1e+04 K | 1.11e+04 K | 0.113 | 0.112 |
15 | 1.07e+04 K | 1.07e+04 K | 0.0839 | 0.0856 |
[tardis.simulation.base][INFO ]
Current t_inner = 10650.202 K
Expected t_inner for next iteration = 10645.955 K
(base.py:575)
[py.warnings ][WARNING]
/home/runner/work/tardis/tardis/tardis/plasma/properties/radiative_properties.py:93: RuntimeWarning: invalid value encountered in divide
(g_lower * n_upper) / (g_upper * n_lower)
(warnings.py:109)
[tardis.simulation.base][INFO ]
Starting iteration 7 of 20 (base.py:398)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.061e+43 erg / s
Luminosity absorbed = 3.382e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:580)
[tardis.simulation.base][INFO ]
Iteration converged 3/4 consecutive times. (base.py:268)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:548)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.1e+04 K | 1.1e+04 K | 0.47 | 0.47 |
5 | 1.12e+04 K | 1.13e+04 K | 0.185 | 0.178 |
10 | 1.11e+04 K | 1.11e+04 K | 0.112 | 0.112 |
15 | 1.07e+04 K | 1.07e+04 K | 0.0856 | 0.086 |
[tardis.simulation.base][INFO ]
Current t_inner = 10645.955 K
Expected t_inner for next iteration = 10642.050 K
(base.py:575)
[py.warnings ][WARNING]
/home/runner/work/tardis/tardis/tardis/plasma/properties/radiative_properties.py:93: RuntimeWarning: invalid value encountered in divide
(g_lower * n_upper) / (g_upper * n_lower)
(warnings.py:109)
[tardis.simulation.base][INFO ]
Starting iteration 8 of 20 (base.py:398)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.062e+43 erg / s
Luminosity absorbed = 3.350e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:580)
[tardis.simulation.base][INFO ]
Iteration converged 4/4 consecutive times. (base.py:268)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:548)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.1e+04 K | 1.11e+04 K | 0.47 | 0.472 |
5 | 1.13e+04 K | 1.14e+04 K | 0.178 | 0.175 |
10 | 1.11e+04 K | 1.11e+04 K | 0.112 | 0.111 |
15 | 1.07e+04 K | 1.07e+04 K | 0.086 | 0.084 |
[tardis.simulation.base][INFO ]
Current t_inner = 10642.050 K
Expected t_inner for next iteration = 10636.106 K
(base.py:575)
[py.warnings ][WARNING]
/home/runner/work/tardis/tardis/tardis/plasma/properties/radiative_properties.py:93: RuntimeWarning: invalid value encountered in divide
(g_lower * n_upper) / (g_upper * n_lower)
(warnings.py:109)
[tardis.simulation.base][INFO ]
Starting iteration 9 of 20 (base.py:398)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.052e+43 erg / s
Luminosity absorbed = 3.411e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:580)
[tardis.simulation.base][INFO ]
Iteration converged 5/4 consecutive times. (base.py:268)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:548)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.11e+04 K | 1.11e+04 K | 0.472 | 0.469 |
5 | 1.14e+04 K | 1.15e+04 K | 0.175 | 0.17 |
10 | 1.11e+04 K | 1.11e+04 K | 0.111 | 0.109 |
15 | 1.07e+04 K | 1.08e+04 K | 0.084 | 0.0822 |
[tardis.simulation.base][INFO ]
Current t_inner = 10636.106 K
Expected t_inner for next iteration = 10654.313 K
(base.py:575)
[py.warnings ][WARNING]
/home/runner/work/tardis/tardis/tardis/plasma/properties/radiative_properties.py:93: RuntimeWarning: invalid value encountered in divide
(g_lower * n_upper) / (g_upper * n_lower)
(warnings.py:109)
[tardis.simulation.base][INFO ]
Starting iteration 10 of 20 (base.py:398)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.070e+43 erg / s
Luminosity absorbed = 3.335e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:580)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:548)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.11e+04 K | 1.1e+04 K | 0.469 | 0.475 |
5 | 1.15e+04 K | 1.14e+04 K | 0.17 | 0.177 |
10 | 1.11e+04 K | 1.11e+04 K | 0.109 | 0.112 |
15 | 1.08e+04 K | 1.06e+04 K | 0.0822 | 0.0878 |
[tardis.simulation.base][INFO ]
Current t_inner = 10654.313 K
Expected t_inner for next iteration = 10628.190 K
(base.py:575)
[py.warnings ][WARNING]
/home/runner/work/tardis/tardis/tardis/plasma/properties/radiative_properties.py:93: RuntimeWarning: invalid value encountered in divide
(g_lower * n_upper) / (g_upper * n_lower)
(warnings.py:109)
[tardis.simulation.base][INFO ]
Starting iteration 11 of 20 (base.py:398)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.053e+43 erg / s
Luminosity absorbed = 3.363e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:580)
[tardis.simulation.base][INFO ]
Iteration converged 1/4 consecutive times. (base.py:268)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:548)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.1e+04 K | 1.1e+04 K | 0.475 | 0.472 |
5 | 1.14e+04 K | 1.12e+04 K | 0.177 | 0.184 |
10 | 1.11e+04 K | 1.1e+04 K | 0.112 | 0.114 |
15 | 1.06e+04 K | 1.06e+04 K | 0.0878 | 0.0859 |
[tardis.simulation.base][INFO ]
Current t_inner = 10628.190 K
Expected t_inner for next iteration = 10644.054 K
(base.py:575)
[py.warnings ][WARNING]
/home/runner/work/tardis/tardis/tardis/plasma/properties/radiative_properties.py:93: RuntimeWarning: invalid value encountered in divide
(g_lower * n_upper) / (g_upper * n_lower)
(warnings.py:109)
[tardis.simulation.base][INFO ]
Starting iteration 12 of 20 (base.py:398)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.056e+43 erg / s
Luminosity absorbed = 3.420e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:580)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:548)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.1e+04 K | 1.11e+04 K | 0.472 | 0.467 |
5 | 1.12e+04 K | 1.13e+04 K | 0.184 | 0.176 |
10 | 1.1e+04 K | 1.11e+04 K | 0.114 | 0.11 |
15 | 1.06e+04 K | 1.08e+04 K | 0.0859 | 0.0821 |
[tardis.simulation.base][INFO ]
Current t_inner = 10644.054 K
Expected t_inner for next iteration = 10653.543 K
(base.py:575)
[py.warnings ][WARNING]
/home/runner/work/tardis/tardis/tardis/plasma/properties/radiative_properties.py:93: RuntimeWarning: invalid value encountered in divide
(g_lower * n_upper) / (g_upper * n_lower)
(warnings.py:109)
[tardis.simulation.base][INFO ]
Starting iteration 13 of 20 (base.py:398)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.062e+43 erg / s
Luminosity absorbed = 3.406e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:580)
[tardis.simulation.base][INFO ]
Iteration converged 1/4 consecutive times. (base.py:268)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:548)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.11e+04 K | 1.11e+04 K | 0.467 | 0.466 |
5 | 1.13e+04 K | 1.13e+04 K | 0.176 | 0.18 |
10 | 1.11e+04 K | 1.11e+04 K | 0.11 | 0.111 |
15 | 1.08e+04 K | 1.08e+04 K | 0.0821 | 0.0841 |
[tardis.simulation.base][INFO ]
Current t_inner = 10653.543 K
Expected t_inner for next iteration = 10647.277 K
(base.py:575)
[py.warnings ][WARNING]
/home/runner/work/tardis/tardis/tardis/plasma/properties/radiative_properties.py:93: RuntimeWarning: invalid value encountered in divide
(g_lower * n_upper) / (g_upper * n_lower)
(warnings.py:109)
[tardis.simulation.base][INFO ]
Starting iteration 14 of 20 (base.py:398)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.063e+43 erg / s
Luminosity absorbed = 3.369e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:580)
[tardis.simulation.base][INFO ]
Iteration converged 2/4 consecutive times. (base.py:268)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:548)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.11e+04 K | 1.11e+04 K | 0.466 | 0.469 |
5 | 1.13e+04 K | 1.13e+04 K | 0.18 | 0.182 |
10 | 1.11e+04 K | 1.1e+04 K | 0.111 | 0.113 |
15 | 1.08e+04 K | 1.07e+04 K | 0.0841 | 0.0854 |
[tardis.simulation.base][INFO ]
Current t_inner = 10647.277 K
Expected t_inner for next iteration = 10638.875 K
(base.py:575)
[py.warnings ][WARNING]
/home/runner/work/tardis/tardis/tardis/plasma/properties/radiative_properties.py:93: RuntimeWarning: invalid value encountered in divide
(g_lower * n_upper) / (g_upper * n_lower)
(warnings.py:109)
[tardis.simulation.base][INFO ]
Starting iteration 15 of 20 (base.py:398)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.053e+43 erg / s
Luminosity absorbed = 3.417e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:580)
[tardis.simulation.base][INFO ]
Iteration converged 3/4 consecutive times. (base.py:268)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:548)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.11e+04 K | 1.1e+04 K | 0.469 | 0.484 |
5 | 1.13e+04 K | 1.13e+04 K | 0.182 | 0.181 |
10 | 1.1e+04 K | 1.1e+04 K | 0.113 | 0.113 |
15 | 1.07e+04 K | 1.07e+04 K | 0.0854 | 0.0858 |
[tardis.simulation.base][INFO ]
Current t_inner = 10638.875 K
Expected t_inner for next iteration = 10655.125 K
(base.py:575)
[py.warnings ][WARNING]
/home/runner/work/tardis/tardis/tardis/plasma/properties/radiative_properties.py:93: RuntimeWarning: invalid value encountered in divide
(g_lower * n_upper) / (g_upper * n_lower)
(warnings.py:109)
[tardis.simulation.base][INFO ]
Starting iteration 16 of 20 (base.py:398)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.059e+43 erg / s
Luminosity absorbed = 3.445e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:580)
[tardis.simulation.base][INFO ]
Iteration converged 4/4 consecutive times. (base.py:268)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:548)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.1e+04 K | 1.1e+04 K | 0.484 | 0.472 |
5 | 1.13e+04 K | 1.13e+04 K | 0.181 | 0.177 |
10 | 1.1e+04 K | 1.1e+04 K | 0.113 | 0.113 |
15 | 1.07e+04 K | 1.06e+04 K | 0.0858 | 0.0858 |
[tardis.simulation.base][INFO ]
Current t_inner = 10655.125 K
Expected t_inner for next iteration = 10655.561 K
(base.py:575)
[py.warnings ][WARNING]
/home/runner/work/tardis/tardis/tardis/plasma/properties/radiative_properties.py:93: RuntimeWarning: invalid value encountered in divide
(g_lower * n_upper) / (g_upper * n_lower)
(warnings.py:109)
[tardis.simulation.base][INFO ]
Starting iteration 17 of 20 (base.py:398)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.067e+43 erg / s
Luminosity absorbed = 3.372e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:580)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:548)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.1e+04 K | 1.11e+04 K | 0.472 | 0.468 |
5 | 1.13e+04 K | 1.14e+04 K | 0.177 | 0.175 |
10 | 1.1e+04 K | 1.11e+04 K | 0.113 | 0.11 |
15 | 1.06e+04 K | 1.08e+04 K | 0.0858 | 0.0816 |
[tardis.simulation.base][INFO ]
Current t_inner = 10655.561 K
Expected t_inner for next iteration = 10636.536 K
(base.py:575)
[py.warnings ][WARNING]
/home/runner/work/tardis/tardis/tardis/plasma/properties/radiative_properties.py:93: RuntimeWarning: invalid value encountered in divide
(g_lower * n_upper) / (g_upper * n_lower)
(warnings.py:109)
[tardis.simulation.base][INFO ]
Starting iteration 18 of 20 (base.py:398)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.057e+43 erg / s
Luminosity absorbed = 3.365e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:580)
[tardis.simulation.base][INFO ]
Iteration converged 1/4 consecutive times. (base.py:268)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:548)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.11e+04 K | 1.11e+04 K | 0.468 | 0.464 |
5 | 1.14e+04 K | 1.13e+04 K | 0.175 | 0.177 |
10 | 1.11e+04 K | 1.1e+04 K | 0.11 | 0.113 |
15 | 1.08e+04 K | 1.07e+04 K | 0.0816 | 0.0848 |
[tardis.simulation.base][INFO ]
Current t_inner = 10636.536 K
Expected t_inner for next iteration = 10641.692 K
(base.py:575)
[py.warnings ][WARNING]
/home/runner/work/tardis/tardis/tardis/plasma/properties/radiative_properties.py:93: RuntimeWarning: invalid value encountered in divide
(g_lower * n_upper) / (g_upper * n_lower)
(warnings.py:109)
[tardis.simulation.base][INFO ]
Starting iteration 19 of 20 (base.py:398)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.056e+43 erg / s
Luminosity absorbed = 3.405e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:580)
[tardis.simulation.base][INFO ]
Iteration converged 2/4 consecutive times. (base.py:268)
[tardis.simulation.base][INFO ]
Plasma stratification: (base.py:548)
Shell No. | t_rad | next_t_rad | w | next_w |
---|---|---|---|---|
0 | 1.11e+04 K | 1.11e+04 K | 0.464 | 0.466 |
5 | 1.13e+04 K | 1.13e+04 K | 0.177 | 0.177 |
10 | 1.1e+04 K | 1.11e+04 K | 0.113 | 0.111 |
15 | 1.07e+04 K | 1.07e+04 K | 0.0848 | 0.0853 |
[tardis.simulation.base][INFO ]
Current t_inner = 10641.692 K
Expected t_inner for next iteration = 10650.463 K
(base.py:575)
[py.warnings ][WARNING]
/home/runner/work/tardis/tardis/tardis/plasma/properties/radiative_properties.py:93: RuntimeWarning: invalid value encountered in divide
(g_lower * n_upper) / (g_upper * n_lower)
(warnings.py:109)
[tardis.simulation.base][INFO ]
Simulation finished in 19 iterations
Simulation took 71.63 s
(base.py:476)
[tardis.simulation.base][INFO ]
Starting iteration 20 of 20 (base.py:398)
[tardis.simulation.base][INFO ]
Luminosity emitted = 1.061e+43 erg / s
Luminosity absorbed = 3.401e+42 erg / s
Luminosity requested = 1.059e+43 erg / s
(base.py:580)
Displaying the Graph Within A Jupyter Notebook¶
Now that TARDIS has finished a simulation run, the plasma graph can now be generated. To display the basic graph within a Jupyter Notebook, one can simply use the nx.draw
as follows:
[4]:
%pylab inline
nx.draw(sim.plasma.graph)
%pylab is deprecated, use %matplotlib inline and import the required libraries.
Populating the interactive namespace from numpy and matplotlib
There are many different ways of displaying the graph in a more readable format. One such example is shown below.
[5]:
position = nx.spring_layout(sim.plasma.graph, k=0.75, iterations=15)
nx.draw(sim.plasma.graph, position, with_labels=True)
Note
For the purposes of this tutorial, pylab inline has been used to display the graph within the tutorial page. It is recommended to use pylab notebook when displaying the graph on a local Jupyter Notebook to explore the nodes in depth.
Saving the Graph Onto a .tex File¶
With the write_to_tex
command, a copy of the graph can be saved within a .tex file. Currently, there are four parameters TARDIS uses to write the graph in LaTeX and save it to a .tex file:
fname_graph: The name of the file TARDIS will save the graph onto (required)
scale: a scaling factor to expand/contract the generated graph
args: a list of optional settings for displaying the graph
latex_label: a parameter that enables or disables writing LaTeX equations and edge labels onto the file (default set to True to enable writing)
With these parameters, TARDIS can write the graph in many different ways. For this tutorial, only a few examples will be shown to display what each parameter exactly does and what the resulting graph will look like when generated in a LaTeX environment.
Warning
As of now, TARDIS has an issue of not spacing edges correctly, causing the default output to look very condensed and unreadable in certain areas. It is recommended, therefore, to use the given parameters to generate a graph that displays everything in as readable a format as possible.
Default Plasma Graph¶
From above, TARDIS only needs the name of the file it should save the graph to as default.
[6]:
sim.plasma.write_to_tex("plasma_graph_default.tex")
With the default settings, the contents of the file will simply be the graph written in LaTeX.
[7]:
with open("plasma_graph_default.tex", "r") as file:
print(file.read())
file.close()
\documentclass[class=minimal,border=20pt]{standalone}
\usepackage[x11names, svgnames, rgb]{xcolor}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{snakes,arrows,shapes}
\usepackage{amsmath}
%
%
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{0pt}%
%
\begin{document}
\pagestyle{empty}
%
%
%
% Start of code
\begin{tikzpicture}[>=latex',line join=bevel,scale=0.5]
%%
\node (TRadiative) at (761.87bp,1042.6bp) [draw,ellipse] {$\textrm{TRadiative}$};
\node (BetaRadiation) at (1519.9bp,953.35bp) [draw,ellipse] {$\textrm{BetaRadiation: }\dfrac{1}{k_{B} T_{\textrm{rad}}}$};
\node (ElectronTemperature) at (366.87bp,953.35bp) [draw,ellipse] {$\textrm{ElectronTemperature: }\textrm{const.}\times T_{\textrm{rad}}$};
\node (JBluesDiluteBlackBody) at (1799.9bp,309.85bp) [draw,ellipse] {$\textrm{JBluesDiluteBlackBody}$};
\node (GElectron) at (1276.9bp,810.1bp) [draw,ellipse] {$\textrm{GElectron: }\Big(\dfrac{2\pi m_{e}/\beta_{\textrm{rad}}}{h^2}\Big)^{3/2}$};
\node (LevelBoltzmannFactorLTE) at (2631.9bp,864.1bp) [draw,ellipse] {$\textrm{LevelBoltzmannFactorLTE: }g_{i,j,k}e^{\dfrac{-\epsilon_{i,j,k}}{k_{\textrm{B}}T_{\textrm{rad}}}}$};
\node (PhiSahaLTE) at (1714.9bp,577.6bp) [draw,ellipse] {$\textrm{PhiSahaLTE: }\dfrac{2Z_{i,j+1}}{Z_{i,j}}\big( \dfrac{2\pi m_{e}/\beta_{\textrm{rad}}}{h^2} \big)^{3/2}e^{\dfrac{-\chi_{i,j}}{kT_{\textrm{rad}}}}$};
\node (TauSobolev) at (2309.9bp,208.55bp) [draw,ellipse] {$\textrm{TauSobolev: }\dfrac{\pi e^{2}}{m_{e} c}f_{lu}\lambda t_{exp} n_{lower} \Big(1-\dfrac{g_{lower}n_{upper}}{g_{upper}n_{lower}}\Big)$};
\node (TransitionProbabilities) at (2452.9bp,18.0bp) [draw,ellipse] {$\textrm{TransitionProbabilities}$};
\node (Abundance) at (1959.9bp,1131.9bp) [draw,ellipse] {$\textrm{Abundance}$};
\node (NumberDensity) at (1920.9bp,864.1bp) [draw,ellipse] {$\textrm{NumberDensity}$};
\node (SelectedAtoms) at (2740.9bp,1042.6bp) [draw,ellipse] {$\textrm{SelectedAtoms}$};
\node (IonNumberDensity) at (2642.9bp,488.35bp) [draw,ellipse] {$\textrm{IonNumberDensity}$};
\node (Levels) at (2875.9bp,953.35bp) [draw,ellipse] {$\textrm{Levels}$};
\node (Lines) at (3234.9bp,399.1bp) [draw,ellipse] {$\textrm{Lines}$};
\node (AtomicMass) at (2648.9bp,953.35bp) [draw,ellipse] {$\textrm{AtomicMass}$};
\node (IonizationData) at (2146.9bp,953.35bp) [draw,ellipse] {$\textrm{IonizationData}$};
\node (MacroAtomData) at (3161.9bp,953.35bp) [draw,ellipse] {$\textrm{MacroAtomData}$};
\node (Density) at (2392.9bp,953.35bp) [draw,ellipse] {$\textrm{Density}$};
\node (TimeExplosion) at (2202.9bp,309.85bp) [draw,ellipse] {$\textrm{TimeExplosion}$};
\node (BetaSobolev) at (2452.9bp,107.25bp) [draw,ellipse] {$\textrm{BetaSobolev}$};
\node (AtomicData) at (3103.9bp,1042.6bp) [draw,ellipse] {$\textrm{AtomicData}$};
\node (StimulatedEmissionFactor) at (2819.9bp,309.85bp) [draw,ellipse] {$\textrm{StimulatedEmissionFactor: }1-\dfrac{g_{lower}n_{upper}}{g_{upper}n_{lower}}$};
\node (LevelNumberDensity) at (2795.9bp,399.1bp) [draw,ellipse] {$\textrm{LevelNumberDensity: }N_{i,j}\dfrac{bf_{i,j,k}}{Z_{i,j}}$};
\node (DilutionFactor) at (603.87bp,399.1bp) [draw,ellipse] {$\textrm{DilutionFactor}$};
\node (LinkTRadTElectron) at (366.87bp,1042.6bp) [draw,ellipse] {$\textrm{LinkTRadTElectron}$};
\node (HeliumTreatment) at (2237.9bp,1131.9bp) [draw,ellipse] {$\textrm{HeliumTreatment}$};
\node (ContinuumInteractionSpecies) at (2609.9bp,1131.9bp) [draw,ellipse] {$\textrm{ContinuumInteractionSpecies}$};
\node (NLTEIonizationSpecies) at (3008.9bp,1131.9bp) [draw,ellipse] {$\textrm{NLTEIonizationSpecies}$};
\node (NLTEExcitationSpecies) at (3375.9bp,1131.9bp) [draw,ellipse] {$\textrm{NLTEExcitationSpecies}$};
\node (LevelBoltzmannFactorNoNLTE) at (2781.9bp,756.1bp) [draw,ellipse] {$\textrm{LevelBoltzmannFactorNoNLTE}$};
\node (PartitionFunction) at (2781.9bp,666.85bp) [draw,ellipse] {$\textrm{PartitionFunction: }\sum_{k}bf_{i,j,k}$};
\draw [->] (TRadiative) ..controls (979.18bp,1016.6bp) and (1218.5bp,989.04bp) .. (BetaRadiation);
\definecolor{strokecol}{rgb}{0.0,0.0,0.0};
\pgfsetstrokecolor{strokecol}
\draw (1210.12bp,993.3bp) node {$T_{\textrm{rad}}$};
\draw [->] (TRadiative) ..controls (631.9bp,1012.9bp) and (528.26bp,990.0bp) .. (ElectronTemperature);
\draw (602.12bp,993.3bp) node {$T_{\textrm{rad}}$};
\draw [->] (TRadiative) ..controls (761.87bp,1006.6bp) and (761.87bp,978.59bp) .. (761.87bp,954.35bp) .. controls (761.87bp,954.35bp) and (761.87bp,954.35bp) .. (761.87bp,398.1bp) .. controls (761.87bp,355.23bp) and (1331.6bp,328.0bp) .. (JBluesDiluteBlackBody);
\draw (764.12bp,662.18bp) node {$T_{\textrm{rad}}$};
\draw [->] (BetaRadiation) ..controls (1446.2bp,909.55bp) and (1364.3bp,861.93bp) .. (GElectron);
\draw (1460.12bp,904.05bp) node {$\beta_{\textrm{rad}}$};
\draw [->] (BetaRadiation) ..controls (1794.8bp,926.35bp) and (1960.1bp,911.41bp) .. (2105.4bp,900.1bp) .. controls (2191.5bp,893.4bp) and (2285.7bp,886.88bp) .. (LevelBoltzmannFactorLTE);
\draw (2107.12bp,904.05bp) node {$\beta_{\textrm{rad}}$};
\draw [->] (BetaRadiation) ..controls (1684.2bp,924.26bp) and (1714.9bp,902.75bp) .. (1714.9bp,865.1bp) .. controls (1714.9bp,865.1bp) and (1714.9bp,865.1bp) .. (1714.9bp,665.85bp) .. controls (1714.9bp,646.16bp) and (1714.9bp,623.97bp) .. (PhiSahaLTE);
\draw (1717.12bp,751.43bp) node {$\beta_{\textrm{rad}}$};
\draw [->] (JBluesDiluteBlackBody) ..controls (1912.2bp,281.89bp) and (1974.8bp,267.57bp) .. (2030.4bp,256.6bp) .. controls (2061.5bp,250.46bp) and (2094.7bp,244.42bp) .. (TauSobolev);
\draw (2032.12bp,260.55bp) node {$J$};
\draw [->] (JBluesDiluteBlackBody) ..controls (1793.2bp,263.99bp) and (1790.5bp,209.9bp) .. (1818.9bp,178.5bp) .. controls (1886.6bp,103.55bp) and (2166.5bp,55.723bp) .. (TransitionProbabilities);
\draw (1870.12bp,147.2bp) node {$J$};
\draw [->] (Abundance) ..controls (1954.8bp,1074.7bp) and (1945.1bp,979.04bp) .. (1929.9bp,900.1bp) .. controls (1929.4bp,897.75bp) and (1928.9bp,895.32bp) .. (NumberDensity);
\draw (1948.12bp,993.3bp) node {abundance};
\draw [->] (Abundance) ..controls (2055.2bp,1117.2bp) and (2068.9bp,1115.4bp) .. (2081.9bp,1113.9bp) .. controls (2271.5bp,1090.5bp) and (2492.5bp,1067.9bp) .. (SelectedAtoms);
\draw (2390.12bp,1082.55bp) node {abundance};
\draw [->] (NumberDensity) ..controls (2054.9bp,802.54bp) and (2326.7bp,683.69bp) .. (2562.9bp,613.6bp) .. controls (2600.3bp,602.49bp) and (2624.3bp,625.91bp) .. (2648.9bp,595.6bp) .. controls (2666.6bp,573.82bp) and (2661.2bp,540.46bp) .. (IonNumberDensity);
\draw (2454.12bp,662.18bp) node {$N_{i}$};
\draw [->] (SelectedAtoms) ..controls (2788.3bp,1011.0bp) and (2817.9bp,991.8bp) .. (Levels);
\draw (2822.12bp,993.3bp) node {selected-atoms};
\draw [->] (SelectedAtoms) ..controls (2870.0bp,1025.5bp) and (2899.7bp,1017.8bp) .. (2925.9bp,1006.6bp) .. controls (2950.5bp,996.03bp) and (2954.2bp,988.45bp) .. (2974.9bp,971.35bp) .. controls (2992.8bp,956.53bp) and (2991.7bp,944.96bp) .. (3012.9bp,935.35bp) .. controls (3091.3bp,899.78bp) and (3124.0bp,944.11bp) .. (3205.9bp,917.35bp) .. controls (3263.6bp,898.49bp) and (3291.9bp,871.86bp) .. (3291.9bp,811.1bp) .. controls (3291.9bp,811.1bp) and (3291.9bp,811.1bp) .. (3291.9bp,487.35bp) .. controls (3291.9bp,463.47bp) and (3276.7bp,441.02bp) .. (Lines);
\draw (3294.12bp,706.8bp) node {selected-atoms};
\draw [->] (SelectedAtoms) ..controls (2708.0bp,1019.1bp) and (2700.1bp,1012.9bp) .. (2693.4bp,1006.6bp) .. controls (2684.7bp,998.56bp) and (2676.1bp,988.93bp) .. (AtomicMass);
\draw (2695.12bp,993.3bp) node {selected-atoms};
\draw [->] (SelectedAtoms) ..controls (2544.1bp,1012.7bp) and (2358.3bp,985.41bp) .. (IonizationData);
\draw (2499.12bp,993.3bp) node {selected-atoms};
\draw [->] (SelectedAtoms) ..controls (2907.1bp,1029.5bp) and (2960.7bp,1021.0bp) .. (3007.9bp,1006.6bp) .. controls (3024.3bp,1001.6bp) and (3026.4bp,995.62bp) .. (3042.4bp,989.35bp) .. controls (3057.7bp,983.32bp) and (3074.5bp,977.78bp) .. (MacroAtomData);
\draw (3044.12bp,993.3bp) node {selected-atoms};
\draw [->] (Density) ..controls (2243.1bp,924.68bp) and (2100.8bp,898.36bp) .. (NumberDensity);
\draw (2201.12bp,904.05bp) node {$\rho$};
\draw [->] (TimeExplosion) ..controls (2235.0bp,279.05bp) and (2253.7bp,261.68bp) .. (TauSobolev);
\draw (2258.12bp,260.55bp) node {$t_{\textrm{exp}}$};
\draw [->] (TauSobolev) ..controls (2301.4bp,152.46bp) and (2301.1bp,115.51bp) .. (2318.4bp,89.25bp) .. controls (2333.5bp,66.212bp) and (2358.7bp,50.273bp) .. (TransitionProbabilities);
\draw (2320.12bp,102.58bp) node {$\tau_{\textrm{sobolev}}$};
\draw [->] (TauSobolev) ..controls (2373.6bp,163.31bp) and (2399.5bp,145.33bp) .. (BetaSobolev);
\draw (2400.12bp,147.2bp) node {$\tau_{\textrm{sobolev}}$};
\draw [->] (AtomicData) ..controls (3078.6bp,1012.7bp) and (3062.8bp,997.92bp) .. (3045.9bp,989.35bp) .. controls (3021.4bp,976.99bp) and (2992.9bp,968.99bp) .. (Levels);
\draw (3072.12bp,993.3bp) node {atomic-data};
\draw [->] (AtomicData) ..controls (3242.1bp,1013.5bp) and (3329.9bp,987.9bp) .. (3329.9bp,954.35bp) .. controls (3329.9bp,954.35bp) and (3329.9bp,954.35bp) .. (3329.9bp,531.98bp) .. controls (3329.9bp,487.62bp) and (3333.7bp,469.66bp) .. (3305.9bp,435.1bp) .. controls (3301.2bp,429.35bp) and (3295.4bp,424.47bp) .. (Lines);
\draw (3332.12bp,706.8bp) node {atomic-data};
\draw [->] (AtomicData) ..controls (2951.2bp,1012.3bp) and (2817.5bp,986.69bp) .. (AtomicMass);
\draw (2919.12bp,993.3bp) node {atomic-data};
\draw [->] (AtomicData) ..controls (2942.7bp,1026.6bp) and (2860.1bp,1017.6bp) .. (2787.4bp,1006.6bp) .. controls (2747.3bp,1000.5bp) and (2738.1bp,994.09bp) .. (2697.9bp,989.35bp) .. controls (2516.7bp,968.04bp) and (2469.7bp,986.28bp) .. (2287.9bp,971.35bp) .. controls (2275.6bp,970.35bp) and (2262.7bp,969.08bp) .. (IonizationData);
\draw (2789.12bp,993.3bp) node {atomic-data};
\draw [->] (AtomicData) ..controls (3277.1bp,1018.9bp) and (3385.9bp,995.1bp) .. (3385.9bp,954.35bp) .. controls (3385.9bp,954.35bp) and (3385.9bp,954.35bp) .. (3385.9bp,106.25bp) .. controls (3385.9bp,68.247bp) and (2888.7bp,39.233bp) .. (TransitionProbabilities);
\draw (3388.12bp,528.3bp) node {atomic-data};
\draw [->] (AtomicData) ..controls (3123.7bp,1011.8bp) and (3135.1bp,994.61bp) .. (MacroAtomData);
\draw (3140.12bp,993.3bp) node {atomic-data};
\draw [->] (Levels) ..controls (2793.6bp,922.94bp) and (2734.6bp,901.85bp) .. (LevelBoltzmannFactorLTE);
\draw (2777.12bp,904.05bp) node {$\textrm{levels}$};
\draw [->] (Levels) ..controls (2955.6bp,939.11bp) and (2968.1bp,937.14bp) .. (2979.9bp,935.35bp) .. controls (3042.0bp,925.94bp) and (3253.9bp,927.96bp) .. (3253.9bp,865.1bp) .. controls (3253.9bp,865.1bp) and (3253.9bp,865.1bp) .. (3253.9bp,531.98bp) .. controls (3253.9bp,457.1bp) and (3378.1bp,437.56bp) .. (3328.9bp,381.1bp) .. controls (3308.9bp,358.15bp) and (3165.4bp,339.7bp) .. (StimulatedEmissionFactor);
\draw (3256.12bp,617.55bp) node {$\textrm{metastability}$};
\draw [->] (Levels) ..controls (3026.3bp,923.44bp) and (3174.1bp,893.73bp) .. (3196.9bp,882.1bp) .. controls (3207.0bp,876.95bp) and (3215.9bp,876.44bp) .. (3215.9bp,865.1bp) .. controls (3215.9bp,865.1bp) and (3215.9bp,865.1bp) .. (3215.9bp,487.35bp) .. controls (3215.9bp,446.7bp) and (3139.5bp,424.85bp) .. (LevelNumberDensity);
\draw (3218.12bp,662.18bp) node {$\textrm{levels}$};
\draw [->] (Lines) ..controls (3163.4bp,384.1bp) and (3151.8bp,382.35bp) .. (3140.9bp,381.1bp) .. controls (3110.1bp,377.6bp) and (2057.8bp,329.75bp) .. (2026.9bp,327.85bp) .. controls (2000.4bp,326.23bp) and (1972.2bp,324.29bp) .. (JBluesDiluteBlackBody);
\draw (2777.12bp,349.8bp) node {$\nu$};
\draw [->] (Lines) ..controls (3282.9bp,359.29bp) and (3321.2bp,319.4bp) .. (3295.9bp,291.85bp) .. controls (3258.4bp,251.12bp) and (3008.7bp,230.54bp) .. (TauSobolev);
\draw (3306.12bp,305.18bp) node {$\lambda_{cm}$};
\draw [->] (Lines) ..controls (3107.7bp,371.36bp) and (2993.1bp,347.27bp) .. (StimulatedEmissionFactor);
\draw (3066.12bp,349.8bp) node {$\textrm{lines}$};
\draw [->] (AtomicMass) ..controls (2423.9bp,925.39bp) and (2174.3bp,895.47bp) .. (NumberDensity);
\draw (2352.12bp,904.05bp) node {atomic-mass};
\draw [->] (IonizationData) ..controls (1906.5bp,940.63bp) and (1755.9bp,920.35bp) .. (1755.9bp,865.1bp) .. controls (1755.9bp,865.1bp) and (1755.9bp,865.1bp) .. (1755.9bp,665.85bp) .. controls (1755.9bp,643.89bp) and (1745.1bp,621.51bp) .. (PhiSahaLTE);
\draw (1758.12bp,751.43bp) node {ionization-data};
\draw [->] (DilutionFactor) ..controls (666.45bp,369.05bp) and (706.46bp,353.17bp) .. (743.37bp,345.85bp) .. controls (826.55bp,329.36bp) and (1340.2bp,318.44bp) .. (JBluesDiluteBlackBody);
\draw (746.12bp,349.8bp) node {$W$};
\draw [->] (LinkTRadTElectron) ..controls (366.87bp,1012.4bp) and (366.87bp,996.23bp) .. (ElectronTemperature);
\draw (369.12bp,993.3bp) node {$T_{\textrm{electron}}/T_{\textrm{rad}}$};
\draw [->] (GElectron) ..controls (1388.0bp,750.6bp) and (1585.1bp,646.88bp) .. (PhiSahaLTE);
\draw (1480.12bp,706.8bp) node {$g_{\textrm{electron}}$};
\draw [->] (LevelBoltzmannFactorLTE) ..controls (2681.5bp,828.05bp) and (2720.9bp,800.21bp) .. (LevelBoltzmannFactorNoNLTE);
\draw (2731.12bp,805.43bp) node {$bf_{i,j,k}$};
\draw [->] (PhiSahaLTE) ..controls (2079.4bp,542.33bp) and (2355.0bp,516.42bp) .. (IonNumberDensity);
\draw (2264.12bp,528.3bp) node {$\Phi$};
\draw [->] (StimulatedEmissionFactor) ..controls (2658.6bp,277.45bp) and (2552.4bp,256.77bp) .. (TauSobolev);
\draw (2627.12bp,260.55bp) node {stimulated-emission-factor};
\draw [->] (StimulatedEmissionFactor) ..controls (2824.9bp,264.79bp) and (2826.1bp,212.18bp) .. (2800.9bp,178.5bp) .. controls (2740.3bp,97.685bp) and (2629.1bp,56.616bp) .. (TransitionProbabilities);
\draw (2787.12bp,147.2bp) node {stimulated-emission-factor};
\draw [->] (LevelNumberDensity) ..controls (2317.1bp,380.0bp) and (2088.5bp,362.07bp) .. (2057.4bp,327.85bp) .. controls (2019.8bp,286.55bp) and (2067.3bp,258.45bp) .. (TauSobolev);
\draw (2059.12bp,305.18bp) node {$N_{i,j,k}$};
\draw [->] (LevelNumberDensity) ..controls (2803.9bp,368.8bp) and (2808.4bp,352.41bp) .. (StimulatedEmissionFactor);
\draw (2812.12bp,349.8bp) node {$N_{i,j,k}$};
\draw [->] (PartitionFunction) ..controls (2440.5bp,637.94bp) and (2139.0bp,613.28bp) .. (PhiSahaLTE);
\draw (2346.12bp,617.55bp) node {$Z_{i,j}$};
\draw [->] (PartitionFunction) ..controls (2793.8bp,614.27bp) and (2809.1bp,536.35bp) .. (2804.9bp,470.35bp) .. controls (2804.0bp,456.31bp) and (2802.1bp,440.78bp) .. (LevelNumberDensity);
\draw (2806.12bp,528.3bp) node {$Z_{i,j}$};
\draw [->] (PartitionFunction) ..controls (2754.2bp,620.71bp) and (2718.7bp,565.7bp) .. (2681.9bp,524.35bp) .. controls (2678.7bp,520.74bp) and (2675.1bp,517.12bp) .. (IonNumberDensity);
\draw (2738.12bp,572.93bp) node {$Z_{i,j}$};
\draw [->] (IonNumberDensity) ..controls (2696.6bp,456.72bp) and (2730.2bp,437.54bp) .. (LevelNumberDensity);
\draw (2735.12bp,439.05bp) node {$N_{i,j}$};
\draw [->] (BetaSobolev) ..controls (2452.9bp,77.062bp) and (2452.9bp,60.881bp) .. (TransitionProbabilities);
\draw (2455.12bp,57.95bp) node {$\beta_{\textrm{sobolev}}$};
\draw [->] (LevelBoltzmannFactorNoNLTE) ..controls (2965.6bp,726.74bp) and (3051.9bp,703.51bp) .. (3051.9bp,667.85bp) .. controls (3051.9bp,667.85bp) and (3051.9bp,667.85bp) .. (3051.9bp,487.35bp) .. controls (3051.9bp,455.6bp) and (2980.4bp,433.04bp) .. (LevelNumberDensity);
\draw (3054.12bp,572.93bp) node {level-boltzmann-factor};
\draw [->] (LevelBoltzmannFactorNoNLTE) ..controls (2781.9bp,725.92bp) and (2781.9bp,709.73bp) .. (PartitionFunction);
\draw (2784.12bp,706.8bp) node {level-boltzmann-factor};
%
\end{tikzpicture}
% End of code
%
\end{document}
%
If one was to build the .tex file, the following graph will be generated:
[8]:
display(Image('default_plasma_graph.png', unconfined=True))
Note
For the remainder of this tutorial, the contents of the .tex file will be omitted and only the generated graph will be shown.
Plasma Graph with Different Scale¶
One can change the scaling of the graph by passing in a positive, non-zero float into the scale
parameter to either make the resulting graph larger (scale > 0.5) or smaller (scale < 0.5).
[9]:
sim.plasma.write_to_tex("plasma_graph_scaled.tex", scale = 1.25)
With a scale of 1.25, the graph TARDIS will output will look as follows:
[10]:
display(Image('plasma_graph_scaled.png', unconfined=True))
Plasma Graph with No Equations¶
TARDIS has the option to generate a graph without any equations or edge labels via the latex_label
command. The graph in this case will only consist of nodes containing the names of variables used to calculate the plasma state connected with edges.
[11]:
sim.plasma.write_to_tex("plasma_graph_no_eq.tex", latex_label=False)
With these inputs, the graph will look like this:
[12]:
display(Image('plasma_graph_no_eq.png', unconfined=True))
Plasma Graph with Inputted Arguments¶
In order to create the .tex file, TARDIS will first convert the graph into a readable DOT format via the write_to_dot
function. As such, using the args
parameter within the write_to_tex
function, one can pass in any Graphviz attribute for TARDIS to implement as a list. In this example, the following attributes are used:
nodesep: changes spacing of nodes
edge[lblstyle]: edits the edge labels
margin: sets the margins of the outputted graph
ratio: sets the drawing height and width
size: sets the maximum height and width of the graph
For more information on these attributes, visit the Graphviz attributes documentation.
[13]:
attributes_list = [r"nodesep=1.0", r'edge[lblstyle="fill=white"]', r'margin=0', r'ratio="fill"', r'size="8.3,11.7!"']
sim.plasma.write_to_tex("plasma_graph_with_args.tex", args=attributes_list)
With these attributes, the following graph can be generated:
[14]:
display(Image('plasma_graph_args.png', unconfined=True))