Simple Jupyter TARDIS Example


In [1]:
from tardis import run_tardis
from tardis.io.atom_data.util import download_atom_data


/Users/wkerzend/miniconda/envs/tardis3/lib/python3.6/site-packages/tqdm/autonotebook/__init__.py:14: TqdmExperimentalWarning: Using `tqdm.autonotebook.tqdm` in notebook mode. Use `tqdm.tqdm` instead to force console mode (e.g. in jupyter console)
  " (e.g. in jupyter console)", TqdmExperimentalWarning)

In [3]:
# the data is automatically downloaded
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 /Users/wkerzend/projects/tardis/tardis-data/kurucz_cd23_chianti_H_He.h5 (atom_web_download.py:37)


In [4]:
#TARDIS now uses the data in the data repo
sim = run_tardis('tardis_example.yml')


[tardis.plasma.standard_plasmas][INFO   ]  Reading Atomic Data from kurucz_cd23_chianti_H_He.h5 (standard_plasmas.py:76)
[tardis.io.atom_data.util][INFO   ]  Atom Data kurucz_cd23_chianti_H_He.h5 not found in local path. Exists in TARDIS Data repo /Users/wkerzend/projects/tardis/tardis-data/kurucz_cd23_chianti_H_He.h5 (util.py:29)
[py.warnings         ][WARNING]  /Users/wkerzend/miniconda/envs/tardis3/lib/python3.6/site-packages/IPython/core/interactiveshell.py:3267: PerformanceWarning: indexing past lexsort depth may impact performance.
  exec(code_obj, self.user_global_ns, self.user_ns)
 (warnings.py:99)
[tardis.io.atom_data.base][INFO   ]  Read Atom Data with UUID=6f7b09e887a311e7a06b246e96350010 and MD5=864f1753714343c41f99cb065710cace. (base.py:175)
[tardis.io.atom_data.base][INFO   ]  Non provided atomic data: synpp_refs, ion_cx_th_data, ion_cx_sp_data (base.py:178)
[py.warnings         ][WARNING]  /Users/wkerzend/miniconda/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)
[py.warnings         ][WARNING]  /Users/wkerzend/python/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]  /Users/wkerzend/miniconda/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]  /Users/wkerzend/miniconda/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 = 7.96915e+42 erg / s Luminosity absorbed = 2.63370e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Plasma stratification:
	             t_rad    next_t_rad         w    next_w
	Shell                                               
	0      9926.501965  10171.209103  0.400392  0.500372
	5      9852.611678  10306.111379  0.211205  0.191331
	10     9779.813302  10174.379204  0.142695  0.116864
	15     9708.082813   9910.442275  0.104556  0.085962

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 9933.952 K -- next t_inner 11453.040 K (base.py:350)
[py.warnings         ][WARNING]  /Users/wkerzend/python/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)
[tardis.simulation.base][INFO   ]  Starting iteration 2/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 1.40398e+43 erg / s Luminosity absorbed = 4.68639e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Plasma stratification:
	              t_rad    next_t_rad         w    next_w
	Shell                                                
	0      10171.209103  11518.516702  0.500372  0.538298
	5      10306.111379  11554.412119  0.191331  0.217946
	10     10174.379204  11373.574056  0.116864  0.132935
	15      9910.442275  11040.788763  0.085962  0.099700

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 11453.040 K -- next t_inner 9948.201 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 3/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 8.16814e+42 erg / s Luminosity absorbed = 2.50161e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Plasma stratification:
	              t_rad    next_t_rad         w    next_w
	Shell                                                
	0      11518.516702  10501.129902  0.538298  0.438591
	5      11554.412119  10869.940791  0.217946  0.160809
	10     11373.574056  10558.269547  0.132935  0.103807
	15     11040.788763  10185.648701  0.099700  0.079165

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 9948.201 K -- next t_inner 11328.896 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 4/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 1.34487e+43 erg / s Luminosity absorbed = 4.47931e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Plasma stratification:
	              t_rad    next_t_rad         w    next_w
	Shell                                                
	0      10501.129902  11527.008679  0.438591  0.512509
	5      10869.940791  11706.138980  0.160809  0.196458
	10     10558.269547  11444.208532  0.103807  0.124092
	15     10185.648701  11085.857161  0.079165  0.093694

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 11328.896 K -- next t_inner 10054.300 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 5/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 8.44348e+42 erg / s Luminosity absorbed = 2.68000e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Plasma stratification:
	              t_rad    next_t_rad         w    next_w
	Shell                                                
	0      11527.008679  10659.382763  0.512509  0.433573
	5      11706.138980  11038.244897  0.196458  0.158494
	10     11444.208532  10790.696726  0.124092  0.099660
	15     11085.857161  10450.666394  0.093694  0.074550

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 10054.300 K -- next t_inner 11261.489 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 6/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 1.32492e+43 erg / s Luminosity absorbed = 4.26229e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Plasma stratification:
	              t_rad    next_t_rad         w    next_w
	Shell                                                
	0      10659.382763  11507.437689  0.433573  0.499441
	5      11038.244897  11634.568776  0.158494  0.197953
	10     10790.696726  11418.594559  0.099660  0.124085
	15     10450.666394  10999.619473  0.074550  0.094676

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 11261.489 K -- next t_inner 10069.444 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 7/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 8.49858e+42 erg / s Luminosity absorbed = 2.69247e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Plasma stratification:
	              t_rad    next_t_rad         w    next_w
	Shell                                                
	0      11507.437689  10679.650246  0.499441  0.431088
	5      11634.568776  11048.266431  0.197953  0.157179
	10     11418.594559  10825.714870  0.124085  0.098608
	15     10999.619473  10506.321595  0.094676  0.073794

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 10069.444 K -- next t_inner 11241.826 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 8/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 1.30632e+43 erg / s Luminosity absorbed = 4.31719e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Plasma stratification:
	              t_rad    next_t_rad         w    next_w
	Shell                                                
	0      10679.650246  11459.828312  0.431088  0.506176
	5      11048.266431  11688.139012  0.157179  0.193468
	10     10825.714870  11441.768967  0.098608  0.122412
	15     10506.321595  11099.449886  0.073794  0.090915

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 11241.826 K -- next t_inner 10123.177 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 9/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 8.68357e+42 erg / s Luminosity absorbed = 2.75015e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Plasma stratification:
	              t_rad    next_t_rad         w    next_w
	Shell                                                
	0      11459.828312  10666.223660  0.506176  0.445097
	5      11688.139012  11000.288585  0.193468  0.163424
	10     11441.768967  10822.884326  0.122412  0.101641
	15     11099.449886  10384.181273  0.090915  0.078432

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 10123.177 K -- next t_inner 11180.783 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 10/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 1.28170e+43 erg / s Luminosity absorbed = 4.19511e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Plasma stratification:
	              t_rad    next_t_rad         w    next_w
	Shell                                                
	0      10666.223660  11427.410445  0.445097  0.500788
	5      11000.288585  11612.349822  0.163424  0.193129
	10     10822.884326  11373.245169  0.101641  0.121622
	15     10384.181273  11047.955461  0.078432  0.090937

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 11180.783 K -- next t_inner 10164.432 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 11/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 8.79074e+42 erg / s Luminosity absorbed = 2.82804e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Plasma stratification:
	              t_rad    next_t_rad         w    next_w
	Shell                                                
	0      11427.410445  10741.337822  0.500788  0.439938
	5      11612.349822  11230.515356  0.193129  0.153637
	10     11373.245169  10870.696315  0.121622  0.101050
	15     11047.955461  10538.170159  0.090937  0.074680

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 10164.432 K -- next t_inner 11157.711 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 12/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 1.27128e+43 erg / s Luminosity absorbed = 4.15415e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Plasma stratification:
	              t_rad    next_t_rad         w    next_w
	Shell                                                
	0      10741.337822  11507.877578  0.439938  0.483114
	5      11230.515356  11808.852053  0.153637  0.181826
	10     10870.696315  11557.412757  0.101050  0.113563
	15     10538.170159  11117.762050  0.074680  0.087418

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 11157.711 K -- next t_inner 10184.966 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 13/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 8.90399e+42 erg / s Luminosity absorbed = 2.80864e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Plasma stratification:
	              t_rad    next_t_rad         w    next_w
	Shell                                                
	0      11507.877578  10727.217531  0.483114  0.443706
	5      11808.852053  11171.758889  0.181826  0.160824
	10     11557.412757  10971.722637  0.113563  0.098588
	15     11117.762050  10574.916600  0.087418  0.075266

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 10184.966 K -- next t_inner 11108.923 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 14/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 1.25052e+43 erg / s Luminosity absorbed = 4.07335e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Plasma stratification:
	              t_rad    next_t_rad         w    next_w
	Shell                                                
	0      10727.217531  11413.626870  0.443706  0.489526
	5      11171.758889  11697.006992  0.160824  0.184795
	10     10971.722637  11424.445844  0.098588  0.116722
	15     10574.916600  11047.434163  0.075266  0.088067

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 11108.923 K -- next t_inner 10224.266 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 15/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 9.00727e+42 erg / s Luminosity absorbed = 2.88724e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Plasma stratification:
	              t_rad    next_t_rad         w    next_w
	Shell                                                
	0      11413.626870  10712.622749  0.489526  0.455660
	5      11697.006992  11125.894032  0.184795  0.164091
	10     11424.445844  10816.390451  0.116722  0.104037
	15     11047.434163  10421.687097  0.088067  0.080401

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 10224.266 K -- next t_inner 11087.666 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 16/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 1.23781e+43 erg / s Luminosity absorbed = 4.07435e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Plasma stratification:
	              t_rad    next_t_rad         w    next_w
	Shell                                                
	0      10712.622749  11352.158138  0.455660  0.500754
	5      11125.894032  11644.968350  0.164091  0.185289
	10     10816.390451  11320.695930  0.104037  0.119195
	15     10421.687097  10965.228363  0.080401  0.089940

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 11087.666 K -- next t_inner 10256.946 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 17/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 9.18956e+42 erg / s Luminosity absorbed = 2.86249e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Plasma stratification:
	              t_rad    next_t_rad         w    next_w
	Shell                                                
	0      11352.158138  10738.799194  0.500754  0.452965
	5      11644.968350  11210.269586  0.185289  0.160945
	10     11320.695930  10911.463205  0.119195  0.103910
	15     10965.228363  10545.065525  0.089940  0.078433

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 10256.946 K -- next t_inner 11012.230 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 18/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 1.20741e+43 erg / s Luminosity absorbed = 3.93375e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Plasma stratification:
	              t_rad    next_t_rad         w    next_w
	Shell                                                
	0      10738.799194  11316.665617  0.452965  0.492135
	5      11210.269586  11599.094127  0.160945  0.183929
	10     10911.463205  11403.508986  0.103910  0.114400
	15     10545.065525  10958.974248  0.078433  0.087415

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 11012.230 K -- next t_inner 10314.623 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 19/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 9.29848e+42 erg / s Luminosity absorbed = 3.02011e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Plasma stratification:
	              t_rad    next_t_rad         w    next_w
	Shell                                                
	0      11316.665617  10862.505720  0.492135  0.444495
	5      11599.094127  11194.462074  0.183929  0.162842
	10     11403.508986  11065.620645  0.114400  0.099372
	15     10958.974248  10599.851144  0.087415  0.077690

 (base.py:348)
[tardis.simulation.base][INFO   ]  t_inner 10314.623 K -- next t_inner 11009.102 K (base.py:350)
[tardis.simulation.base][INFO   ]  Starting iteration 20/20 (base.py:266)
[tardis.simulation.base][INFO   ]  Luminosity emitted = 1.21062e+43 erg / s Luminosity absorbed = 3.88405e+42 erg / s Luminosity requested = 1.05928e+43 erg / s (base.py:357)
[tardis.simulation.base][INFO   ]  Simulation finished in 20 iterations and took 23.02 s (base.py:306)

In [5]:
%pylab notebook

spectrum = sim.runner.spectrum_integrated

plot(spectrum.wavelength, spectrum.luminosity_density_lambda)


[py.warnings         ][WARNING]  /Users/wkerzend/miniconda/envs/tardis3/lib/python3.6/site-packages/matplotlib/style/core.py:167: UserWarning: In /Users/wkerzend/.matplotlib/stylelib/talk_default.mplstyle: 
The text.latex.unicode rcparam was deprecated in Matplotlib 2.2 and will be removed in 3.1.
  styles = read_style_directory(stylelib_path)
 (warnings.py:99)
Populating the interactive namespace from numpy and matplotlib
[py.warnings         ][WARNING]  /Users/wkerzend/miniconda/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)
[py.warnings         ][WARNING]  /Users/wkerzend/python/tardis/tardis/montecarlo/formal_integral.py:167: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.
  result = pd.DataFrame(att_S_ul.as_matrix(), index=transitions.transition_line_id.values)
 (warnings.py:99)
Out[5]:
[<matplotlib.lines.Line2D at 0x1259528d0>]

In [ ]: