<jupyter_start><jupyter_text>Accessing Physical Quantities In order to compute the synthetic spectrum, TARDIS must either be toldor must calculate many physical properties of the model. To understand andtest the code it can be important to look at these values. Oneeasy way to do this is to run TARDIS in an interactive mode and theninspect the model properties.  Runing in interactive Python session<jupyter_code># Download the atomic data
from tardis.io.atom_data.util import download_atom_data
download_atom_data('kurucz_cd23_chianti_H_He')

# Download the example configuration file
!curl -O https://raw.githubusercontent.com/tardis-sn/tardis/master/docs/tardis_example.yml
from tardis import run_tardis

simulation = run_tardis('tardis_example.yml')<jupyter_output><empty_output><jupyter_text>If all goes well, the simulation should run as usual. Afterwards, theinformation from the simulation will all exist in `Simulation` andcan be examined.Some examples for useful/interesting quantities aregiven below (but much more information is available: contact us via [tardis-sn-users](http://groups.google.com/forum/!forum/tardis-sn-users) if you needfurther help).  Examples of finding physical quantities For example, two of our important quantities are the parameters of theradiation field model, $T_{\rm rad}$ and $W$. These exist as `numpy.ndarray`Thus `simulation.plasma.t_rad` will give you a list of the $T_{\rm rad}$-values for the model zones in cgs units.<jupyter_code>simulation.plasma.t_rad<jupyter_output><empty_output><jupyter_text>Similarly, the $W$-values can be accessed using `simulation.plasma.w`<jupyter_code>simulation.plasma.w<jupyter_output><empty_output><jupyter_text>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).<jupyter_code>simulation.model.v_inner.cgs
simulation.model.v_outer.cgs<jupyter_output><empty_output><jupyter_text>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).<jupyter_code>simulation.model.density.cgs<jupyter_output><empty_output><jupyter_text>Many other interesting quantities are stored in the `plasma`.For example the calculated ion populations and level populations is given by `simulation.plasma.ion_number_density` and `simulation.plasma.level_number_density` respectively.<jupyter_code>simulation.plasma.ion_number_density
simulation.plasma.level_number_density<jupyter_output><empty_output><jupyter_text>These are stored as Pandas `DataFrames`. An index can be supplied to obtain the population in a particular zone. E.g., for the ion populations of the innermost zone (index = 0), we will use `simulation.plasma.ion_number_density[0]`<jupyter_code>simulation.plasma.ion_number_density[0]<jupyter_output><empty_output><jupyter_text>Ion populations for a particular ionization stage of a particular element can be accessed by specifying an appropriate tuple (𝑍,𝐶), which identifies the element (via atomic number 𝑍 ) and the charge (via the ion charge 𝐶 ). Thus, `simulation.plasma.ion_number_density.loc[14,1]` will identify the ion popuations for Si II (𝑍=14,𝐶=1) in all the zones.<jupyter_code>simulation.plasma.ion_number_density.loc[14,1]<jupyter_output><empty_output><jupyter_text>The above examples can be combined to obtain e.g. the Si II population in the innermost zonecan be obtained by`simulation.plasma.ion_number_density[0].loc[14,1]`<jupyter_code>simulation.plasma.ion_number_density[0].loc[14,1]<jupyter_output><empty_output><jupyter_text>The level populations are stored (and can be accessed) in a similar way - a third label can be used to pick out a particular atomic level. E.g., to pull out the population of the ground state (index 0) of Si II we can use `simulation.plasma.level_number_density.loc[14,1,0]`<jupyter_code>simulation.plasma.level_number_density.loc[14,1,0]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08321807284462886, 'fraction_numerical': 0.008529276164130935, 'mean_word_length': 6.679646017699115, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 41, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '25329', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1362, 'n_tokens_neox': 1323, 'n_words': 411, 'path': 'docs/io/output/physical_quantities.ipynb', 'repo_name': 'ahmedo42/tardis', 'size': '4338'}