You can interact with this notebook online: Launch notebook

Non-Homologous TARDIS Workflow

[1]:
from numba import config as nbconfig

nbconfig.DISABLE_JIT = False
[2]:
import matplotlib.pyplot as plt

from tardis.io.configuration.config_reader import Configuration
from tardis.workflows.nonhomologous_tardis_workflow import (
    NonhomologousTARDISWorkflow,
)
from tardis.workflows.simple_tardis_workflow import SimpleTARDISWorkflow

Initializing tabulator and plotly panel extensions for widgets to work
Auto-detected Sphinx build environment
Auto-detected Sphinx build environment
[3]:
config = Configuration.from_yaml('../tardis_example.yml')
config.montecarlo['enable_full_relativity'] = False
[4]:
workflow = NonhomologousTARDISWorkflow(config, show_convergence_plots=True)
hom_workflow = SimpleTARDISWorkflow(config)
[5]:
workflow.run()
Shell No. t_rad next_t_rad w next_w
0 9.93e+03 K 1.01e+04 K 0.4 0.511
5 9.85e+03 K 1.03e+04 K 0.211 0.193
10 9.78e+03 K 1.02e+04 K 0.143 0.115
15 9.71e+03 K 9.94e+03 K 0.105 0.085
Shell No. t_rad next_t_rad w next_w
0 1.01e+04 K 1.09e+04 K 0.511 0.511
5 1.03e+04 K 1.11e+04 K 0.193 0.196
10 1.02e+04 K 1.08e+04 K 0.115 0.126
15 9.94e+03 K 1.05e+04 K 0.085 0.0922
Shell No. t_rad next_t_rad w next_w
0 1.09e+04 K 1.1e+04 K 0.511 0.478
5 1.11e+04 K 1.13e+04 K 0.196 0.183
10 1.08e+04 K 1.09e+04 K 0.126 0.119
15 1.05e+04 K 1.06e+04 K 0.0922 0.0885
Shell No. t_rad next_t_rad w next_w
0 1.1e+04 K 1.11e+04 K 0.478 0.465
5 1.13e+04 K 1.13e+04 K 0.183 0.179
10 1.09e+04 K 1.1e+04 K 0.119 0.113
15 1.06e+04 K 1.07e+04 K 0.0885 0.0843
Shell No. t_rad next_t_rad w next_w
0 1.11e+04 K 1.1e+04 K 0.465 0.479
5 1.13e+04 K 1.13e+04 K 0.179 0.177
10 1.1e+04 K 1.11e+04 K 0.113 0.11
15 1.07e+04 K 1.08e+04 K 0.0843 0.0825
Shell No. t_rad next_t_rad w next_w
0 1.1e+04 K 1.1e+04 K 0.479 0.47
5 1.13e+04 K 1.12e+04 K 0.177 0.186
10 1.11e+04 K 1.1e+04 K 0.11 0.114
15 1.08e+04 K 1.07e+04 K 0.0825 0.0838
Shell No. t_rad next_t_rad w next_w
0 1.1e+04 K 1.1e+04 K 0.47 0.468
5 1.12e+04 K 1.13e+04 K 0.186 0.176
10 1.1e+04 K 1.11e+04 K 0.114 0.109
15 1.07e+04 K 1.07e+04 K 0.0838 0.0832
Shell No. t_rad next_t_rad w next_w
0 1.1e+04 K 1.11e+04 K 0.468 0.47
5 1.13e+04 K 1.14e+04 K 0.176 0.174
10 1.11e+04 K 1.11e+04 K 0.109 0.111
15 1.07e+04 K 1.07e+04 K 0.0832 0.0836
Shell No. t_rad next_t_rad w next_w
0 1.11e+04 K 1.11e+04 K 0.47 0.465
5 1.14e+04 K 1.14e+04 K 0.174 0.174
10 1.11e+04 K 1.12e+04 K 0.111 0.108
15 1.07e+04 K 1.08e+04 K 0.0836 0.0822
Shell No. t_rad next_t_rad w next_w
0 1.11e+04 K 1.1e+04 K 0.465 0.478
5 1.14e+04 K 1.14e+04 K 0.174 0.173
10 1.12e+04 K 1.11e+04 K 0.108 0.111
15 1.08e+04 K 1.07e+04 K 0.0822 0.0836
Shell No. t_rad next_t_rad w next_w
0 1.1e+04 K 1.1e+04 K 0.478 0.476
5 1.14e+04 K 1.13e+04 K 0.173 0.181
10 1.11e+04 K 1.1e+04 K 0.111 0.113
15 1.07e+04 K 1.08e+04 K 0.0836 0.082
Shell No. t_rad next_t_rad w next_w
0 1.1e+04 K 1.11e+04 K 0.476 0.464
5 1.13e+04 K 1.13e+04 K 0.181 0.179
10 1.1e+04 K 1.11e+04 K 0.113 0.111
15 1.08e+04 K 1.07e+04 K 0.082 0.0845
Shell No. t_rad next_t_rad w next_w
0 1.11e+04 K 1.11e+04 K 0.464 0.466
5 1.13e+04 K 1.14e+04 K 0.179 0.175
10 1.11e+04 K 1.11e+04 K 0.111 0.113
15 1.07e+04 K 1.07e+04 K 0.0845 0.0852
Shell No. t_rad next_t_rad w next_w
0 1.11e+04 K 1.1e+04 K 0.466 0.471
5 1.14e+04 K 1.13e+04 K 0.175 0.178
10 1.11e+04 K 1.11e+04 K 0.113 0.111
15 1.07e+04 K 1.07e+04 K 0.0852 0.0851
Shell No. t_rad next_t_rad w next_w
0 1.1e+04 K 1.1e+04 K 0.471 0.479
5 1.13e+04 K 1.12e+04 K 0.178 0.183
10 1.11e+04 K 1.1e+04 K 0.111 0.114
15 1.07e+04 K 1.07e+04 K 0.0851 0.0837
Shell No. t_rad next_t_rad w next_w
0 1.1e+04 K 1.11e+04 K 0.479 0.466
5 1.12e+04 K 1.14e+04 K 0.183 0.169
10 1.1e+04 K 1.11e+04 K 0.114 0.111
15 1.07e+04 K 1.08e+04 K 0.0837 0.0813
Shell No. t_rad next_t_rad w next_w
0 1.11e+04 K 1.11e+04 K 0.466 0.464
5 1.14e+04 K 1.14e+04 K 0.169 0.176
10 1.11e+04 K 1.12e+04 K 0.111 0.106
15 1.08e+04 K 1.08e+04 K 0.0813 0.0829
Shell No. t_rad next_t_rad w next_w
0 1.11e+04 K 1.11e+04 K 0.464 0.462
5 1.14e+04 K 1.14e+04 K 0.176 0.174
10 1.12e+04 K 1.11e+04 K 0.106 0.11
15 1.08e+04 K 1.07e+04 K 0.0829 0.0841
Shell No. t_rad next_t_rad w next_w
0 1.11e+04 K 1.11e+04 K 0.462 0.465
5 1.14e+04 K 1.15e+04 K 0.174 0.168
10 1.11e+04 K 1.12e+04 K 0.11 0.108
15 1.07e+04 K 1.07e+04 K 0.0841 0.0828
Shell No. t_rad next_t_rad w next_w
0 1.11e+04 K 1.11e+04 K 0.465 0.467
5 1.15e+04 K 1.15e+04 K 0.168 0.171
10 1.12e+04 K 1.11e+04 K 0.108 0.109
15 1.07e+04 K 1.08e+04 K 0.0828 0.0824
[6]:
hom_workflow.run()
[7]:
spectrum = workflow.spectrum_solver.spectrum_real_packets
spectrum_virtual = workflow.spectrum_solver.spectrum_virtual_packets
spectrum_integrated = workflow.spectrum_solver.spectrum_integrated
hom_spectrum = hom_workflow.spectrum_solver.spectrum_real_packets
hom_spectrum_virtual = hom_workflow.spectrum_solver.spectrum_virtual_packets
hom_spectrum_integrated = workflow.spectrum_solver.spectrum_integrated
[8]:
%matplotlib inline
plt.figure(figsize=(10, 6.5))

spectrum.plot(label="Normal packets, non-homology", c='C0', alpha=0.1)
hom_spectrum.plot(label="Normal packets, homology", c='C1', alpha=0.1)

spectrum_virtual.plot(linewidth=3, c='w', alpha=1.0)
hom_spectrum_virtual.plot(linewidth=4, c='w', alpha=1.0)
spectrum_virtual.plot(label="Virtual packets, non-homology", c='C0', alpha=0.35)
hom_spectrum_virtual.plot(label="Virtual packets, homology", c='C1', alpha=0.35)

spectrum_integrated.plot(linewidth=3, c='w', alpha=1.0)
spectrum_integrated.plot(label="Formal Integral, non-homology", c='C0', alpha=1.0)
hom_spectrum_integrated.plot(label="Formal Integral, homology", c='C1', alpha=1.0, linestyle='--')


plt.xlim(500, 9000)
plt.title("TARDIS example model spectrum")
plt.xlabel(r"Wavelength [$\AA$]")
plt.ylabel(r"Luminosity density [erg/s/$\AA$]")
plt.legend()
plt.show()
../_images/workflows_nonhomologous_workflow_8_0.svg