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('../nonhomologous_tardis_example.yml')
homologous_config = Configuration.from_yaml('../tardis_example.yml')
config.montecarlo['enable_full_relativity'] = False
homologous_config.montecarlo['enable_full_relativity'] = False
[4]:
workflow = NonhomologousTARDISWorkflow(config, show_convergence_plots=True)
hom_workflow = SimpleTARDISWorkflow(homologous_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.52 |
| 5 | 9.85e+03 K | 1.01e+04 K | 0.211 | 0.204 |
| 10 | 9.78e+03 K | 1e+04 K | 0.143 | 0.123 |
| 15 | 9.71e+03 K | 9.79e+03 K | 0.105 | 0.0903 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.01e+04 K | 1.08e+04 K | 0.52 | 0.529 |
| 5 | 1.01e+04 K | 1.08e+04 K | 0.204 | 0.215 |
| 10 | 1e+04 K | 1.07e+04 K | 0.123 | 0.13 |
| 15 | 9.79e+03 K | 1.04e+04 K | 0.0903 | 0.0972 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.08e+04 K | 1.09e+04 K | 0.529 | 0.499 |
| 5 | 1.08e+04 K | 1.09e+04 K | 0.215 | 0.203 |
| 10 | 1.07e+04 K | 1.07e+04 K | 0.13 | 0.127 |
| 15 | 1.04e+04 K | 1.05e+04 K | 0.0972 | 0.0934 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.09e+04 K | 1.09e+04 K | 0.499 | 0.482 |
| 5 | 1.09e+04 K | 1.09e+04 K | 0.203 | 0.203 |
| 10 | 1.07e+04 K | 1.07e+04 K | 0.127 | 0.126 |
| 15 | 1.05e+04 K | 1.05e+04 K | 0.0934 | 0.0922 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.09e+04 K | 1.09e+04 K | 0.482 | 0.5 |
| 5 | 1.09e+04 K | 1.1e+04 K | 0.203 | 0.195 |
| 10 | 1.07e+04 K | 1.08e+04 K | 0.126 | 0.123 |
| 15 | 1.05e+04 K | 1.05e+04 K | 0.0922 | 0.0908 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.09e+04 K | 1.09e+04 K | 0.5 | 0.492 |
| 5 | 1.1e+04 K | 1.09e+04 K | 0.195 | 0.203 |
| 10 | 1.08e+04 K | 1.08e+04 K | 0.123 | 0.125 |
| 15 | 1.05e+04 K | 1.05e+04 K | 0.0908 | 0.092 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.09e+04 K | 1.09e+04 K | 0.492 | 0.493 |
| 5 | 1.09e+04 K | 1.1e+04 K | 0.203 | 0.194 |
| 10 | 1.08e+04 K | 1.08e+04 K | 0.125 | 0.124 |
| 15 | 1.05e+04 K | 1.04e+04 K | 0.092 | 0.0925 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.09e+04 K | 1.09e+04 K | 0.493 | 0.49 |
| 5 | 1.1e+04 K | 1.1e+04 K | 0.194 | 0.198 |
| 10 | 1.08e+04 K | 1.07e+04 K | 0.124 | 0.126 |
| 15 | 1.04e+04 K | 1.04e+04 K | 0.0925 | 0.0932 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.09e+04 K | 1.09e+04 K | 0.49 | 0.49 |
| 5 | 1.1e+04 K | 1.1e+04 K | 0.198 | 0.196 |
| 10 | 1.07e+04 K | 1.07e+04 K | 0.126 | 0.124 |
| 15 | 1.04e+04 K | 1.05e+04 K | 0.0932 | 0.0911 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.09e+04 K | 1.09e+04 K | 0.49 | 0.503 |
| 5 | 1.1e+04 K | 1.1e+04 K | 0.196 | 0.198 |
| 10 | 1.07e+04 K | 1.08e+04 K | 0.124 | 0.124 |
| 15 | 1.05e+04 K | 1.04e+04 K | 0.0911 | 0.0937 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.09e+04 K | 1.09e+04 K | 0.503 | 0.5 |
| 5 | 1.1e+04 K | 1.1e+04 K | 0.198 | 0.198 |
| 10 | 1.08e+04 K | 1.07e+04 K | 0.124 | 0.125 |
| 15 | 1.04e+04 K | 1.04e+04 K | 0.0937 | 0.0918 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.09e+04 K | 1.09e+04 K | 0.5 | 0.489 |
| 5 | 1.1e+04 K | 1.1e+04 K | 0.198 | 0.195 |
| 10 | 1.07e+04 K | 1.07e+04 K | 0.125 | 0.125 |
| 15 | 1.04e+04 K | 1.05e+04 K | 0.0918 | 0.0921 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.09e+04 K | 1.09e+04 K | 0.489 | 0.493 |
| 5 | 1.1e+04 K | 1.11e+04 K | 0.195 | 0.193 |
| 10 | 1.07e+04 K | 1.08e+04 K | 0.125 | 0.121 |
| 15 | 1.05e+04 K | 1.05e+04 K | 0.0921 | 0.0906 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.09e+04 K | 1.09e+04 K | 0.493 | 0.495 |
| 5 | 1.11e+04 K | 1.1e+04 K | 0.193 | 0.198 |
| 10 | 1.08e+04 K | 1.08e+04 K | 0.121 | 0.125 |
| 15 | 1.05e+04 K | 1.04e+04 K | 0.0906 | 0.0931 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.09e+04 K | 1.09e+04 K | 0.495 | 0.501 |
| 5 | 1.1e+04 K | 1.09e+04 K | 0.198 | 0.201 |
| 10 | 1.08e+04 K | 1.08e+04 K | 0.125 | 0.123 |
| 15 | 1.04e+04 K | 1.05e+04 K | 0.0931 | 0.0921 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.09e+04 K | 1.09e+04 K | 0.501 | 0.494 |
| 5 | 1.09e+04 K | 1.1e+04 K | 0.201 | 0.193 |
| 10 | 1.08e+04 K | 1.08e+04 K | 0.123 | 0.123 |
| 15 | 1.05e+04 K | 1.04e+04 K | 0.0921 | 0.0927 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.09e+04 K | 1.09e+04 K | 0.494 | 0.491 |
| 5 | 1.1e+04 K | 1.11e+04 K | 0.193 | 0.187 |
| 10 | 1.08e+04 K | 1.09e+04 K | 0.123 | 0.118 |
| 15 | 1.04e+04 K | 1.05e+04 K | 0.0927 | 0.0899 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.09e+04 K | 1.09e+04 K | 0.491 | 0.485 |
| 5 | 1.11e+04 K | 1.11e+04 K | 0.187 | 0.19 |
| 10 | 1.09e+04 K | 1.09e+04 K | 0.118 | 0.12 |
| 15 | 1.05e+04 K | 1.05e+04 K | 0.0899 | 0.09 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.09e+04 K | 1.1e+04 K | 0.485 | 0.483 |
| 5 | 1.11e+04 K | 1.11e+04 K | 0.19 | 0.19 |
| 10 | 1.09e+04 K | 1.08e+04 K | 0.12 | 0.122 |
| 15 | 1.05e+04 K | 1.05e+04 K | 0.09 | 0.0916 |
| Shell No. | t_rad | next_t_rad | w | next_w |
|---|---|---|---|---|
| 0 | 1.1e+04 K | 1.09e+04 K | 0.483 | 0.493 |
| 5 | 1.11e+04 K | 1.1e+04 K | 0.19 | 0.193 |
| 10 | 1.08e+04 K | 1.08e+04 K | 0.122 | 0.123 |
| 15 | 1.05e+04 K | 1.05e+04 K | 0.0916 | 0.091 |
[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()