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.0886 |
| 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.18 |
| 10 | 1.09e+04 K | 1.1e+04 K | 0.119 | 0.113 |
| 15 | 1.06e+04 K | 1.07e+04 K | 0.0886 | 0.0843 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.11e+04 K | 1.1e+04 K | 0.465 | 0.48 |
| 5 | 1.13e+04 K | 1.13e+04 K | 0.18 | 0.177 |
| 10 | 1.1e+04 K | 1.11e+04 K | 0.113 | 0.111 |
| 15 | 1.07e+04 K | 1.08e+04 K | 0.0843 | 0.0826 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.1e+04 K | 1.11e+04 K | 0.48 | 0.466 |
| 5 | 1.13e+04 K | 1.12e+04 K | 0.177 | 0.186 |
| 10 | 1.11e+04 K | 1.1e+04 K | 0.111 | 0.114 |
| 15 | 1.08e+04 K | 1.07e+04 K | 0.0826 | 0.0844 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.11e+04 K | 1.11e+04 K | 0.466 | 0.465 |
| 5 | 1.12e+04 K | 1.12e+04 K | 0.186 | 0.181 |
| 10 | 1.1e+04 K | 1.11e+04 K | 0.114 | 0.111 |
| 15 | 1.07e+04 K | 1.07e+04 K | 0.0844 | 0.0838 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.11e+04 K | 1.11e+04 K | 0.465 | 0.466 |
| 5 | 1.12e+04 K | 1.14e+04 K | 0.181 | 0.176 |
| 10 | 1.11e+04 K | 1.11e+04 K | 0.111 | 0.11 |
| 15 | 1.07e+04 K | 1.07e+04 K | 0.0838 | 0.0859 |
| 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.13e+04 K | 0.176 | 0.178 |
| 10 | 1.11e+04 K | 1.11e+04 K | 0.11 | 0.109 |
| 15 | 1.07e+04 K | 1.07e+04 K | 0.0859 | 0.0833 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.11e+04 K | 1.1e+04 K | 0.464 | 0.479 |
| 5 | 1.13e+04 K | 1.14e+04 K | 0.178 | 0.176 |
| 10 | 1.11e+04 K | 1.11e+04 K | 0.109 | 0.11 |
| 15 | 1.07e+04 K | 1.07e+04 K | 0.0833 | 0.0844 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.1e+04 K | 1.1e+04 K | 0.479 | 0.478 |
| 5 | 1.14e+04 K | 1.13e+04 K | 0.176 | 0.179 |
| 10 | 1.11e+04 K | 1.1e+04 K | 0.11 | 0.113 |
| 15 | 1.07e+04 K | 1.07e+04 K | 0.0844 | 0.0849 |
| 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.14e+04 K | 0.179 | 0.176 |
| 10 | 1.1e+04 K | 1.11e+04 K | 0.113 | 0.111 |
| 15 | 1.07e+04 K | 1.07e+04 K | 0.0849 | 0.0832 |
| 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.14e+04 K | 1.14e+04 K | 0.176 | 0.172 |
| 10 | 1.11e+04 K | 1.11e+04 K | 0.111 | 0.109 |
| 15 | 1.07e+04 K | 1.07e+04 K | 0.0832 | 0.0847 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.11e+04 K | 1.1e+04 K | 0.467 | 0.473 |
| 5 | 1.14e+04 K | 1.13e+04 K | 0.172 | 0.179 |
| 10 | 1.11e+04 K | 1.11e+04 K | 0.109 | 0.112 |
| 15 | 1.07e+04 K | 1.07e+04 K | 0.0847 | 0.0843 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.1e+04 K | 1.1e+04 K | 0.473 | 0.477 |
| 5 | 1.13e+04 K | 1.13e+04 K | 0.179 | 0.18 |
| 10 | 1.11e+04 K | 1.11e+04 K | 0.112 | 0.112 |
| 15 | 1.07e+04 K | 1.07e+04 K | 0.0843 | 0.0856 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.1e+04 K | 1.11e+04 K | 0.477 | 0.467 |
| 5 | 1.13e+04 K | 1.15e+04 K | 0.18 | 0.168 |
| 10 | 1.11e+04 K | 1.11e+04 K | 0.112 | 0.11 |
| 15 | 1.07e+04 K | 1.07e+04 K | 0.0856 | 0.0832 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.11e+04 K | 1.11e+04 K | 0.467 | 0.461 |
| 5 | 1.15e+04 K | 1.14e+04 K | 0.168 | 0.176 |
| 10 | 1.11e+04 K | 1.13e+04 K | 0.11 | 0.104 |
| 15 | 1.07e+04 K | 1.08e+04 K | 0.0832 | 0.082 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.11e+04 K | 1.11e+04 K | 0.461 | 0.46 |
| 5 | 1.14e+04 K | 1.14e+04 K | 0.176 | 0.172 |
| 10 | 1.13e+04 K | 1.12e+04 K | 0.104 | 0.109 |
| 15 | 1.08e+04 K | 1.07e+04 K | 0.082 | 0.0838 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.11e+04 K | 1.11e+04 K | 0.46 | 0.465 |
| 5 | 1.14e+04 K | 1.14e+04 K | 0.172 | 0.171 |
| 10 | 1.12e+04 K | 1.12e+04 K | 0.109 | 0.106 |
| 15 | 1.07e+04 K | 1.08e+04 K | 0.0838 | 0.0804 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.11e+04 K | 1.11e+04 K | 0.465 | 0.468 |
| 5 | 1.14e+04 K | 1.15e+04 K | 0.171 | 0.17 |
| 10 | 1.12e+04 K | 1.12e+04 K | 0.106 | 0.109 |
| 15 | 1.08e+04 K | 1.08e+04 K | 0.0804 | 0.0822 |
[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()