You can interact with this notebook online: Launch notebook

Setup ExampleΒΆ

We show an example of setting up a TARDIS simulation.

[1]:
# We import the necessary packages
from tardis.io.configuration.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')
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.

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
Number of density points larger than number of shells. Assuming inner point irrelevant
[3]:
<tardis.simulation.base.Simulation at 0x7fba38b1c830>

When the Simulation object is created, a SimulationState, BasePlasma, and MontecarloTransport object are created and stored as attributes of the Simulation object.

[4]:
sim.simulation_state
[4]:
<tardis.model.base.SimulationState at 0x7fba38067e00>
[5]:
sim.plasma
[5]:
<tardis.plasma.base.BasePlasma at 0x7fba38b1e8a0>
[6]:
sim.transport
[6]:
<tardis.transport.montecarlo.base.MonteCarloTransportSolver at 0x7fba1f7f7ec0>