You can interact with this notebook online: Launch notebook

How to Generate 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 import download_atom_data

import networkx as nx

from IPython.core.display import Image, display
/tmp/ipykernel_5009/3202857947.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.io.model.parse_atom_data][INFO   ]

        Reading Atomic Data from kurucz_cd23_chianti_H_He.h5 (parse_atom_data.py:40)
[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:262)
[tardis.io.atom_data.base][INFO   ]
        Non provided Atomic Data: synpp_refs, photoionization_data, yg_data, two_photon_data, linelist_atoms, linelist_molecules (base.py:266)
[tardis.io.model.parse_density_configuration][WARNING]
        Number of density points larger than number of shells. Assuming inner point irrelevant (parse_density_configuration.py:114)
[tardis.model.matter.decay][INFO   ]
        Decaying abundances for 1123200.0 seconds (decay.py:101)
[tardis.simulation.base][INFO   ]

        Starting iteration 1 of 20 (base.py:450)
[py.warnings         ][WARNING]
        /home/runner/work/tardis/tardis/tardis/transport/montecarlo/montecarlo_main_loop.py:123: NumbaTypeSafetyWarning: unsafe cast from uint64 to int64. Precision may be lost.
  vpacket_collection = vpacket_collections[i]
 (warnings.py:112)
[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:663)
[tardis.simulation.base][INFO   ]

        Plasma stratification: (base.py:631)
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:658)
[tardis.simulation.base][INFO   ]

        Starting iteration 2 of 20 (base.py:450)
[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:663)
[tardis.simulation.base][INFO   ]

        Plasma stratification: (base.py:631)
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:658)
[tardis.simulation.base][INFO   ]

        Starting iteration 3 of 20 (base.py:450)
[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:663)
[tardis.simulation.base][INFO   ]
        Iteration converged 1/4 consecutive times. (base.py:262)
[tardis.simulation.base][INFO   ]

        Plasma stratification: (base.py:631)
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:658)
[tardis.simulation.base][INFO   ]

        Starting iteration 4 of 20 (base.py:450)
[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:663)
[tardis.simulation.base][INFO   ]
        Iteration converged 2/4 consecutive times. (base.py:262)
[tardis.simulation.base][INFO   ]

        Plasma stratification: (base.py:631)
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:658)
[tardis.simulation.base][INFO   ]

        Starting iteration 5 of 20 (base.py:450)
[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:663)
[tardis.simulation.base][INFO   ]
        Iteration converged 3/4 consecutive times. (base.py:262)
[tardis.simulation.base][INFO   ]

        Plasma stratification: (base.py:631)
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:658)
[tardis.simulation.base][INFO   ]

        Starting iteration 6 of 20 (base.py:450)
[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:663)
[tardis.simulation.base][INFO   ]
        Iteration converged 4/4 consecutive times. (base.py:262)
[tardis.simulation.base][INFO   ]

        Plasma stratification: (base.py:631)
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:658)
[tardis.simulation.base][INFO   ]

        Starting iteration 7 of 20 (base.py:450)
[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:663)
[tardis.simulation.base][INFO   ]
        Iteration converged 5/4 consecutive times. (base.py:262)
[tardis.simulation.base][INFO   ]

        Plasma stratification: (base.py:631)
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:658)
[tardis.simulation.base][INFO   ]

        Starting iteration 8 of 20 (base.py:450)
[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:663)
[tardis.simulation.base][INFO   ]
        Iteration converged 6/4 consecutive times. (base.py:262)
[tardis.simulation.base][INFO   ]

        Plasma stratification: (base.py:631)
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:658)
[tardis.simulation.base][INFO   ]

        Starting iteration 9 of 20 (base.py:450)
[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:663)
[tardis.simulation.base][INFO   ]
        Iteration converged 7/4 consecutive times. (base.py:262)
[tardis.simulation.base][INFO   ]

        Plasma stratification: (base.py:631)
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:658)
[tardis.simulation.base][INFO   ]

        Starting iteration 10 of 20 (base.py:450)
[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:663)
[tardis.simulation.base][INFO   ]
        Iteration converged 8/4 consecutive times. (base.py:262)
[tardis.simulation.base][INFO   ]

        Plasma stratification: (base.py:631)
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:658)
[tardis.simulation.base][INFO   ]

        Starting iteration 11 of 20 (base.py:450)
[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:663)
[tardis.simulation.base][INFO   ]
        Iteration converged 9/4 consecutive times. (base.py:262)
[tardis.simulation.base][INFO   ]

        Plasma stratification: (base.py:631)
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:658)
[tardis.simulation.base][INFO   ]

        Starting iteration 12 of 20 (base.py:450)
[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:663)
[tardis.simulation.base][INFO   ]
        Iteration converged 10/4 consecutive times. (base.py:262)
[tardis.simulation.base][INFO   ]

        Plasma stratification: (base.py:631)
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:658)
[tardis.simulation.base][INFO   ]

        Starting iteration 13 of 20 (base.py:450)
[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:663)
[tardis.simulation.base][INFO   ]
        Iteration converged 11/4 consecutive times. (base.py:262)
[tardis.simulation.base][INFO   ]

        Plasma stratification: (base.py:631)
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:658)
[tardis.simulation.base][INFO   ]

        Starting iteration 14 of 20 (base.py:450)
[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:663)
[tardis.simulation.base][INFO   ]
        Iteration converged 12/4 consecutive times. (base.py:262)
[tardis.simulation.base][INFO   ]

        Plasma stratification: (base.py:631)
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:658)
[tardis.simulation.base][INFO   ]

        Starting iteration 15 of 20 (base.py:450)
[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:663)
[tardis.simulation.base][INFO   ]
        Iteration converged 13/4 consecutive times. (base.py:262)
[tardis.simulation.base][INFO   ]

        Plasma stratification: (base.py:631)
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:658)
[tardis.simulation.base][INFO   ]

        Starting iteration 16 of 20 (base.py:450)
[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:663)
[tardis.simulation.base][INFO   ]
        Iteration converged 14/4 consecutive times. (base.py:262)
[tardis.simulation.base][INFO   ]

        Plasma stratification: (base.py:631)
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:658)
[tardis.simulation.base][INFO   ]

        Starting iteration 17 of 20 (base.py:450)
[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:663)
[tardis.simulation.base][INFO   ]
        Iteration converged 15/4 consecutive times. (base.py:262)
[tardis.simulation.base][INFO   ]

        Plasma stratification: (base.py:631)
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:658)
[tardis.simulation.base][INFO   ]

        Starting iteration 18 of 20 (base.py:450)
[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:663)
[tardis.simulation.base][INFO   ]
        Iteration converged 16/4 consecutive times. (base.py:262)
[tardis.simulation.base][INFO   ]

        Plasma stratification: (base.py:631)
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:658)
[tardis.simulation.base][INFO   ]

        Starting iteration 19 of 20 (base.py:450)
[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:663)
[tardis.simulation.base][INFO   ]
        Iteration converged 17/4 consecutive times. (base.py:262)
[tardis.simulation.base][INFO   ]

        Plasma stratification: (base.py:631)
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:658)
[tardis.simulation.base][INFO   ]

        Simulation finished in 19 iterations
        Simulation took 59.67 s
 (base.py:548)
[tardis.simulation.base][INFO   ]

        Starting iteration 20 of 20 (base.py:450)
[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:663)

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
../../_images/io_output_how_to_plasma_graph_7_1.svg

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)
../../_images/io_output_how_to_plasma_graph_9_0.svg

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 (DilutePlanckianRadField) at (726.87bp,1150.6bp) [draw,ellipse] {$\textrm{DilutePlanckianRadField}$};
  \node (TRadiative) at (972.87bp,1061.4bp) [draw,ellipse] {$\textrm{TRadiative}$};
  \node (DilutionFactor) at (712.87bp,1061.4bp) [draw,ellipse] {$\textrm{DilutionFactor}$};
  \node (ElectronTemperature) at (366.87bp,972.1bp) [draw,ellipse] {$\textrm{ElectronTemperature: }\textrm{const.}\times T_{\textrm{rad}}$};
  \node (BetaRadiation) at (1103.9bp,972.1bp) [draw,ellipse] {$\textrm{BetaRadiation: }\dfrac{1}{k_{B} T_{\textrm{rad}}}$};
  \node (NumberDensity) at (1745.9bp,1150.6bp) [draw,ellipse] {$\textrm{NumberDensity}$};
  \node (SelectedAtoms) at (2421.9bp,1061.4bp) [draw,ellipse] {$\textrm{SelectedAtoms}$};
  \node (IonNumberDensity) at (2183.9bp,488.35bp) [draw,ellipse] {$\textrm{IonNumberDensity}$};
  \node (Levels) at (2176.9bp,972.1bp) [draw,ellipse] {$\textrm{Levels}$};
  \node (Lines) at (2797.9bp,918.1bp) [draw,ellipse] {$\textrm{Lines}$};
  \node (IonizationData) at (1937.9bp,972.1bp) [draw,ellipse] {$\textrm{IonizationData}$};
  \node (MacroAtomData) at (2462.9bp,972.1bp) [draw,ellipse] {$\textrm{MacroAtomData}$};
  \node (LevelNumberDensity) at (2333.9bp,399.1bp) [draw,ellipse] {$\textrm{LevelNumberDensity: }N_{i,j}\dfrac{bf_{i,j,k}}{Z_{i,j}}$};
  \node (TimeExplosion) at (3223.9bp,309.85bp) [draw,ellipse] {$\textrm{TimeExplosion}$};
  \node (TauSobolev) at (2867.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 (2563.9bp,18.0bp) [draw,ellipse] {$\textrm{TransitionProbabilities}$};
  \node (BetaSobolev) at (2706.9bp,107.25bp) [draw,ellipse] {$\textrm{BetaSobolev}$};
  \node (AtomicData) at (2154.9bp,1061.4bp) [draw,ellipse] {$\textrm{AtomicData}$};
  \node (LevelBoltzmannFactorLTE) at (2075.9bp,864.1bp) [draw,ellipse] {$\textrm{LevelBoltzmannFactorLTE: }g_{i,j,k}e^{\dfrac{-\epsilon_{i,j,k}}{k_{\textrm{B}}T_{\textrm{rad}}}}$};
  \node (StimulatedEmissionFactor) at (2606.9bp,309.85bp) [draw,ellipse] {$\textrm{StimulatedEmissionFactor: }1-\dfrac{g_{lower}n_{upper}}{g_{upper}n_{lower}}$};
  \node (PhiSahaLTE) at (1332.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 (JBlues) at (2934.9bp,107.25bp) [draw,ellipse] {$\textrm{JBlues}$};
  \node (LinkTRadTElectron) at (366.87bp,1061.4bp) [draw,ellipse] {$\textrm{LinkTRadTElectron}$};
  \node (HeliumTreatment) at (2047.9bp,1150.6bp) [draw,ellipse] {$\textrm{HeliumTreatment}$};
  \node (ContinuumInteractionSpecies) at (2419.9bp,1150.6bp) [draw,ellipse] {$\textrm{ContinuumInteractionSpecies}$};
  \node (NLTEIonizationSpecies) at (2818.9bp,1150.6bp) [draw,ellipse] {$\textrm{NLTEIonizationSpecies}$};
  \node (NLTEExcitationSpecies) at (3185.9bp,1150.6bp) [draw,ellipse] {$\textrm{NLTEExcitationSpecies}$};
  \node (GElectron) at (916.87bp,810.1bp) [draw,ellipse] {$\textrm{GElectron: }\Big(\dfrac{2\pi m_{e}/\beta_{\textrm{rad}}}{h^2}\Big)^{3/2}$};
  \node (LevelBoltzmannFactorNoNLTE) at (2140.9bp,756.1bp) [draw,ellipse] {$\textrm{LevelBoltzmannFactorNoNLTE}$};
  \node (PartitionFunction) at (2140.9bp,666.85bp) [draw,ellipse] {$\textrm{PartitionFunction: }\sum_{k}bf_{i,j,k}$};
  \draw [->] (DilutePlanckianRadField) ..controls (815.24bp,1118.3bp) and (874.39bp,1097.3bp)  .. (TRadiative);
  \definecolor{strokecol}{rgb}{0.0,0.0,0.0};
  \pgfsetstrokecolor{strokecol}
  \draw (874.12bp,1101.3bp) node {dilute-planckian-radiation-field};
  \draw [->] (DilutePlanckianRadField) ..controls (722.21bp,1120.5bp) and (719.65bp,1104.6bp)  .. (DilutionFactor);
  \draw (724.12bp,1101.3bp) node {dilute-planckian-radiation-field};
  \draw [->] (TRadiative) ..controls (789.18bp,1033.9bp) and (612.58bp,1008.5bp)  .. (ElectronTemperature);
  \draw (727.12bp,1012.05bp) node {$T_{\textrm{rad}}$};
  \draw [->] (TRadiative) ..controls (1018.1bp,1030.2bp) and (1046.2bp,1011.5bp)  .. (BetaRadiation);
  \draw (1052.12bp,1012.05bp) node {$T_{\textrm{rad}}$};
  \draw [->] (NumberDensity) ..controls (1966.8bp,1121.1bp) and (2186.7bp,1092.7bp)  .. (SelectedAtoms);
  \draw (2146.12bp,1101.3bp) node {$N_{i}$};
  \draw [->] (NumberDensity) ..controls (1553.4bp,1127.0bp) and (1445.9bp,1103.9bp)  .. (1445.9bp,1062.4bp) .. controls (1445.9bp,1062.4bp) and (1445.9bp,1062.4bp)  .. (1445.9bp,809.1bp) .. controls (1445.9bp,775.79bp) and (1445.0bp,760.25bp)  .. (1469.9bp,738.1bp) .. controls (1612.4bp,611.25bp) and (1701.9bp,682.05bp)  .. (1889.9bp,648.85bp) .. controls (1973.2bp,634.14bp) and (2211.4bp,659.48bp)  .. (2266.9bp,595.6bp) .. controls (2290.9bp,567.94bp) and (2254.5bp,534.38bp)  .. (IonNumberDensity);
  \draw (1448.12bp,805.43bp) node {$N_{i}$};
  \draw [->] (SelectedAtoms) ..controls (2385.4bp,1031.6bp) and (2364.0bp,1016.9bp)  .. (2342.9bp,1008.1bp) .. controls (2317.6bp,997.52bp) and (2288.7bp,990.0bp)  .. (Levels);
  \draw (2377.12bp,1012.05bp) node {selected-atoms};
  \draw [->] (SelectedAtoms) ..controls (2505.0bp,1029.9bp) and (2562.2bp,1008.8bp)  .. (2611.9bp,990.1bp) .. controls (2657.8bp,972.84bp) and (2710.0bp,952.89bp)  .. (Lines);
  \draw (2565.12bp,1012.05bp) node {selected-atoms};
  \draw [->] (SelectedAtoms) ..controls (2306.9bp,1034.1bp) and (2237.3bp,1019.1bp)  .. (2175.9bp,1008.1bp) .. controls (2131.9bp,1000.2bp) and (2083.1bp,992.8bp)  .. (IonizationData);
  \draw (2266.12bp,1012.05bp) node {selected-atoms};
  \draw [->] (SelectedAtoms) ..controls (2435.7bp,1030.9bp) and (2443.5bp,1014.3bp)  .. (MacroAtomData);
  \draw (2448.12bp,1012.05bp) node {selected-atoms};
  \draw [->] (IonNumberDensity) ..controls (2236.3bp,456.84bp) and (2268.9bp,437.87bp)  .. (LevelNumberDensity);
  \draw (2274.12bp,439.05bp) node {$N_{i,j}$};
  \draw [->] (TimeExplosion) ..controls (3118.3bp,279.39bp) and (3044.3bp,258.77bp)  .. (TauSobolev);
  \draw (3090.12bp,260.55bp) node {$t_{\textrm{exp}}$};
  \draw [->] (TauSobolev) ..controls (2648.2bp,166.22bp) and (2591.0bp,147.85bp)  .. (2572.4bp,125.25bp) .. controls (2554.7bp,103.85bp) and (2554.8bp,71.091bp)  .. (TransitionProbabilities);
  \draw (2574.12bp,102.58bp) node {$\tau_{\textrm{sobolev}}$};
  \draw [->] (TauSobolev) ..controls (2796.0bp,163.24bp) and (2766.7bp,145.17bp)  .. (BetaSobolev);
  \draw (2789.12bp,147.2bp) node {$\tau_{\textrm{sobolev}}$};
  \draw [->] (AtomicData) ..controls (2162.2bp,1031.2bp) and (2166.3bp,1015.0bp)  .. (Levels);
  \draw (2169.12bp,1012.05bp) node {atomic-data};
  \draw [->] (AtomicData) ..controls (2245.4bp,1042.2bp) and (2260.5bp,1035.2bp)  .. (2272.9bp,1025.4bp) .. controls (2301.5bp,1002.7bp) and (2282.7bp,973.11bp)  .. (2313.9bp,954.1bp) .. controls (2351.4bp,931.25bp) and (2665.2bp,941.24bp)  .. (2708.9bp,936.1bp) .. controls (2715.3bp,935.35bp) and (2721.9bp,934.4bp)  .. (Lines);
  \draw (2288.12bp,1012.05bp) node {atomic-data};
  \draw [->] (AtomicData) ..controls (2079.0bp,1029.8bp) and (2027.6bp,1009.2bp)  .. (IonizationData);
  \draw (2067.12bp,1012.05bp) node {atomic-data};
  \draw [->] (AtomicData) ..controls (1721.0bp,1040.1bp) and (795.36bp,996.31bp)  .. (780.87bp,990.1bp) .. controls (759.49bp,980.94bp) and (761.93bp,967.45bp)  .. (742.87bp,954.1bp) .. controls (640.31bp,882.27bp) and (575.49bp,920.41bp)  .. (490.87bp,828.1bp) .. controls (396.46bp,725.11bp) and (379.87bp,673.7bp)  .. (379.87bp,533.98bp) .. controls (379.87bp,533.98bp) and (379.87bp,533.98bp)  .. (379.87bp,106.25bp) .. controls (379.87bp,56.294bp) and (1858.4bp,29.478bp)  .. (TransitionProbabilities);
  \draw (383.12bp,528.3bp) node {atomic-data};
  \draw [->] (AtomicData) ..controls (2251.5bp,1041.3bp) and (2279.2bp,1034.1bp)  .. (2303.9bp,1025.4bp) .. controls (2320.4bp,1019.5bp) and (2323.0bp,1014.4bp)  .. (2339.4bp,1008.1bp) .. controls (2355.3bp,1002.0bp) and (2372.6bp,996.49bp)  .. (MacroAtomData);
  \draw (2341.12bp,1012.05bp) node {atomic-data};
  \draw [->] (Levels) ..controls (2144.3bp,936.94bp) and (2119.0bp,910.32bp)  .. (LevelBoltzmannFactorLTE);
  \draw (2143.12bp,913.43bp) node {$\textrm{levels}$};
  \draw [->] (Levels) ..controls (2259.1bp,957.84bp) and (2273.9bp,955.77bp)  .. (2287.9bp,954.1bp) .. controls (2380.4bp,943.04bp) and (2697.9bp,958.34bp)  .. (2697.9bp,865.1bp) .. controls (2697.9bp,865.1bp) and (2697.9bp,865.1bp)  .. (2697.9bp,398.1bp) .. controls (2697.9bp,370.53bp) and (2675.8bp,348.96bp)  .. (StimulatedEmissionFactor);
  \draw (2700.12bp,617.55bp) node {$\textrm{metastability}$};
  \draw [->] (Levels) ..controls (2365.4bp,940.36bp) and (2605.8bp,899.46bp)  .. (2640.9bp,882.1bp) .. controls (2651.0bp,877.08bp) and (2659.9bp,876.44bp)  .. (2659.9bp,865.1bp) .. controls (2659.9bp,865.1bp) and (2659.9bp,865.1bp)  .. (2659.9bp,487.35bp) .. controls (2659.9bp,451.26bp) and (2584.4bp,429.7bp)  .. (LevelNumberDensity);
  \draw (2662.12bp,662.18bp) node {$\textrm{levels}$};
  \draw [->] (Lines) ..controls (3036.4bp,897.39bp) and (3383.9bp,862.05bp)  .. (3383.9bp,811.1bp) .. controls (3383.9bp,811.1bp) and (3383.9bp,811.1bp)  .. (3383.9bp,308.85bp) .. controls (3383.9bp,269.21bp) and (3324.4bp,245.04bp)  .. (TauSobolev);
  \draw (3386.12bp,572.93bp) node {$\lambda_{cm}$};
  \draw [->] (Lines) ..controls (2780.4bp,879.32bp) and (2766.9bp,843.51bp)  .. (2766.9bp,811.1bp) .. controls (2766.9bp,811.1bp) and (2766.9bp,811.1bp)  .. (2766.9bp,398.1bp) .. controls (2766.9bp,365.41bp) and (2740.8bp,344.9bp)  .. (StimulatedEmissionFactor);
  \draw (2769.12bp,617.55bp) node {$\textrm{lines}$};
  \draw [->] (IonizationData) ..controls (1689.9bp,964.72bp) and (1528.2bp,956.05bp)  .. (1505.9bp,936.1bp) .. controls (1481.9bp,914.69bp) and (1491.9bp,897.27bp)  .. (1491.9bp,865.1bp) .. controls (1491.9bp,865.1bp) and (1491.9bp,865.1bp)  .. (1491.9bp,665.85bp) .. controls (1491.9bp,633.32bp) and (1466.0bp,612.84bp)  .. (PhiSahaLTE);
  \draw (1494.12bp,751.43bp) node {ionization-data};
  \draw [->] (JBlues) ..controls (2815.2bp,78.109bp) and (2713.3bp,54.147bp)  .. (TransitionProbabilities);
  \draw (2784.12bp,57.95bp) node {$J_{\textrm{blue}}$};
  \draw [->] (LinkTRadTElectron) ..controls (366.87bp,1031.3bp) and (366.87bp,1015.3bp)  .. (ElectronTemperature);
  \draw (369.12bp,1012.05bp) node {$T_{\textrm{electron}}/T_{\textrm{rad}}$};
  \draw [->] (BetaRadiation) ..controls (1050.2bp,925.18bp) and (984.0bp,868.54bp)  .. (GElectron);
  \draw (1062.12bp,913.43bp) node {$\beta_{\textrm{rad}}$};
  \draw [->] (BetaRadiation) ..controls (1422.8bp,936.33bp) and (1724.1bp,903.47bp)  .. (LevelBoltzmannFactorLTE);
  \draw (1735.12bp,913.43bp) node {$\beta_{\textrm{rad}}$};
  \draw [->] (BetaRadiation) ..controls (1312.0bp,941.91bp) and (1354.9bp,915.13bp)  .. (1354.9bp,865.1bp) .. controls (1354.9bp,865.1bp) and (1354.9bp,865.1bp)  .. (1354.9bp,665.85bp) .. controls (1354.9bp,645.67bp) and (1349.3bp,623.64bp)  .. (PhiSahaLTE);
  \draw (1357.12bp,751.43bp) node {$\beta_{\textrm{rad}}$};
  \draw [->] (GElectron) ..controls (1022.2bp,750.72bp) and (1208.5bp,647.51bp)  .. (PhiSahaLTE);
  \draw (1109.12bp,706.8bp) node {$g_{\textrm{electron}}$};
  \draw [->] (LevelBoltzmannFactorLTE) ..controls (2096.6bp,829.33bp) and (2112.4bp,803.51bp)  .. (LevelBoltzmannFactorNoNLTE);
  \draw (2120.12bp,805.43bp) node {$bf_{i,j,k}$};
  \draw [->] (PhiSahaLTE) ..controls (1665.1bp,542.54bp) and (1912.3bp,517.2bp)  .. (IonNumberDensity);
  \draw (1836.12bp,528.3bp) node {$\Phi$};
  \draw [->] (StimulatedEmissionFactor) ..controls (2687.9bp,278.01bp) and (2737.8bp,259.03bp)  .. (TauSobolev);
  \draw (2739.12bp,260.55bp) node {stimulated-emission-factor};
  \draw [->] (StimulatedEmissionFactor) ..controls (2456.7bp,279.55bp) and (2393.6bp,261.26bp)  .. (2376.9bp,238.6bp) .. controls (2321.0bp,163.13bp) and (2447.3bp,80.388bp)  .. (TransitionProbabilities);
  \draw (2387.12bp,147.2bp) node {stimulated-emission-factor};
  \draw [->] (LevelNumberDensity) ..controls (2163.0bp,365.41bp) and (2086.2bp,336.79bp)  .. (2126.4bp,291.85bp) .. controls (2152.7bp,262.45bp) and (2322.0bp,242.39bp)  .. (TauSobolev);
  \draw (2128.12bp,305.18bp) node {$N_{i,j,k}$};
  \draw [->] (LevelNumberDensity) ..controls (2432.1bp,366.72bp) and (2494.9bp,346.65bp)  .. (StimulatedEmissionFactor);
  \draw (2496.12bp,349.8bp) node {$N_{i,j,k}$};
  \draw [->] (PartitionFunction) ..controls (2251.9bp,639.22bp) and (2282.3bp,622.53bp)  .. (2299.9bp,595.6bp) .. controls (2317.2bp,569.07bp) and (2318.8bp,549.77bp)  .. (2299.9bp,524.35bp) .. controls (2295.3bp,518.23bp) and (2289.7bp,513.13bp)  .. (IonNumberDensity);
  \draw (2315.12bp,572.93bp) node {$Z_{i,j}$};
  \draw [->] (PartitionFunction) ..controls (1869.5bp,636.55bp) and (1653.6bp,613.24bp)  .. (PhiSahaLTE);
  \draw (1811.12bp,617.55bp) node {$Z_{i,j}$};
  \draw [->] (PartitionFunction) ..controls (2276.9bp,640.19bp) and (2305.9bp,623.36bp)  .. (2321.9bp,595.6bp) .. controls (2350.1bp,546.48bp) and (2350.7bp,526.83bp)  .. (2345.9bp,470.35bp) .. controls (2344.7bp,456.38bp) and (2342.2bp,441.02bp)  .. (LevelNumberDensity);
  \draw (2349.12bp,528.3bp) node {$Z_{i,j}$};
  \draw [->] (BetaSobolev) ..controls (2657.2bp,75.935bp) and (2625.9bp,56.859bp)  .. (TransitionProbabilities);
  \draw (2650.12bp,57.95bp) node {$\beta_{\textrm{sobolev}}$};
  \draw [->] (LevelBoltzmannFactorNoNLTE) ..controls (2324.6bp,726.74bp) and (2410.9bp,703.51bp)  .. (2410.9bp,667.85bp) .. controls (2410.9bp,667.85bp) and (2410.9bp,667.85bp)  .. (2410.9bp,487.35bp) .. controls (2410.9bp,461.37bp) and (2391.4bp,439.47bp)  .. (LevelNumberDensity);
  \draw (2413.12bp,572.93bp) node {level-boltzmann-factor};
  \draw [->] (LevelBoltzmannFactorNoNLTE) ..controls (2140.9bp,726.04bp) and (2140.9bp,710.06bp)  .. (PartitionFunction);
  \draw (2143.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))
../../_images/io_output_how_to_plasma_graph_20_0.png

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))
../../_images/io_output_how_to_plasma_graph_26_0.png

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))
../../_images/io_output_how_to_plasma_graph_30_0.png

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))
../../_images/io_output_how_to_plasma_graph_34_0.png