You can interact with this notebook online: Launch notebook

How to run TARDIS with a custom ejecta model

This notebook will go through multiple detailed examples of how to properly run TARDIS with a custom ejecta profile specified by a custom density file and a custom abundance file.

[1]:
import tardis
import matplotlib.pyplot as plt
import numpy as np

Your custom density file

First, let’s look at an example of a custom density file.

80 day 0 9500 9e-16 1 10500 6e-16 2 12000 2e-17
  • The first line specifies the time in days after the explosion

  • After a skipped line, each row corresponds to a shell with index specified by the first column.

  • The second column lists the velocities of the outer boundary of the cell in km/s.

  • The third column lists the density of the cell.

Important:

The default behavior of TARDIS is to use the first shell as the inner boundary. This means that v_inner_boundary = 9500, and the corresponding density 9e-16 is ignored because it is within the inner boundary. It can be replaced by an arbitrary number. The outer boundary of the last shell will be used as v_outer_boundary, so the default behavior will set v_outer_boundary = 12000.

Your custom abundance file

Let’s look at an example of a custom density file.

H He 0.0 1.0 0.4 0.6
  • The first line indicates which elements (or isotopes) correspond to which columns.

  • After a skipped line, each row specifies the chemical abundance of one shell. Therefore the numbers in a given row should sum to 1.0

Important:

Note that there are only 2 shells specified in this abundance file (despite the custom density file having 3 lines). This is because the custom density file specifies the boundaries of the shells, while the abundance file specifies the abundances within each shell.

Running TARDIS with the custom files

Now let’s run TARDIS using the example custom files.

[2]:
model = tardis.run_tardis('./test_config.yml')
[py.warnings         ][WARNING]  /home/mew488/anaconda2/envs/tardis3/lib/python3.6/importlib/_bootstrap.py:219: QAWarning: pyne.data is not yet QA compliant.
  return f(*args, **kwds)
 (warnings.py:99)
[py.warnings         ][WARNING]  /home/mew488/anaconda2/envs/tardis3/lib/python3.6/importlib/_bootstrap.py:219: QAWarning: pyne.material is not yet QA compliant.
  return f(*args, **kwds)
 (warnings.py:99)
[tardis.model.base   ][WARNING]  Abundances have not been normalized to 1. - normalizing (base.py:367)
[py.warnings         ][WARNING]  /home/mew488/anaconda2/envs/tardis3/lib/python3.6/site-packages/astropy/units/quantity.py:1067: AstropyDeprecationWarning: The truth value of a Quantity is ambiguous. In the future this will raise a ValueError.
  AstropyDeprecationWarning)
 (warnings.py:99)
[tardis.plasma.standard_plasmas][INFO   ]  Reading Atomic Data from /home/mew488/Research/TARDIS/tardis-refdata/atom_data/kurucz_cd23_chianti_H_He.h5 (standard_plasmas.py:77)
[py.warnings         ][WARNING]  /home/mew488/anaconda2/envs/tardis3/lib/python3.6/site-packages/IPython/core/interactiveshell.py:3291: PerformanceWarning: indexing past lexsort depth may impact performance.
  exec(code_obj, self.user_global_ns, self.user_ns)
 (warnings.py:99)
[tardis.io.atomic    ][INFO   ]  Read Atom Data with UUID=6f7b09e887a311e7a06b246e96350010 and MD5=864f1753714343c41f99cb065710cace. (atomic.py:173)
[tardis.io.atomic    ][INFO   ]  Non provided atomic data: synpp_refs, ion_cx_th_data, ion_cx_sp_data (atomic.py:176)
[py.warnings         ][WARNING]  /home/mew488/src/dev/tardis/tardis/plasma/properties/ion_population.py:59: FutureWarning:
Passing list-likes to .loc or [] with any missing label will raise
KeyError in the future, you can use .reindex() as an alternative.

See the documentation here:
https://pandas.pydata.org/pandas-docs/stable/indexing.html#deprecate-loc-reindex-listlike
  partition_function.index].dropna())
 (warnings.py:99)
[py.warnings         ][WARNING]  /home/mew488/anaconda2/envs/tardis3/lib/python3.6/site-packages/astropy/units/equivalencies.py:90: RuntimeWarning: divide by zero encountered in double_scalars
  (si.m, si.Hz, lambda x: _si.c.value / x),
 (warnings.py:99)
[py.warnings         ][WARNING]  /home/mew488/anaconda2/envs/tardis3/lib/python3.6/site-packages/astropy/units/quantity.py:1067: AstropyDeprecationWarning: The truth value of a Quantity is ambiguous. In the future this will raise a ValueError.
  AstropyDeprecationWarning)
 (warnings.py:99)
[tardis.simulation.base][INFO   ]  Starting iteration 1/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.31327e+42 erg / s Luminosity absorbed = 3.85232e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 1/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad  next_t_rad         w    next_w
        Shell
        0      6541.006187  6556.13016  0.343875  0.350118

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6551.915 K -- next t_inner 6482.755 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 2/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.21734e+42 erg / s Luminosity absorbed = 2.64889e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 2/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                    t_rad   next_t_rad         w    next_w
        Shell
        0      6556.13016  6495.397989  0.350118  0.347789

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6482.755 K -- next t_inner 6551.611 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 3/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.31324e+42 erg / s Luminosity absorbed = 2.21576e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 3/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad         w    next_w
        Shell
        0      6495.397989  6558.906259  0.347789  0.348258

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6551.611 K -- next t_inner 6482.500 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 4/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.21685e+42 erg / s Luminosity absorbed = 3.70488e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 4/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad         w    next_w
        Shell
        0      6558.906259  6485.545593  0.348258  0.350397

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6482.500 K -- next t_inner 6552.082 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 5/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.31359e+42 erg / s Luminosity absorbed = 2.20402e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 5/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad         w    next_w
        Shell
        0      6485.545593  6550.104752  0.350397  0.352096

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6552.082 K -- next t_inner 6482.479 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 6/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.21697e+42 erg / s Luminosity absorbed = 2.64706e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 6/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad         w    next_w
        Shell
        0      6550.104752  6464.323819  0.352096  0.354247

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6482.479 K -- next t_inner 6551.873 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 7/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.31327e+42 erg / s Luminosity absorbed = 2.76611e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 7/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad         w    next_w
        Shell
        0      6464.323819  6586.535643  0.354247  0.344429

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6551.873 K -- next t_inner 6482.711 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 8/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.21723e+42 erg / s Luminosity absorbed = 2.12445e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 8/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad  next_t_rad         w    next_w
        Shell
        0      6586.535643   6452.0629  0.344429  0.358012

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6482.711 K -- next t_inner 6551.731 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 9/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.31306e+42 erg / s Luminosity absorbed = 3.30756e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 9/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                   t_rad   next_t_rad         w    next_w
        Shell
        0      6452.0629  6542.502642  0.358012  0.353289

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6551.731 K -- next t_inner 6482.870 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 10/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.21734e+42 erg / s Luminosity absorbed = 3.17660e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 10/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad         w    next_w
        Shell
        0      6542.502642  6474.094395  0.353289  0.353484

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6482.870 K -- next t_inner 6551.733 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 11/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.31318e+42 erg / s Luminosity absorbed = 2.21194e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 11/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad         w   next_w
        Shell
        0      6474.094395  6569.860807  0.353484  0.34756

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6551.733 K -- next t_inner 6482.698 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 12/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.21741e+42 erg / s Luminosity absorbed = 1.59417e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 12/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad        w    next_w
        Shell
        0      6569.860807  6510.554611  0.34756  0.344308

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6482.698 K -- next t_inner 6551.446 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 13/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.31272e+42 erg / s Luminosity absorbed = 2.20953e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 13/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad         w    next_w
        Shell
        0      6510.554611  6546.768598  0.344308  0.352781

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6551.446 K -- next t_inner 6483.070 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 14/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.21777e+42 erg / s Luminosity absorbed = 2.64910e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 14/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad         w    next_w
        Shell
        0      6546.768598  6485.552351  0.352781  0.349363

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6483.070 K -- next t_inner 6551.293 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 15/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.31237e+42 erg / s Luminosity absorbed = 2.76461e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 15/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad  next_t_rad         w   next_w
        Shell
        0      6485.552351  6516.39366  0.349363  0.35982

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6551.293 K -- next t_inner 6483.402 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 16/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.21811e+42 erg / s Luminosity absorbed = 2.64705e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 16/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                    t_rad   next_t_rad        w    next_w
        Shell
        0      6516.39366  6487.025434  0.35982  0.350732

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6483.402 K -- next t_inner 6551.133 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 17/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.31225e+42 erg / s Luminosity absorbed = 2.21332e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 17/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad  next_t_rad         w    next_w
        Shell
        0      6487.025434  6541.53332  0.350732  0.354308

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6551.133 K -- next t_inner 6483.406 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 18/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.21806e+42 erg / s Luminosity absorbed = 3.18123e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 18/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                    t_rad   next_t_rad         w    next_w
        Shell
        0      6541.53332  6506.188917  0.354308  0.346155

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6483.406 K -- next t_inner 6551.206 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 19/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.31238e+42 erg / s Luminosity absorbed = 2.76543e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 19/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad         w    next_w
        Shell
        0      6506.188917  6589.429688  0.346155  0.342891

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6551.206 K -- next t_inner 6483.296 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 20/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.21775e+42 erg / s Luminosity absorbed = 5.09249e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Simulation finished in 20 iterations and took 2.68 s (base.py:306)

You can check to make sure that the model loaded and used by TARDIS during the simulation is consistent with your expectations based on the custom files you provided:

[3]:
print('v_inner_boundary = ',model.model.v_boundary_inner)
print('v_outer_boundary = ',model.model.v_boundary_outer)
print('\n')
print('velocities of shell boundaries: ')
print(model.model.velocity)
print('\n')
print('densities loaded by TARDIS: (NOTE that the density in the first line of the file was ignored! Densities are also rescaled.)')
print(model.model.density)
v_inner_boundary =  950000000.0 cm / s
v_outer_boundary =  1200000000.0 cm / s


velocities of shell boundaries:
[9.50e+08 1.05e+09 1.20e+09] cm / s


densities loaded by TARDIS: (NOTE that the density in the first line of the file was ignored! Densities are also rescaled.)
[7.5e-14 2.5e-15] g / cm3

Specifying boundary velocities in the config file

In addition to specifying custom density and abundance files, the user can set the v_inner_boundary and v_outer_boundary velocities in the YAML config file. This can cause some confusion, so we carefully go through some examples.

Important:

Boundary velocities set in the YAML config file must be within the velocity range specified in the custom density file (if one is provided).

Example 1) v_inner_boundary lower than first velocity in density file

In this example, the first velocity in the density file is 9500 km/s. The user can specify in the config file the velocity of the inner boundary to a lower velocity, say v_inner_boundary = 9000 km/s. This will cause TARDIS to raise an error.

[4]:
model = tardis.run_tardis('./test_config_ex1.yml')
[tardis.model.base   ][WARNING]  Abundances have not been normalized to 1. - normalizing (base.py:367)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-4-b0d339890022> in <module>
----> 1 model = tardis.run_tardis('./test_config_ex1.yml')

~/src/dev/tardis/tardis/base.py in run_tardis(config, atom_data, simulation_callbacks)
     35         tardis_config = Configuration.from_config_dict(config)
     36
---> 37     simulation = Simulation.from_config(tardis_config, atom_data=atom_data)
     38     for cb in simulation_callbacks:
     39         simulation.add_callback(cb)

~/src/dev/tardis/tardis/simulation/base.py in from_config(cls, config, **kwargs)
    430             model = kwargs['model']
    431         else:
--> 432             model = Radial1DModel.from_config(config)
    433         if 'plasma' in kwargs:
    434             plasma = kwargs['plasma']

~/src/dev/tardis/tardis/model/base.py in from_config(cls, config)
    383                    v_boundary_inner=structure.get('v_inner_boundary', None),
    384                    v_boundary_outer=structure.get('v_outer_boundary', None),
--> 385                    electron_densities=electron_densities)

~/src/dev/tardis/tardis/model/base.py in __init__(self, velocity, homologous_density, abundance, isotope_abundance, time_explosion, t_inner, luminosity_requested, t_radiative, dilution_factor, v_boundary_inner, v_boundary_outer, electron_densities)
     78         self._velocity = None
     79         self.raw_velocity = velocity
---> 80         self.v_boundary_inner = v_boundary_inner
     81         self.v_boundary_outer = v_boundary_outer
     82         self.homologous_density = homologous_density

~/src/dev/tardis/tardis/model/base.py in v_boundary_inner(self, value)
    237                                      'the model range.')
    238                 if value < self.raw_velocity[0]:
--> 239                     raise ValueError('v_boundary_inner is lower than the lowest shell in the model.')
    240         self._v_boundary_inner = value
    241         # Invalidate the cached cut-down velocity array

ValueError: v_boundary_inner is lower than the lowest shell in the model.

Example 2) v_outer_boundary larger than last velocity in density file

In this example, the last velocity in the density file is 12000 km/s. The user can specify in the config file the velocity of the outer boundary to a larger velocity, say v_outer_boundary = 13000 km/s. This will cause TARDIS to raise an error.

[5]:
model = tardis.run_tardis('./test_config_ex2.yml')
[tardis.model.base   ][WARNING]  Abundances have not been normalized to 1. - normalizing (base.py:367)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-5-d8f416484373> in <module>
----> 1 model = tardis.run_tardis('./test_config_ex2.yml')

~/src/dev/tardis/tardis/base.py in run_tardis(config, atom_data, simulation_callbacks)
     35         tardis_config = Configuration.from_config_dict(config)
     36
---> 37     simulation = Simulation.from_config(tardis_config, atom_data=atom_data)
     38     for cb in simulation_callbacks:
     39         simulation.add_callback(cb)

~/src/dev/tardis/tardis/simulation/base.py in from_config(cls, config, **kwargs)
    430             model = kwargs['model']
    431         else:
--> 432             model = Radial1DModel.from_config(config)
    433         if 'plasma' in kwargs:
    434             plasma = kwargs['plasma']

~/src/dev/tardis/tardis/model/base.py in from_config(cls, config)
    383                    v_boundary_inner=structure.get('v_inner_boundary', None),
    384                    v_boundary_outer=structure.get('v_outer_boundary', None),
--> 385                    electron_densities=electron_densities)

~/src/dev/tardis/tardis/model/base.py in __init__(self, velocity, homologous_density, abundance, isotope_abundance, time_explosion, t_inner, luminosity_requested, t_radiative, dilution_factor, v_boundary_inner, v_boundary_outer, electron_densities)
     79         self.raw_velocity = velocity
     80         self.v_boundary_inner = v_boundary_inner
---> 81         self.v_boundary_outer = v_boundary_outer
     82         self.homologous_density = homologous_density
     83         self._abundance = abundance

~/src/dev/tardis/tardis/model/base.py in v_boundary_outer(self, value)
    262                                      'the model range.')
    263                 if value > self.raw_velocity[-1]:
--> 264                     raise ValueError('v_boundary_outer is larger than the largest shell in the model.')
    265         self._v_boundary_outer = value
    266         # Invalidate the cached cut-down velocity array

ValueError: v_boundary_outer is larger than the largest shell in the model.

Example 3) v_boundaries in config file are within density file velocity range

Here the user sets v_inner_boundary = 9700 and v_outer_boundary = 11500 in the config file. Both values fall within the velocity range specified by the custom density file.

[6]:
model = tardis.run_tardis('./test_config_ex3.yml')
[tardis.model.base   ][WARNING]  Abundances have not been normalized to 1. - normalizing (base.py:367)
[tardis.plasma.standard_plasmas][INFO   ]  Reading Atomic Data from /home/mew488/Research/TARDIS/tardis-refdata/atom_data/kurucz_cd23_chianti_H_He.h5 (standard_plasmas.py:77)
[py.warnings         ][WARNING]  /home/mew488/anaconda2/envs/tardis3/lib/python3.6/site-packages/IPython/core/interactiveshell.py:3291: PerformanceWarning: indexing past lexsort depth may impact performance.
  exec(code_obj, self.user_global_ns, self.user_ns)
 (warnings.py:99)
[tardis.io.atomic    ][INFO   ]  Read Atom Data with UUID=6f7b09e887a311e7a06b246e96350010 and MD5=864f1753714343c41f99cb065710cace. (atomic.py:173)
[tardis.io.atomic    ][INFO   ]  Non provided atomic data: synpp_refs, ion_cx_th_data, ion_cx_sp_data (atomic.py:176)
[py.warnings         ][WARNING]  /home/mew488/src/dev/tardis/tardis/plasma/properties/ion_population.py:59: FutureWarning:
Passing list-likes to .loc or [] with any missing label will raise
KeyError in the future, you can use .reindex() as an alternative.

See the documentation here:
https://pandas.pydata.org/pandas-docs/stable/indexing.html#deprecate-loc-reindex-listlike
  partition_function.index].dropna())
 (warnings.py:99)
[py.warnings         ][WARNING]  /home/mew488/anaconda2/envs/tardis3/lib/python3.6/site-packages/astropy/units/equivalencies.py:90: RuntimeWarning: divide by zero encountered in double_scalars
  (si.m, si.Hz, lambda x: _si.c.value / x),
 (warnings.py:99)
[py.warnings         ][WARNING]  /home/mew488/anaconda2/envs/tardis3/lib/python3.6/site-packages/astropy/units/quantity.py:1067: AstropyDeprecationWarning: The truth value of a Quantity is ambiguous. In the future this will raise a ValueError.
  AstropyDeprecationWarning)
 (warnings.py:99)
[tardis.simulation.base][INFO   ]  Starting iteration 1/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.31451e+42 erg / s Luminosity absorbed = 2.20992e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 1/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad         w    next_w
        Shell
        0      6475.378267  6488.637521  0.360681  0.366243

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6484.018 K -- next t_inner 6413.863 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 2/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.21599e+42 erg / s Luminosity absorbed = 2.64272e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 2/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad         w    next_w
        Shell
        0      6488.637521  6427.216436  0.366243  0.363775

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6413.863 K -- next t_inner 6483.959 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 3/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.31470e+42 erg / s Luminosity absorbed = 1.66285e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 3/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad         w    next_w
        Shell
        0      6427.216436  6492.265498  0.363775  0.364173

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6483.959 K -- next t_inner 6413.533 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 4/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.21561e+42 erg / s Luminosity absorbed = 1.59276e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 4/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad         w    next_w
        Shell
        0      6492.265498  6417.052425  0.364173  0.366605

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6413.533 K -- next t_inner 6484.185 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 5/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.31470e+42 erg / s Luminosity absorbed = 1.65313e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 5/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad         w    next_w
        Shell
        0      6417.052425  6482.377118  0.366605  0.368425

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6484.185 K -- next t_inner 6413.755 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 6/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.21602e+42 erg / s Luminosity absorbed = 1.05695e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 6/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad         w    next_w
        Shell
        0      6482.377118  6394.506844  0.368425  0.371037

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6413.755 K -- next t_inner 6483.813 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 7/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.31410e+42 erg / s Luminosity absorbed = 2.76180e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 7/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad         w   next_w
        Shell
        0      6394.506844  6519.309507  0.371037  0.36027

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6483.813 K -- next t_inner 6414.228 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 8/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.21639e+42 erg / s Luminosity absorbed = 2.64764e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 8/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad        w    next_w
        Shell
        0      6519.309507  6383.889203  0.36027  0.374686

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6414.228 K -- next t_inner 6483.748 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 9/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.31428e+42 erg / s Luminosity absorbed = 5.54016e+37 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 9/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad         w    next_w
        Shell
        0      6383.889203  6473.974678  0.374686  0.369973

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6483.748 K -- next t_inner 6413.915 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 10/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.21596e+42 erg / s Luminosity absorbed = 2.63810e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 10/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad         w    next_w
        Shell
        0      6473.974678  6406.611113  0.369973  0.369657

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6413.915 K -- next t_inner 6484.063 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 11/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.31457e+42 erg / s Luminosity absorbed = 2.20714e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 11/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad  next_t_rad         w    next_w
        Shell
        0      6406.611113  6501.97906  0.369657  0.363763

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6484.063 K -- next t_inner 6413.825 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 12/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.21609e+42 erg / s Luminosity absorbed = 1.59204e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 12/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                    t_rad   next_t_rad         w    next_w
        Shell
        0      6501.97906  6442.380908  0.363763  0.360018

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6413.825 K -- next t_inner 6483.774 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 13/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.31415e+42 erg / s Luminosity absorbed = 1.64927e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 13/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad         w    next_w
        Shell
        0      6442.380908  6479.130222  0.360018  0.369277

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6483.774 K -- next t_inner 6414.121 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 14/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.21646e+42 erg / s Luminosity absorbed = 1.59283e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 14/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad         w    next_w
        Shell
        0      6479.130222  6416.085322  0.369277  0.365588

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6414.121 K -- next t_inner 6483.538 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 15/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.31368e+42 erg / s Luminosity absorbed = 2.20875e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 15/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad         w    next_w
        Shell
        0      6416.085322  6449.419113  0.365588  0.376548

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6483.538 K -- next t_inner 6414.538 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 16/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.21696e+42 erg / s Luminosity absorbed = 1.05743e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 16/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad         w    next_w
        Shell
        0      6449.419113  6417.878262  0.376548  0.367147

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6414.538 K -- next t_inner 6483.218 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 17/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.31321e+42 erg / s Luminosity absorbed = 2.75526e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 17/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad         w    next_w
        Shell
        0      6417.878262  6473.045585  0.367147  0.371157

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6483.218 K -- next t_inner 6414.863 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 18/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.21737e+42 erg / s Luminosity absorbed = 1.58484e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 18/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad         w    next_w
        Shell
        0      6473.045585  6436.504989  0.371157  0.362441

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6414.863 K -- next t_inner 6482.959 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 19/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.31299e+42 erg / s Luminosity absorbed = 2.20411e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Iteration converged 19/4 consecutive times. (base.py:194)
[tardis.simulation.base][INFO   ]  Plasma stratification:
                     t_rad   next_t_rad         w    next_w
        Shell
        0      6436.504989  6520.140466  0.362441  0.358913

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 6482.959 K -- next t_inner 6414.912 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 20/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 2.21744e+42 erg / s Luminosity absorbed = 1.90600e+38 erg / s Luminosity requested = 2.26469e+42 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Simulation finished in 20 iterations and took 2.44 s (base.py:306)
[7]:
print('v_inner_boundary = ',model.model.v_boundary_inner)
print('v_outer_boundary = ',model.model.v_boundary_outer)
print('\n')
print('velocities of shell boundaries: ')
print(model.model.velocity)
print('\n')
print('densities loaded by TARDIS: (NOTE that the density in the first line of the file was ignored! Densities are also rescaled.)')
print(model.model.density)
v_inner_boundary =  970000000.0 cm / s
v_outer_boundary =  1150000000.0 cm / s


velocities of shell boundaries:
[9.70e+08 1.05e+09 1.15e+09] cm / s


densities loaded by TARDIS: (NOTE that the density in the first line of the file was ignored! Densities are also rescaled.)
[7.5e-14 2.5e-15] g / cm3

Important:

Notice that the inner and outer boundary velocities are the ones specifically set by the user.