diff --git a/docs/contributing/in_progress/nebular_phase/gammaray_deposition.ipynb b/docs/contributing/in_progress/nebular_phase/gammaray_deposition.ipynb index d3ea13ee1d1..8c36359faea 100644 --- a/docs/contributing/in_progress/nebular_phase/gammaray_deposition.ipynb +++ b/docs/contributing/in_progress/nebular_phase/gammaray_deposition.ipynb @@ -42,7 +42,7 @@ "import numpy as np\n", "\n", "import matplotlib.pyplot as plt\n", - "from tardis.model import Radial1DModel\n", + "from tardis.model import SimulationState\n", "from tardis.io.config_reader import Configuration\n", "\n", "from tardis.plasma.properties import Density, Abundance, IsotopeAbundance, IsotopeNumberDensity, AtomicData, AtomicMass, IsotopeMass, NumberDensity, SelectedAtoms\n", @@ -60,7 +60,7 @@ "\n", "config.atom_data = \"kurucz_cd23_chianti_H_He.h5\"\n", "\n", - "model = Radial1DModel.from_config(config)\n", + "model = SimulationState.from_config(config)\n", "\n", "# Construct plasma\n", "input = [Density, Abundance, IsotopeAbundance, AtomicData, AtomicMass, IsotopeNumberDensity, NumberDensity, SelectedAtoms, IsotopeMass]\n", diff --git a/docs/io/grid/TardisGridTutorial.ipynb b/docs/io/grid/TardisGridTutorial.ipynb index 2791937c538..b3eed9f12e8 100644 --- a/docs/io/grid/TardisGridTutorial.ipynb +++ b/docs/io/grid/TardisGridTutorial.ipynb @@ -118,7 +118,7 @@ "source": [ "## TARDIS Grid Functionality\n", "\n", - "The TARDIS Grid provides a variety of functions for using the grid to generate new Configurations, return new Radial1DModel objects, or directly run simulations using the parameters specified by the grid. This functionality is particularly useful for running large numbers of simulations and easily works with JobArrays where the row_index is the JobArray index." + "The TARDIS Grid provides a variety of functions for using the grid to generate new Configurations, return new SimulationState objects, or directly run simulations using the parameters specified by the grid. This functionality is particularly useful for running large numbers of simulations and easily works with JobArrays where the row_index is the JobArray index." ] }, { @@ -144,7 +144,7 @@ "# In case a user needs to make more complicated changes\n", "# to the base TARDIS model (i.e. using parameters that \n", "# are not valid TARDIS Configuration keys), the grid\n", - "# can return a Radial1DModel object for a given row.\n", + "# can return a SimulationState object for a given row.\n", "model = tg.grid_row_to_model(row_index=0)\n", "model" ] diff --git a/docs/io/optional/callback_example.ipynb b/docs/io/optional/callback_example.ipynb index c9b67f2f884..488aa27392f 100644 --- a/docs/io/optional/callback_example.ipynb +++ b/docs/io/optional/callback_example.ipynb @@ -25,8 +25,8 @@ "outputs": [], "source": [ "def average_temp(sim):\n", - " t_rads = sim.model.t_rad\n", - " volumes = sim.model.volume\n", + " t_rads = sim.simulation_state.t_rad\n", + " volumes = sim.simulation_state.volume\n", " avg = sum(t_rads*volumes) / sum(volumes)\n", " print(f\"Average temperature for iteration {sim.iterations_executed}: {avg}\")" ] diff --git a/docs/io/output/physical_quantities.ipynb b/docs/io/output/physical_quantities.ipynb index 0eb2aee8e83..85f64b1ec48 100644 --- a/docs/io/output/physical_quantities.ipynb +++ b/docs/io/output/physical_quantities.ipynb @@ -111,7 +111,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Several important quantities that were setup when the model was defined by the configuration file are located in the `model` section of the simulation. For example, the inner and outer velocity boundaries of the zones in the model is given by `simulation.model.v_inner.cgs` and `simulation.model.v_outer.cgs` respectively. These exist as Astropy [Quantities](http://astropy.readthedocs.org/en/v0.2.1/_generated/astropy.units.quantity.Quantity.html)." + "Several important quantities that were setup when the model was defined by the configuration file are located in the `model` section of the simulation. For example, the inner and outer velocity boundaries of the zones in the model is given by `simulation.simulation_state.v_inner.cgs` and `simulation.simulation_state.v_outer.cgs` respectively. These exist as Astropy [Quantities](http://astropy.readthedocs.org/en/v0.2.1/_generated/astropy.units.quantity.Quantity.html)." ] }, { @@ -120,7 +120,7 @@ "metadata": {}, "outputs": [], "source": [ - "simulation.model.v_inner.cgs" + "simulation.simulation_state.v_inner.cgs" ] }, { @@ -129,14 +129,14 @@ "metadata": {}, "outputs": [], "source": [ - "simulation.model.v_outer.cgs" + "simulation.simulation_state.v_outer.cgs" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "The average density in the zones is given by `simulation.model.density.cgs`. These also exist as Astropy [Quantities](http://astropy.readthedocs.org/en/v0.2.1/_generated/astropy.units.quantity.Quantity.html)." + "The average density in the zones is given by `simulation.simulation_state.density.cgs`. These also exist as Astropy [Quantities](http://astropy.readthedocs.org/en/v0.2.1/_generated/astropy.units.quantity.Quantity.html)." ] }, { @@ -145,7 +145,7 @@ "metadata": {}, "outputs": [], "source": [ - "simulation.model.density.cgs" + "simulation.simulation_state.density.cgs" ] }, { diff --git a/docs/io/output/to_hdf.ipynb b/docs/io/output/to_hdf.ipynb index ed81072fbfb..0888948c7c7 100644 --- a/docs/io/output/to_hdf.ipynb +++ b/docs/io/output/to_hdf.ipynb @@ -108,7 +108,7 @@ "metadata": {}, "outputs": [], "source": [ - "print(data['/simulation/model/density'])" + "print(data['/simulation/simulation_state/density'])" ] }, { @@ -127,7 +127,7 @@ "metadata": {}, "outputs": [], "source": [ - "print(data['/simulation/model/scalars']['t_inner'])" + "print(data['/simulation/simulation_state/scalars']['t_inner'])" ] }, { @@ -209,7 +209,7 @@ "metadata": {}, "source": [ "### Model\n", - "The following call will store properties of the `Radial1DModel` to `/tmp/model_output.hdf` under `/model`." + "The following call will store properties of the `SimulationState` to `/tmp/model_output.hdf` under `/simulation_state`." ] }, { @@ -218,7 +218,7 @@ "metadata": {}, "outputs": [], "source": [ - "simulation.model.to_hdf('/tmp/model_output.hdf', overwrite=True)" + "simulation.simulation_state.to_hdf('/tmp/model_output.hdf', overwrite=True)" ] }, { diff --git a/docs/io/visualization/montecarlo_packet_visualization.ipynb b/docs/io/visualization/montecarlo_packet_visualization.ipynb index c33c7e4b5fd..fe46b67b745 100644 --- a/docs/io/visualization/montecarlo_packet_visualization.ipynb +++ b/docs/io/visualization/montecarlo_packet_visualization.ipynb @@ -235,8 +235,8 @@ "source": [ "# animated plot\n", "\n", - "v_shells = sim.model.radius.value * 1e-5 / sim.model.time_explosion.value\n", - "xs,ys,ints = get_coordinates_multiple_packets_ints(sim.transport.rpacket_tracker_df,sim.model.time_explosion.value)\n", + "v_shells = sim.simulation_state.radius.value * 1e-5 / sim.simulation_state.time_explosion.value\n", + "xs,ys,ints = get_coordinates_multiple_packets_ints(sim.transport.rpacket_tracker_df,sim.simulation_state.time_explosion.value)\n", "xs,ys,ints,max_size = get_equal_array_size(xs,ys,ints)\n", "\n", "fig = go.Figure()\n", @@ -247,7 +247,7 @@ "\n", "# adding the shells\n", "shell_shapes={}\n", - "for i in range(len(sim.model.radius.value)-2,-2,-1):\n", + "for i in range(len(sim.simulation_state.radius.value)-2,-2,-1):\n", " if i==0:\n", " fig.add_shape(type=\"circle\",\n", " xref=\"x\", yref=\"y\",\n", @@ -256,7 +256,7 @@ " fillcolor=\"darkgrey\",\n", " opacity=1\n", " )\n", - " elif i==(len(sim.model.radius.value)-1):\n", + " elif i==(len(sim.simulation_state.radius.value)-1):\n", " fig.add_shape(type=\"circle\",\n", " xref=\"x\", yref=\"y\",\n", " x0=-1*v_shells[i], y0=-1*v_shells[i], x1=v_shells[i], y1=v_shells[i],\n", diff --git a/docs/physics/setup/index.rst b/docs/physics/setup/index.rst index fd233499e81..38e716717a6 100644 --- a/docs/physics/setup/index.rst +++ b/docs/physics/setup/index.rst @@ -5,7 +5,7 @@ Setting Up the Simulation ************************* The first step executed when TARDIS runs is to call an instance of the ``Simulation`` class. This sets up a lot of -things that TARDIS will need during its run. The main things that are set up are the supernova model (a ``Radial1DModel`` object), the +things that TARDIS will need during its run. The main things that are set up are the supernova model (a ``SimulationState`` object), the initial plasma state (a ``BasePlasma`` object, which may be updated throughout the simulation, see :doc:`../update_and_conv/update_and_conv`), and a ``MonteCarloTransport`` object. The pages linked below explain how the former two are calculated (the latter is used mainly in the :doc:`next step of the calculation <../montecarlo/index>`), as well as showing this in action by calling an instance of the ``Simulation`` diff --git a/docs/physics/setup/model.ipynb b/docs/physics/setup/model.ipynb index e2d6d729a8e..355121bd4ca 100644 --- a/docs/physics/setup/model.ipynb +++ b/docs/physics/setup/model.ipynb @@ -7,7 +7,7 @@ "source": [ "# Model\n", "\n", - "As shown previously, when `Simulation.from_config()` is called, a `Radial1DModel` object is created. This is done via the class method `Radial1DModel.from_config()`. This model object contains important information about the shell structure, density, abundance, radiative temperature, and dilution factor throughout the supernova.\n", + "As shown previously, when `Simulation.from_config()` is called, a `SimulationState` object is created. This is done via the class method `SimulationState.from_config()`. This model object contains important information about the shell structure, density, abundance, radiative temperature, and dilution factor throughout the supernova.\n", "\n", "Throughout this notebook, we show various configuration inputs into the TARDIS model and the resulting model. In interactive mode, these parameters can be varied to explore how the model changes. Editing configuration parameters in the notebook is explained [here](../../io/configuration/read_configuration.ipynb).\n", "\n", @@ -53,7 +53,7 @@ "source": [ "# We import the necessary packages\n", "from tardis.io.configuration.config_reader import Configuration\n", - "from tardis.model import Radial1DModel\n", + "from tardis.model import SimulationState\n", "from tardis.io.atom_data.util import download_atom_data\n", "from astropy import units as u\n", "import matplotlib.pyplot as plt\n", @@ -79,7 +79,7 @@ "id": "cee054e9", "metadata": {}, "source": [ - "In the cell below, we set up a model. We use the [specific structure](../../io/configuration/components/models/index.rst#specific-structure) where we supply $t_\\mathrm{explosion}$, the velocity of the inner and outer boundaries of the supernova (labeled `start` and `stop`), and the number of shells (labeled `num`). The shells are then evenly spaced between the inner and outer boundaries of the supernova. The time after the explosion, the inner and outer velocities, and the number of shells can be varied to get different shell structures. The `Radial1DModel` object stores information about the model in the following attributes: `velocity` shows the velocity of the shell boundaries, `v_inner` shows the velocities of the inner boundaries of each shell, `v_outer` shows the velocity of the outer boundaries of each shell, and `v_middle` shows the velocity of the middle of each shell. Similarly, `radius`, `r_inner`, `r_outer`, and `r_middle` show the radii of each shell boundary, the inner boundaries, the outer boundaries, and the middles of each shell, respectively. `v_boundary_inner` shows the velocity of the inner boundary of the computational domain, and `v_boundary_outer` shows the velocity of the outer boundary of the computational domain. Finally, `volume` shows the volume of each shell, calculated via the formula of the volume of a spherical shell: $V=\\frac{4}{3}\\pi (r_\\mathrm{outer}^3-r_\\mathrm{inner}^3)$." + "In the cell below, we set up a model. We use the [specific structure](../../io/configuration/components/models/index.rst#specific-structure) where we supply $t_\\mathrm{explosion}$, the velocity of the inner and outer boundaries of the supernova (labeled `start` and `stop`), and the number of shells (labeled `num`). The shells are then evenly spaced between the inner and outer boundaries of the supernova. The time after the explosion, the inner and outer velocities, and the number of shells can be varied to get different shell structures. The `SimulationState` object stores information about the model in the following attributes: `velocity` shows the velocity of the shell boundaries, `v_inner` shows the velocities of the inner boundaries of each shell, `v_outer` shows the velocity of the outer boundaries of each shell, and `v_middle` shows the velocity of the middle of each shell. Similarly, `radius`, `r_inner`, `r_outer`, and `r_middle` show the radii of each shell boundary, the inner boundaries, the outer boundaries, and the middles of each shell, respectively. `v_boundary_inner` shows the velocity of the inner boundary of the computational domain, and `v_boundary_outer` shows the velocity of the outer boundary of the computational domain. Finally, `volume` shows the volume of each shell, calculated via the formula of the volume of a spherical shell: $V=\\frac{4}{3}\\pi (r_\\mathrm{outer}^3-r_\\mathrm{inner}^3)$." ] }, { @@ -103,7 +103,7 @@ "shell_config.model.structure.velocity.stop = 2000 * u.km/u.s\n", "shell_config.model.structure.velocity.num = 20\n", "\n", - "shell_model = Radial1DModel.from_config(shell_config)\n", + "shell_model = SimulationState.from_config(shell_config)\n", "\n", "print('velocity:\\n', shell_model.velocity)\n", "print('v_inner:\\n', shell_model.v_inner)\n", @@ -151,7 +151,7 @@ "\n", "Since the state of the ejecta, including the density, is the same throughout the shell, we determine the shell's density by plugging the velocity/radius at the center of the shell into the density function. We now explore the various built-in density profiles. For each profile, we build an example model using the density profile and example parameters (which can be varied in interactive mode), print the densities in each shell, and show a graph of density versus radius (specifically the radius at the center of each shell).\n", "\n", - "Note that the density in each shell is stored in the `density` attribute of the `Radial1DModel` object.\n", + "Note that the density in each shell is stored in the `density` attribute of the `SimulationState` object.\n", "\n", "### Branch85 W7 Density\n", "\n", @@ -181,7 +181,7 @@ "\n", "w7_density_config.model.structure.density.type = 'branch85_w7'\n", "\n", - "w7_density_model = Radial1DModel.from_config(w7_density_config)\n", + "w7_density_model = SimulationState.from_config(w7_density_config)\n", "\n", "print('density:\\n', w7_density_model.density)\n", "\n", @@ -209,7 +209,7 @@ "\n", "w7_modified_config.supernova.time_explosion = 12 * u.day\n", "\n", - "w7_modified_model = Radial1DModel.from_config(w7_modified_config)\n", + "w7_modified_model = SimulationState.from_config(w7_modified_config)\n", "\n", "print('density:\\n', w7_modified_model.density)\n", "\n", @@ -273,7 +273,7 @@ "uni_density_config.model.structure.density.time_0 = 1 * u.day\n", "uni_density_config.model.structure.density.value = 5e-10 * u.kg/u.cm**3\n", "\n", - "uni_density_model = Radial1DModel.from_config(uni_density_config)\n", + "uni_density_model = SimulationState.from_config(uni_density_config)\n", "\n", "print('density:\\n', uni_density_model.density)\n", "\n", @@ -327,7 +327,7 @@ "pow_density_config.model.structure.density.v_0 = 500 * u.km/u.s\n", "pow_density_config.model.structure.density.exponent = -2\n", "\n", - "pow_density_model = Radial1DModel.from_config(pow_density_config)\n", + "pow_density_model = SimulationState.from_config(pow_density_config)\n", "\n", "print('density:\\n', pow_density_model.density)\n", "\n", @@ -378,7 +378,7 @@ "exp_density_config.model.structure.density.rho_0 = 5e-10 * u.kg/u.cm**3\n", "exp_density_config.model.structure.density.v_0 = 500 * u.km/u.s\n", "\n", - "exp_density_model = Radial1DModel.from_config(exp_density_config)\n", + "exp_density_model = SimulationState.from_config(exp_density_config)\n", "\n", "print('density:\\n', exp_density_model.density)\n", "\n", @@ -394,11 +394,11 @@ "source": [ "## Abundance\n", "\n", - "The `Radial1DModel` also carries important information about elemental abundances in each shell. These are mass abundances -- that is, the abundance of oxygen is the fraction of the shell's mass that is made up of oxygen.\n", + "The `SimulationState` also carries important information about elemental abundances in each shell. These are mass abundances -- that is, the abundance of oxygen is the fraction of the shell's mass that is made up of oxygen.\n", "\n", "The only built-in abundance model that TARDIS offers is a uniform abundance, meaning each shell has identical abundances. Like density, however, the [file abundance](../../io/configuration/components/models/index.rst#file-abundance), [CSVY model](../../io/configuration/components/models/index.rst#csvy-model), and [custom abundance widget](../../io/visualization/abundance_widget.ipynb) methods allow users more freedom with assigning different abundances in each shell.\n", "\n", - "A table of abundances in each shell is stored in the `abundance` attribute of the `Radial1DModel` object.\n", + "A table of abundances in each shell is stored in the `abundance` attribute of the `SimulationState` object.\n", "\n", "In this first example, the abundances in each shell do not depend on the time after the explosion and are identical to those provided in the configuration." ] @@ -423,7 +423,7 @@ " 'Si':.3,\n", " 'He': .1}\n", "\n", - "abund_model = Radial1DModel.from_config(abund_config)\n", + "abund_model = SimulationState.from_config(abund_config)\n", "\n", "abund_model.abundance" ] @@ -459,7 +459,7 @@ " 'Ni57':.1,\n", " 'Cr51':.4}\n", "\n", - "abund_isotopes_model = Radial1DModel.from_config(abund_isotopes_config)\n", + "abund_isotopes_model = SimulationState.from_config(abund_isotopes_config)\n", "\n", "abund_isotopes_model.abundance" ] @@ -527,7 +527,7 @@ "t_rad_config.model.structure.velocity.stop = 2000 * u.km/u.s\n", "t_rad_config.model.structure.velocity.num = 20\n", "\n", - "t_rad_model = Radial1DModel.from_config(t_rad_config)\n", + "t_rad_model = SimulationState.from_config(t_rad_config)\n", "\n", "print('t_inner:\\n', t_rad_model.t_inner)\n", "print('t_rad:\\n', t_rad_model.t_rad)\n", @@ -590,7 +590,7 @@ "w_config.model.structure.velocity.stop = 2000 * u.km/u.s\n", "w_config.model.structure.velocity.num = 20\n", "\n", - "w_model = Radial1DModel.from_config(w_config)\n", + "w_model = SimulationState.from_config(w_config)\n", "\n", "print('w:\\n', w_model.w)\n", "\n", diff --git a/docs/physics/setup/setup_example.ipynb b/docs/physics/setup/setup_example.ipynb index 287edd18d23..a2c90106a27 100644 --- a/docs/physics/setup/setup_example.ipynb +++ b/docs/physics/setup/setup_example.ipynb @@ -72,7 +72,7 @@ "id": "e3f86364", "metadata": {}, "source": [ - "When the `Simulation` object is created, a `Radial1DModel`, `BasePlasma`, and `MontecarloTransport` object are created and stored as attributes of the `Simulation` object." + "When the `Simulation` object is created, a `SimulationState`, `BasePlasma`, and `MontecarloTransport` object are created and stored as attributes of the `Simulation` object." ] }, { @@ -82,7 +82,7 @@ "metadata": {}, "outputs": [], "source": [ - "sim.model" + "sim.simulation_state" ] }, { diff --git a/docs/physics/update_and_conv/update_and_conv.ipynb b/docs/physics/update_and_conv/update_and_conv.ipynb index 470247bd55b..b92b8f134b0 100644 --- a/docs/physics/update_and_conv/update_and_conv.ipynb +++ b/docs/physics/update_and_conv/update_and_conv.ipynb @@ -212,7 +212,7 @@ "source": [ "sim = Simulation.from_config(tardis_config)\n", "\n", - "model = sim.model\n", + "model = sim.simulation_state\n", "plasma = sim.plasma\n", "transport = sim.transport" ] diff --git a/tardis/analysis/opacities.py b/tardis/analysis/opacities.py index 315c669e40b..e1b383233c1 100644 --- a/tardis/analysis/opacities.py +++ b/tardis/analysis/opacities.py @@ -33,7 +33,7 @@ class opacity_calculator(object): Parameters ---------- - mdl : tardis.model.Radial1DModel + mdl : tardis.model.SimulationState model object of the Tardis run nbins : int number of bins of the frequency grid (default 300) diff --git a/tardis/energy_input/gamma_ray_transport.py b/tardis/energy_input/gamma_ray_transport.py index e89098e8ca6..6731e97bf60 100644 --- a/tardis/energy_input/gamma_ray_transport.py +++ b/tardis/energy_input/gamma_ray_transport.py @@ -281,7 +281,7 @@ def main_gamma_ray_loop( ---------- num_decays : int Number of decays requested - model : tardis.Radial1DModel + model : tardis.SimulationState The tardis model to calculate gamma ray propagation through plasma : tardis.plasma.BasePlasma The tardis plasma with calculated atomic number density diff --git a/tardis/grid/base.py b/tardis/grid/base.py index 91599f5833d..25fa32a6ca2 100644 --- a/tardis/grid/base.py +++ b/tardis/grid/base.py @@ -95,7 +95,7 @@ def grid_row_to_config(self, row_index): def grid_row_to_model(self, row_index): """ - Generates a TARDIS Radial1DModel object using the base + Generates a TARDIS SimulationState object using the base self.config modified by the specified grid row. Parameters @@ -105,7 +105,7 @@ def grid_row_to_model(self, row_index): Returns ------- - model : tardis.model.base.Radial1DModel + model : tardis.model.base.SimulationState """ rowconfig = self.grid_row_to_config(row_index) model = SimulationState.from_config(rowconfig) diff --git a/tardis/io/model/hdf.py b/tardis/io/model/hdf.py index 104bae6d568..2ed9ee1a141 100644 --- a/tardis/io/model/hdf.py +++ b/tardis/io/model/hdf.py @@ -6,11 +6,11 @@ def store_model_to_hdf(model, fname): """ - Stores data from Radial1DModel object into a hdf file. + Stores data from SimulationState object into a hdf file. Parameters ---------- - model : tardis.model.Radial1DModel + model : tardis.model.SimulationState filename : str """ with h5py.File(fname, "a") as f: diff --git a/tardis/io/model/model_reader.py b/tardis/io/model/model_reader.py index 989157b620a..8a010ab6dc3 100644 --- a/tardis/io/model/model_reader.py +++ b/tardis/io/model/model_reader.py @@ -284,11 +284,11 @@ def transport_from_hdf(fname): def model_to_dict(model): """ - Retrieves all the data from a Radial1DModel object and returns a dictionary. + Retrieves all the data from a SimulationState object and returns a dictionary. Parameters ---------- - transport : tardis.model.Radial1DModel + transport : tardis.model.SimulationState Returns ------- @@ -321,7 +321,7 @@ def model_to_dict(model): def model_from_hdf(fname): """ - Creates a Radial1DModel object using data stored in a hdf file. + Creates a SimulationState object using data stored in a hdf file. Parameters ---------- @@ -329,7 +329,7 @@ def model_from_hdf(fname): Returns ------- - new_model : tardis.model.Radial1DModel + new_model : tardis.model.SimulationState """ from tardis.model import SimulationState diff --git a/tardis/io/model_reader.py b/tardis/io/model_reader.py index 2d512a65aa2..2ca6236fa3b 100644 --- a/tardis/io/model_reader.py +++ b/tardis/io/model_reader.py @@ -810,11 +810,11 @@ def transport_from_hdf(fname): def model_to_dict(model): """ - Retrieves all the data from a Radial1DModel object and returns a dictionary. + Retrieves all the data from a SimulationState object and returns a dictionary. Parameters ---------- - transport : tardis.model.Radial1DModel + transport : tardis.model.SimulationState Returns ------- @@ -847,11 +847,11 @@ def model_to_dict(model): def store_model_to_hdf(model, fname): """ - Stores data from Radial1DModel object into a hdf file. + Stores data from SimulationState object into a hdf file. Parameters ---------- - model : tardis.model.Radial1DModel + model : tardis.model.SimulationState filename : str """ with h5py.File(fname, "a") as f: @@ -870,7 +870,7 @@ def store_model_to_hdf(model, fname): def model_from_hdf(fname): """ - Creates a Radial1DModel object using data stored in a hdf file. + Creates a SimulationState object using data stored in a hdf file. Parameters ---------- @@ -878,7 +878,7 @@ def model_from_hdf(fname): Returns ------- - new_model : tardis.model.Radial1DModel + new_model : tardis.model.SimulationState """ from tardis.model import SimulationState diff --git a/tardis/model/base.py b/tardis/model/base.py index 4d5e94abeda..65807a27589 100644 --- a/tardis/model/base.py +++ b/tardis/model/base.py @@ -541,7 +541,7 @@ def v_boundary_outer_index(self): @classmethod def from_config(cls, config, atom_data=None): """ - Create a new Radial1DModel instance from a Configuration object. + Create a new SimulationState instance from a Configuration object. Parameters ---------- @@ -550,7 +550,7 @@ def from_config(cls, config, atom_data=None): Returns ------- - Radial1DModel + SimulationState """ time_explosion = config.supernova.time_explosion.cgs @@ -668,7 +668,7 @@ def from_config(cls, config, atom_data=None): @classmethod def from_csvy(cls, config, atom_data=None): """ - Create a new Radial1DModel instance from a Configuration object. + Create a new SimulationState instance from a Configuration object. Parameters ---------- @@ -677,7 +677,7 @@ def from_csvy(cls, config, atom_data=None): Returns ------- - Radial1DModel + SimulationState """ CSVY_SUPPORTED_COLUMNS = { "velocity", diff --git a/tardis/model/tests/test_csvy_model.py b/tardis/model/tests/test_csvy_model.py index 8e8f69c1b6b..52fb2933a62 100644 --- a/tardis/model/tests/test_csvy_model.py +++ b/tardis/model/tests/test_csvy_model.py @@ -77,7 +77,7 @@ def test_compare_models(model_config_fnames): @pytest.fixture(scope="module") def csvy_model_test_abundances(example_csvy_file_dir): - """Returns Radial1DModel to use to test abundances dataframes""" + """Returns SimulationState to use to test abundances dataframes""" csvypath = example_csvy_file_dir / "csvy_model_to_test_abundances.yml" config = Configuration.from_yaml(csvypath) csvy_model_test_abundances = SimulationState.from_csvy(config) diff --git a/tardis/montecarlo/base.py b/tardis/montecarlo/base.py index 8a6976cb9c8..5924c9c3f66 100644 --- a/tardis/montecarlo/base.py +++ b/tardis/montecarlo/base.py @@ -197,7 +197,7 @@ def _initialize_geometry_arrays(self, model): Parameters ---------- - model : model.Radial1DModel + model : model.SimulationState """ self.r_inner_cgs = model.r_inner.to("cm").value self.r_outer_cgs = model.r_outer.to("cm").value @@ -315,7 +315,7 @@ def run( Parameters ---------- - model : tardis.model.Radial1DModel + model : tardis.model.SimulationState plasma : tardis.plasma.BasePlasma no_of_packets : int no_of_virtual_packets : int @@ -571,7 +571,7 @@ def calculate_luminosity_inner(self, model): Parameters ---------- - model : model.Radial1DModel + model : model.SimulationState Returns ------- @@ -591,7 +591,7 @@ def calculate_time_of_simulation(self, model): Parameters ---------- - model : model.Radial1DModel + model : model.SimulationState Returns ------- diff --git a/tardis/montecarlo/montecarlo_numba/formal_integral.py b/tardis/montecarlo/montecarlo_numba/formal_integral.py index fbb443e79a1..e27704fbd96 100644 --- a/tardis/montecarlo/montecarlo_numba/formal_integral.py +++ b/tardis/montecarlo/montecarlo_numba/formal_integral.py @@ -273,7 +273,7 @@ class FormalIntegrator(object): Parameters ---------- - model : tardis.model.Radial1DModel + model : tardis.model.SimulationState plasma : tardis.plasma.BasePlasma transport : tardis.montecarlo.MontecarloTransport points : int64 @@ -404,7 +404,7 @@ def make_source_function(self): Parameters ---------- - model : tardis.model.Radial1DModel + model : tardis.model.SimulationState Returns ------- diff --git a/tardis/montecarlo/montecarlo_numba/tests/test_cuda_formal_integral.py b/tardis/montecarlo/montecarlo_numba/tests/test_cuda_formal_integral.py index d3412ff1919..3eab004525a 100644 --- a/tardis/montecarlo/montecarlo_numba/tests/test_cuda_formal_integral.py +++ b/tardis/montecarlo/montecarlo_numba/tests/test_cuda_formal_integral.py @@ -349,11 +349,11 @@ def test_full_formal_integral( sim = simulation_verysimple formal_integrator_numba = FormalIntegrator( - sim.model, sim.plasma, sim.transport + sim.simulation_state, sim.plasma, sim.transport ) formal_integrator_cuda = FormalIntegrator( - sim.model, sim.plasma, sim.transport + sim.simulation_state, sim.plasma, sim.transport ) # The function calculate_spectrum sets this property, but in order to test the CUDA. diff --git a/tardis/plasma/standard_plasmas.py b/tardis/plasma/standard_plasmas.py index 01e40fde22e..5cf21d431bd 100644 --- a/tardis/plasma/standard_plasmas.py +++ b/tardis/plasma/standard_plasmas.py @@ -52,12 +52,12 @@ def assemble_plasma(config, model, atom_data=None): """ Create a BasePlasma instance from a Configuration object - and a Radial1DModel. + and a SimulationState. Parameters ---------- config : io.config_reader.Configuration - model : model.Radial1DModel + model : model.SimulationState atom_data : atomic.AtomData If None, an attempt will be made to read the atomic data from config. diff --git a/tardis/simulation/base.py b/tardis/simulation/base.py index 0aee0bb1773..3c7b67cb761 100644 --- a/tardis/simulation/base.py +++ b/tardis/simulation/base.py @@ -94,7 +94,7 @@ class Simulation(PlasmaStateStorerMixin, HDFWriterMixin): ---------- converged : bool iterations : int - model : tardis.model.Radial1DModel + model : tardis.model.SimulationState plasma : tardis.plasma.BasePlasma transport : tardis.montecarlo.MontecarloTransport no_of_packets : int diff --git a/tardis/util/base.py b/tardis/util/base.py index a3bcd07422e..68693c3fa6b 100644 --- a/tardis/util/base.py +++ b/tardis/util/base.py @@ -194,7 +194,7 @@ def create_synpp_yaml(radial1d_mdl, fname, shell_no=0, lines_db=None): Parameters ---------- - radial1d_mdl : Radial1DModel + radial1d_mdl : SimulationState Inputted object that will be read into YAML file fname : str File name for the synpp yaml diff --git a/tardis/visualization/widgets/custom_abundance.py b/tardis/visualization/widgets/custom_abundance.py index 6e08567f1ad..863a750ee2d 100644 --- a/tardis/visualization/widgets/custom_abundance.py +++ b/tardis/visualization/widgets/custom_abundance.py @@ -269,8 +269,8 @@ def from_simulation(cls, sim): ------- CustomAbundanceWidgetData """ - abundance = sim.model.raw_abundance.copy() - isotope_abundance = sim.model.raw_isotope_abundance.copy() + abundance = sim.simulation_state.raw_abundance.copy() + isotope_abundance = sim.simulation_state.raw_isotope_abundance.copy() # integrate element and isotope to one DataFrame abundance["mass_number"] = "" @@ -278,9 +278,9 @@ def from_simulation(cls, sim): abundance = pd.concat([abundance, isotope_abundance]) abundance.sort_index(inplace=True) - velocity = sim.model.velocity - density_t_0 = sim.model.time_explosion - density = sim.model.density + velocity = sim.simulation_state.velocity + density_t_0 = sim.simulation_state.time_explosion + density = sim.simulation_state.density return cls( density_t_0=density_t_0, diff --git a/tardis/visualization/widgets/grotrian_mockup.ipynb b/tardis/visualization/widgets/grotrian_mockup.ipynb index 07e73cc9b7d..e77d5367382 100644 --- a/tardis/visualization/widgets/grotrian_mockup.ipynb +++ b/tardis/visualization/widgets/grotrian_mockup.ipynb @@ -62,7 +62,7 @@ "from tardis.io.config_reader import Configuration\n", "from tardis.simulation import Simulation\n", "from tardis.plasma.standard_plasmas import assemble_plasma\n", - "from tardis.model import Radial1DModel\n", + "from tardis.model import SimulationState\n", "from tardis.io.atom_data import AtomData\n", "from tardis.visualization.widgets.grotrian import GrotrianWidget\n", "from tardis.io.config_internal import get_data_dir\n", @@ -981,7 +981,7 @@ "atom_data = AtomData.from_hdf(\n", " os.path.join(get_data_dir(), \"kurucz_cd23_chianti_H_He.h5\")\n", ")\n", - "model = Radial1DModel.from_config(config, atom_data=atom_data)\n", + "model = SimulationState.from_config(config, atom_data=atom_data)\n", "plasma = assemble_plasma(config, model, atom_data=atom_data)\n", "sim = Simulation.from_config(config, model=model, plasma=plasma)\n", "sim.run_convergence()\n",