You can interact with this notebook online: Launch interactive version
Setup ExampleΒΆ
We show an example of setting up a TARDIS simulation.
[1]:
# We import the necessary packages
from tardis.io.config_reader import Configuration
from tardis.simulation import Simulation
from tardis.io.atom_data.util import download_atom_data
# We download the atomic data needed to run the simulation
download_atom_data('kurucz_cd23_chianti_H_He')
/usr/share/miniconda3/envs/tardis/lib/python3.8/site-packages/setuptools_scm/git.py:105: UserWarning: "/home/runner/work/tardis/tardis" is shallow and may cause errors
warnings.warn(f'"{wd.path}" is shallow and may cause errors')
We read a configuration as shown here:
[2]:
tardis_config = Configuration.from_yaml('tardis_example.yml')
We create a Simulation
object from the configuration using the Simulation.from_config()
class method.
[3]:
sim = Simulation.from_config(tardis_config)
sim
/home/runner/work/tardis/tardis/tardis/plasma/properties/radiative_properties.py:93: RuntimeWarning: invalid value encountered in true_divide
(g_lower * n_upper) / (g_upper * n_lower)
/home/runner/work/tardis/tardis/tardis/plasma/properties/radiative_properties.py:93: RuntimeWarning: invalid value encountered in true_divide
(g_lower * n_upper) / (g_upper * n_lower)
[3]:
<tardis.simulation.base.Simulation at 0x7f90c6f778b0>
When the Simulation
object is created, a Radial1DModel
, BasePlasma
, and MonteCarloRunner
object are created and stored as attributes of the Simulation
object.
[4]:
sim.model
[4]:
<tardis.model.base.Radial1DModel at 0x7f90c919fdf0>
[5]:
sim.plasma
[5]:
<tardis.plasma.base.BasePlasma at 0x7f90c87a26a0>
[6]:
sim.runner
[6]:
<tardis.montecarlo.base.MontecarloRunner at 0x7f90c912fd00>