{ "cells": [ { "attachments": {}, "cell_type": "markdown", "id": "77634745", "metadata": {}, "source": [ "# Setup Example\n", "\n", "We show an example of setting up a TARDIS simulation." ] }, { "cell_type": "code", "execution_count": null, "id": "b878b9ac", "metadata": {}, "outputs": [], "source": [ "# We import the necessary packages\n", "from tardis.io.configuration.config_reader import Configuration\n", "from tardis.simulation import Simulation\n", "from tardis.io.atom_data.util import download_atom_data\n", "\n", "# We download the atomic data needed to run the simulation\n", "download_atom_data('kurucz_cd23_chianti_H_He')" ] }, { "attachments": {}, "cell_type": "markdown", "id": "97737e54", "metadata": {}, "source": [ "We read a configuration as shown [here](../../io/configuration/tutorial_read_configuration.ipynb):" ] }, { "cell_type": "code", "execution_count": null, "id": "571822b0", "metadata": {}, "outputs": [], "source": [ "tardis_config = Configuration.from_yaml('tardis_example.yml')" ] }, { "attachments": {}, "cell_type": "markdown", "id": "168f583c", "metadata": {}, "source": [ "We create a `Simulation` object from the configuration using the `Simulation.from_config()` class method." ] }, { "cell_type": "code", "execution_count": null, "id": "5d1319c1", "metadata": {}, "outputs": [], "source": [ "sim = Simulation.from_config(tardis_config)\n", "sim" ] }, { "attachments": {}, "cell_type": "markdown", "id": "e3f86364", "metadata": {}, "source": [ "When the `Simulation` object is created, a `SimulationState`, `BasePlasma`, and `MontecarloTransport` object are created and stored as attributes of the `Simulation` object." ] }, { "cell_type": "code", "execution_count": null, "id": "bdce8943", "metadata": {}, "outputs": [], "source": [ "sim.simulation_state" ] }, { "cell_type": "code", "execution_count": null, "id": "23996e7e", "metadata": {}, "outputs": [], "source": [ "sim.plasma" ] }, { "cell_type": "code", "execution_count": null, "id": "ae4812ff", "metadata": {}, "outputs": [], "source": [ "sim.transport" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.12" } }, "nbformat": 4, "nbformat_minor": 5 }