This notebook is available at https://github.com/tardis-sn/tardis/tree/master/docs/io/optional/custom_source.ipynb


Running TARDIS with a Custom Packet SourceΒΆ

By default, TARDIS generates energy packets using its BasePacketSource class, which models the photosphere of the supernova as a perfect blackbody (see Energy Packet Initialization). However, users may create their own packet source, as will be shown in this notebook. In order to do this, a user must create a class (that can but does not have to inherit from BasePacketSource) which contains a method create_packets that takes in (in this order): - the photospheric temperature - the number of packets - a random number generator - the photospheric radius

and returns arrays of the radii, frequencies, propogation directions, and energies of the ensemble of packets (once again see Energy Packet Initialization for more information). To use your packet source in a run of TARDIS, you must pass an instance of your class into the run_tardis function under the packet_source keyword argument.

Note

In both the BasePacketSource class and in the example here, all packets are generated at the same radius. This need not be true in general (although the create_packets method should only take in a single radius as its argument).

We show an example of how a custom packet source is used:

[1]:
# Import necessary packages
import numpy as np
from tardis import constants as const
from astropy import units as u
from tardis.montecarlo.packet_source import BasePacketSource
from tardis import run_tardis
import matplotlib.pyplot as plt
from tardis.io.atom_data import download_atom_data
/usr/share/miniconda3/envs/tardis/lib/python3.7/importlib/_bootstrap.py:219: QAWarning: pyne.data is not yet QA compliant.
  return f(*args, **kwds)
[py.warnings         ][WARNING]  /usr/share/miniconda3/envs/tardis/lib/python3.7/site-packages/traitlets/traitlets.py:3036: FutureWarning: --rc={'figure.dpi': 96} for dict-traits is deprecated in traitlets 5.0. You can pass --rc <key=value> ... multiple times to add items to a dict.
  FutureWarning,
 (warnings.py:110)
[2]:
# Download the atomic data used for a run of TARDIS
download_atom_data('kurucz_cd23_chianti_H_He')
[tardis.io.atom_data.atom_web_download][INFO   ]  Downloading atomic data from https://media.githubusercontent.com/media/tardis-sn/tardis-refdata/master/atom_data/kurucz_cd23_chianti_H_He.h5 to /home/runner/Downloads/tardis-data/kurucz_cd23_chianti_H_He.h5 (atom_web_download.py:46)
[3]:
# Create a packet source class that contains a create_packets method
class TruncBlackbodySource(BasePacketSource):
    """
        Custom inner boundary source class to replace the Blackbody source
        with a truncated Blackbody source.
    """

    def __init__(self, seed, truncation_wavelength):
        super().__init__(seed)
        self.rng = np.random.default_rng(seed=seed)
        self.truncation_wavelength = truncation_wavelength

    def create_packets(self, T, no_of_packets, rng, radius,
                       drawing_sample_size=None):
        """
        Packet source that generates a truncated Blackbody source.

        Parameters
        ----------
        T : float
            Blackbody temperature
        no_of_packets : int
            number of packets to be created
        truncation_wavelength : float
            truncation wavelength in Angstrom.
            Only wavelengths higher than the truncation wavelength
            will be sampled.
        """

        # Makes uniform array of packet radii
        radii = np.ones(no_of_packets) * radius

        # Use mus and energies from normal blackbody source.
        mus = self.create_zero_limb_darkening_packet_mus(no_of_packets, self.rng)
        energies = self.create_uniform_packet_energies(no_of_packets, self.rng)

        # If not specified, draw 2 times as many packets and reject any beyond no_of_packets.
        if drawing_sample_size is None:
            drawing_sample_size = 2 * no_of_packets

        # Blackbody will be truncated below truncation_wavelength / above truncation_frequency.
        truncation_frequency = u.Quantity(self.truncation_wavelength, u.Angstrom).to(
                                          u.Hz, equivalencies=u.spectral()).value

        # Draw nus from blackbody distribution and reject based on truncation_frequency.
        # If more nus.shape[0] > no_of_packets use only the first no_of_packets.
        nus = self.create_blackbody_packet_nus(T, drawing_sample_size, self.rng)
        nus = nus[nus<truncation_frequency][:no_of_packets]


        # Only required if the truncation wavelength is too big compared to the maximum
        # of the blackbody distribution. Keep sampling until nus.shape[0] > no_of_packets.
        while nus.shape[0] < no_of_packets:
            additional_nus = self.create_blackbody_packet_nus(
                T, drawing_sample_size, self.rng
            )
            mask = additional_nus < truncation_frequency
            additional_nus = additional_nus[mask][:no_of_packets]
            nus = np.hstack([nus, additional_nus])[:no_of_packets]

        return radii, nus, mus, energies
[4]:
# Call an instance of the packet source class
packet_source = TruncBlackbodySource(
    53253, truncation_wavelength=2000
)

We now run TARDIS both with and without our custom packet source, and we compare the results:

[5]:
mdl = run_tardis('tardis_example.yml',
                 packet_source=packet_source)
mdl_norm = run_tardis('tardis_example.yml')
[tardis.plasma.standard_plasmas][INFO   ]
        Reading Atomic Data from kurucz_cd23_chianti_H_He.h5 (standard_plasmas.py:91)
[tardis.io.atom_data.util][INFO   ]
        Atom Data kurucz_cd23_chianti_H_He.h5 not found in local path.
        Exists in TARDIS Data repo /home/runner/Downloads/tardis-data/kurucz_cd23_chianti_H_He.h5 (util.py:34)
[tardis.io.atom_data.base][INFO   ]
        Reading Atom Data with:
        UUID = 6f7b09e887a311e7a06b246e96350010
        MD5  = 864f1753714343c41f99cb065710cace  (base.py:189)
[tardis.io.atom_data.base][INFO   ]
        Non provided atomic data:
        synpp_refs, photoionization_data, yg_data, two_photon_data (base.py:193)
[tardis.simulation.base][INFO   ]
        Starting iteration 1 of 20 (base.py:325)
[py.warnings         ][WARNING]  /usr/share/miniconda3/envs/tardis/lib/python3.7/site-packages/astropy/units/equivalencies.py:124: RuntimeWarning: divide by zero encountered in double_scalars
  (si.m, si.Hz, lambda x: _si.c.value / x),
 (warnings.py:110)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 8.037e+42 erg / s
        Luminosity absorbed  = 2.571e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 9.93e+03 9.42e+03 0.4 0.674
5 9.85e+03 9.74e+03 0.211 0.24
10 9.78e+03 9.63e+03 0.143 0.145
15 9.71e+03 9.36e+03 0.105 0.109
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 9933.952 K
        Expected t_inner for next iteration = 11404.453 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 2 of 20 (base.py:325)
[py.warnings         ][WARNING]  /usr/share/miniconda3/envs/tardis/lib/python3.7/site-packages/astropy/units/equivalencies.py:124: RuntimeWarning: divide by zero encountered in double_scalars
  (si.m, si.Hz, lambda x: _si.c.value / x),
 (warnings.py:110)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 1.382e+43 erg / s
        Luminosity absorbed  = 4.597e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 9.42e+03 9.98e+03 0.674 0.941
5 9.74e+03 1.03e+04 0.24 0.338
10 9.63e+03 1.02e+04 0.145 0.199
15 9.36e+03 9.96e+03 0.109 0.146
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 11404.453 K
        Expected t_inner for next iteration = 9984.290 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 3 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 8.259e+42 erg / s
        Luminosity absorbed  = 2.568e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 9.98e+03 9.34e+03 0.941 0.715
5 1.03e+04 9.74e+03 0.338 0.246
10 1.02e+04 9.63e+03 0.199 0.15
15 9.96e+03 9.39e+03 0.146 0.111
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 9984.290 K
        Expected t_inner for next iteration = 11307.140 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 4 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 1.339e+43 erg / s
        Luminosity absorbed  = 4.408e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 9.34e+03 9.89e+03 0.715 0.936
5 9.74e+03 1.02e+04 0.246 0.338
10 9.63e+03 1.01e+04 0.15 0.201
15 9.39e+03 9.87e+03 0.111 0.146
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 11307.140 K
        Expected t_inner for next iteration = 10056.380 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 5 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 8.461e+42 erg / s
        Luminosity absorbed  = 2.685e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 9.89e+03 9.38e+03 0.936 0.713
5 1.02e+04 9.63e+03 0.338 0.261
10 1.01e+04 9.5e+03 0.201 0.16
15 9.87e+03 9.32e+03 0.146 0.116
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 10056.380 K
        Expected t_inner for next iteration = 11251.985 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 6 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 1.313e+43 erg / s
        Luminosity absorbed  = 4.323e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 9.38e+03 9.88e+03 0.713 0.925
5 9.63e+03 1.02e+04 0.261 0.338
10 9.5e+03 1.01e+04 0.16 0.195
15 9.32e+03 9.96e+03 0.116 0.139
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 11251.985 K
        Expected t_inner for next iteration = 10108.099 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 7 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 8.628e+42 erg / s
        Luminosity absorbed  = 2.749e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 9.88e+03 9.41e+03 0.925 0.719
5 1.02e+04 9.71e+03 0.338 0.26
10 1.01e+04 9.6e+03 0.195 0.158
15 9.96e+03 9.35e+03 0.139 0.117
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 10108.099 K
        Expected t_inner for next iteration = 11200.204 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 8 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 1.289e+43 erg / s
        Luminosity absorbed  = 4.241e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 9.41e+03 9.89e+03 0.719 0.906
5 9.71e+03 1.02e+04 0.26 0.33
10 9.6e+03 1.01e+04 0.158 0.194
15 9.35e+03 9.88e+03 0.117 0.141
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 11200.204 K
        Expected t_inner for next iteration = 10152.536 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 9 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 8.757e+42 erg / s
        Luminosity absorbed  = 2.820e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 9.89e+03 9.45e+03 0.906 0.724
5 1.02e+04 9.74e+03 0.33 0.26
10 1.01e+04 9.63e+03 0.194 0.157
15 9.88e+03 9.45e+03 0.141 0.114
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 10152.536 K
        Expected t_inner for next iteration = 11166.325 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 10 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 1.279e+43 erg / s
        Luminosity absorbed  = 4.143e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 9.45e+03 9.86e+03 0.724 0.901
5 9.74e+03 1.02e+04 0.26 0.33
10 9.63e+03 1.01e+04 0.157 0.192
15 9.45e+03 9.84e+03 0.114 0.141
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 11166.325 K
        Expected t_inner for next iteration = 10162.672 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 11 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 8.832e+42 erg / s
        Luminosity absorbed  = 2.793e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 9.86e+03 9.43e+03 0.901 0.736
5 1.02e+04 9.72e+03 0.33 0.264
10 1.01e+04 9.64e+03 0.192 0.159
15 9.84e+03 9.4e+03 0.141 0.117
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 10162.672 K
        Expected t_inner for next iteration = 11129.983 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 12 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 1.259e+43 erg / s
        Luminosity absorbed  = 4.118e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 9.43e+03 9.89e+03 0.736 0.892
5 9.72e+03 1.02e+04 0.264 0.321
10 9.64e+03 1.01e+04 0.159 0.189
15 9.4e+03 9.88e+03 0.117 0.138
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 11129.983 K
        Expected t_inner for next iteration = 10208.677 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 13 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 9.067e+42 erg / s
        Luminosity absorbed  = 2.774e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 9.89e+03 9.48e+03 0.892 0.726
5 1.02e+04 9.77e+03 0.321 0.265
10 1.01e+04 9.68e+03 0.189 0.16
15 9.88e+03 9.42e+03 0.138 0.12
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 10208.677 K
        Expected t_inner for next iteration = 11034.450 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 14 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 1.216e+43 erg / s
        Luminosity absorbed  = 3.985e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 9.48e+03 9.83e+03 0.726 0.871
5 9.77e+03 1.01e+04 0.265 0.321
10 9.68e+03 1.01e+04 0.16 0.186
15 9.42e+03 9.82e+03 0.12 0.136
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 11034.450 K
        Expected t_inner for next iteration = 10299.789 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 15 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 9.288e+42 erg / s
        Luminosity absorbed  = 2.972e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 9.83e+03 9.51e+03 0.871 0.754
5 1.01e+04 9.77e+03 0.321 0.275
10 1.01e+04 9.71e+03 0.186 0.163
15 9.82e+03 9.51e+03 0.136 0.118
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 10299.789 K
        Expected t_inner for next iteration = 10999.523 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 16 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 1.200e+43 erg / s
        Luminosity absorbed  = 3.939e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 9.51e+03 9.79e+03 0.754 0.873
5 9.77e+03 1e+04 0.275 0.319
10 9.71e+03 9.98e+03 0.163 0.189
15 9.51e+03 9.8e+03 0.118 0.136
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 10999.523 K
        Expected t_inner for next iteration = 10333.279 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 17 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 9.390e+42 erg / s
        Luminosity absorbed  = 3.031e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 9.79e+03 9.54e+03 0.873 0.752
5 1e+04 9.81e+03 0.319 0.273
10 9.98e+03 9.74e+03 0.189 0.161
15 9.8e+03 9.56e+03 0.136 0.117
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 10333.279 K
        Expected t_inner for next iteration = 10974.955 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 18 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 1.192e+43 erg / s
        Luminosity absorbed  = 3.875e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 9.54e+03 9.8e+03 0.752 0.865
5 9.81e+03 1.01e+04 0.273 0.312
10 9.74e+03 1e+04 0.161 0.185
15 9.56e+03 9.83e+03 0.117 0.134
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 10974.955 K
        Expected t_inner for next iteration = 10345.059 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 19 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 9.455e+42 erg / s
        Luminosity absorbed  = 3.026e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 9.8e+03 9.51e+03 0.865 0.761
5 1.01e+04 9.78e+03 0.312 0.276
10 1e+04 9.73e+03 0.185 0.163
15 9.83e+03 9.53e+03 0.134 0.119
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 10345.059 K
        Expected t_inner for next iteration = 10949.979 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 20 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 1.180e+43 erg / s
        Luminosity absorbed  = 3.860e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Simulation finished in 20 iterations
        Simulation took 36.97 s
 (base.py:384)
[tardis.plasma.standard_plasmas][INFO   ]
        Reading Atomic Data from kurucz_cd23_chianti_H_He.h5 (standard_plasmas.py:91)
[tardis.io.atom_data.util][INFO   ]
        Atom Data kurucz_cd23_chianti_H_He.h5 not found in local path.
        Exists in TARDIS Data repo /home/runner/Downloads/tardis-data/kurucz_cd23_chianti_H_He.h5 (util.py:34)
[tardis.io.atom_data.base][INFO   ]
        Reading Atom Data with:
        UUID = 6f7b09e887a311e7a06b246e96350010
        MD5  = 864f1753714343c41f99cb065710cace  (base.py:189)
[tardis.io.atom_data.base][INFO   ]
        Non provided atomic data:
        synpp_refs, photoionization_data, yg_data, two_photon_data (base.py:193)
[tardis.simulation.base][INFO   ]
        Starting iteration 1 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 7.942e+42 erg / s
        Luminosity absorbed  = 2.659e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 9.93e+03 1.01e+04 0.4 0.507
5 9.85e+03 1.02e+04 0.211 0.197
10 9.78e+03 1.01e+04 0.143 0.117
15 9.71e+03 9.87e+03 0.105 0.0869
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 9933.952 K
        Expected t_inner for next iteration = 11472.471 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 2 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 1.405e+43 erg / s
        Luminosity absorbed  = 4.798e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 1.01e+04 1.15e+04 0.507 0.546
5 1.02e+04 1.15e+04 0.197 0.223
10 1.01e+04 1.13e+04 0.117 0.135
15 9.87e+03 1.1e+04 0.0869 0.101
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 11472.471 K
        Expected t_inner for next iteration = 9960.403 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 3 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 8.168e+42 erg / s
        Luminosity absorbed  = 2.550e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 1.15e+04 1.05e+04 0.546 0.442
5 1.15e+04 1.08e+04 0.223 0.165
10 1.13e+04 1.07e+04 0.135 0.101
15 1.1e+04 1.02e+04 0.101 0.0781
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 9960.403 K
        Expected t_inner for next iteration = 11342.715 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 4 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 1.356e+43 erg / s
        Luminosity absorbed  = 4.460e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 1.05e+04 1.16e+04 0.442 0.498
5 1.08e+04 1.17e+04 0.165 0.201
10 1.07e+04 1.14e+04 0.101 0.127
15 1.02e+04 1.1e+04 0.0781 0.0953
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 11342.715 K
        Expected t_inner for next iteration = 10026.022 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 5 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 8.318e+42 erg / s
        Luminosity absorbed  = 2.681e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 1.16e+04 1.06e+04 0.498 0.444
5 1.17e+04 1.09e+04 0.201 0.162
10 1.14e+04 1.07e+04 0.127 0.101
15 1.1e+04 1.03e+04 0.0953 0.0769
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 10026.022 K
        Expected t_inner for next iteration = 11314.135 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 6 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 1.343e+43 erg / s
        Luminosity absorbed  = 4.402e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 1.06e+04 1.15e+04 0.444 0.51
5 1.09e+04 1.17e+04 0.162 0.201
10 1.07e+04 1.14e+04 0.101 0.127
15 1.03e+04 1.1e+04 0.0769 0.0955
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 11314.135 K
        Expected t_inner for next iteration = 10047.862 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 7 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 8.399e+42 erg / s
        Luminosity absorbed  = 2.700e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 1.15e+04 1.06e+04 0.51 0.443
5 1.17e+04 1.1e+04 0.201 0.158
10 1.14e+04 1.07e+04 0.127 0.102
15 1.1e+04 1.03e+04 0.0955 0.0768
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 10047.862 K
        Expected t_inner for next iteration = 11284.172 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 8 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 1.334e+43 erg / s
        Luminosity absorbed  = 4.312e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 1.06e+04 1.15e+04 0.443 0.502
5 1.1e+04 1.17e+04 0.158 0.197
10 1.07e+04 1.14e+04 0.102 0.124
15 1.03e+04 1.1e+04 0.0768 0.0941
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 11284.172 K
        Expected t_inner for next iteration = 10056.590 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 9 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 8.442e+42 erg / s
        Luminosity absorbed  = 2.693e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 1.15e+04 1.06e+04 0.502 0.443
5 1.17e+04 1.1e+04 0.197 0.161
10 1.14e+04 1.07e+04 0.124 0.102
15 1.1e+04 1.04e+04 0.0941 0.0753
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 10056.590 K
        Expected t_inner for next iteration = 11264.873 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 10 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 1.327e+43 erg / s
        Luminosity absorbed  = 4.253e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 1.06e+04 1.15e+04 0.443 0.505
5 1.1e+04 1.17e+04 0.161 0.197
10 1.07e+04 1.15e+04 0.102 0.122
15 1.04e+04 1.11e+04 0.0753 0.0933
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 11264.873 K
        Expected t_inner for next iteration = 10062.930 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 11 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 8.521e+42 erg / s
        Luminosity absorbed  = 2.645e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 1.15e+04 1.06e+04 0.505 0.444
5 1.17e+04 1.1e+04 0.197 0.162
10 1.15e+04 1.09e+04 0.122 0.0958
15 1.11e+04 1.05e+04 0.0933 0.0744
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 10062.930 K
        Expected t_inner for next iteration = 11220.057 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 12 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 1.302e+43 erg / s
        Luminosity absorbed  = 4.230e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 1.06e+04 1.16e+04 0.444 0.486
5 1.1e+04 1.18e+04 0.162 0.19
10 1.09e+04 1.14e+04 0.0958 0.121
15 1.05e+04 1.11e+04 0.0744 0.089
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 11220.057 K
        Expected t_inner for next iteration = 10121.498 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 13 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 8.695e+42 erg / s
        Luminosity absorbed  = 2.731e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 1.16e+04 1.07e+04 0.486 0.438
5 1.18e+04 1.1e+04 0.19 0.162
10 1.14e+04 1.08e+04 0.121 0.101
15 1.11e+04 1.04e+04 0.089 0.0767
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 10121.498 K
        Expected t_inner for next iteration = 11171.296 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 14 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 1.284e+43 erg / s
        Luminosity absorbed  = 4.115e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 1.07e+04 1.15e+04 0.438 0.495
5 1.1e+04 1.17e+04 0.162 0.191
10 1.08e+04 1.14e+04 0.101 0.12
15 1.04e+04 1.1e+04 0.0767 0.0918
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 11171.296 K
        Expected t_inner for next iteration = 10145.811 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 15 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 8.705e+42 erg / s
        Luminosity absorbed  = 2.828e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 1.15e+04 1.07e+04 0.495 0.449
5 1.17e+04 1.1e+04 0.191 0.163
10 1.14e+04 1.09e+04 0.12 0.0997
15 1.1e+04 1.05e+04 0.0918 0.0768
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 10145.811 K
        Expected t_inner for next iteration = 11191.850 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 16 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 1.284e+43 erg / s
        Luminosity absorbed  = 4.234e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 1.07e+04 1.15e+04 0.449 0.495
5 1.1e+04 1.18e+04 0.163 0.184
10 1.09e+04 1.14e+04 0.0997 0.122
15 1.05e+04 1.11e+04 0.0768 0.0898
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 11191.850 K
        Expected t_inner for next iteration = 10164.556 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 17 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 8.803e+42 erg / s
        Luminosity absorbed  = 2.816e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 1.15e+04 1.07e+04 0.495 0.439
5 1.18e+04 1.11e+04 0.184 0.16
10 1.14e+04 1.1e+04 0.122 0.0962
15 1.11e+04 1.05e+04 0.0898 0.0763
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 10164.556 K
        Expected t_inner for next iteration = 11150.010 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 18 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 1.271e+43 erg / s
        Luminosity absorbed  = 4.117e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 1.07e+04 1.14e+04 0.439 0.492
5 1.11e+04 1.17e+04 0.16 0.186
10 1.1e+04 1.15e+04 0.0962 0.117
15 1.05e+04 1.11e+04 0.0763 0.0876
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 11150.010 K
        Expected t_inner for next iteration = 10180.809 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 19 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 8.820e+42 erg / s
        Luminosity absorbed  = 2.873e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Plasma stratification: (base.py:430)
Shell No. t_rad next_t_rad w next_w
0 1.14e+04 1.07e+04 0.492 0.441
5 1.17e+04 1.11e+04 0.186 0.161
10 1.15e+04 1.09e+04 0.117 0.1
15 1.11e+04 1.05e+04 0.0876 0.0765
[tardis.simulation.base][INFO   ]  None (base.py:433)
[tardis.simulation.base][INFO   ]
        Current t_inner = 10180.809 K
        Expected t_inner for next iteration = 11157.125 K
 (base.py:448)
[tardis.simulation.base][INFO   ]
        Starting iteration 20 of 20 (base.py:325)
[tardis.simulation.base][INFO   ]
        Luminosity emitted   = 1.272e+43 erg / s
        Luminosity absorbed  = 4.149e+42 erg / s
        Luminosity requested = 1.059e+43 erg / s
 (base.py:453)
[tardis.simulation.base][INFO   ]
        Simulation finished in 20 iterations
        Simulation took 22.89 s
 (base.py:384)
[6]:
%matplotlib inline
plt.plot(mdl.runner.spectrum_virtual.wavelength,
         mdl.runner.spectrum_virtual.luminosity_density_lambda,
         color='red', label='truncated blackbody (custom packet source)')
plt.plot(mdl_norm.runner.spectrum_virtual.wavelength,
         mdl_norm.runner.spectrum_virtual.luminosity_density_lambda,
         color='blue', label='normal blackbody (default packet source)')
plt.xlabel('$\lambda [\AA]$')
plt.ylabel('$L_\lambda$ [erg/s/$\AA$]')
plt.xlim(500, 10000)
plt.legend()
[py.warnings         ][WARNING]  /usr/share/miniconda3/envs/tardis/lib/python3.7/site-packages/traitlets/traitlets.py:3036: FutureWarning: --rc={'figure.dpi': 96} for dict-traits is deprecated in traitlets 5.0. You can pass --rc <key=value> ... multiple times to add items to a dict.
  FutureWarning,
 (warnings.py:110)
[6]:
<matplotlib.legend.Legend at 0x7fba0a7f0050>
../../_images/io_optional_custom_source_8_2.svg