{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Non-Homologous TARDIS Workflow" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from numba import config as nbconfig\n", "\n", "nbconfig.DISABLE_JIT = False" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", "\n", "from tardis.io.configuration.config_reader import Configuration\n", "from tardis.workflows.nonhomologous_tardis_workflow import (\n", " NonhomologousTARDISWorkflow,\n", ")\n", "from tardis.workflows.simple_tardis_workflow import SimpleTARDISWorkflow\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "config = Configuration.from_yaml('../tardis_example.yml')\n", "config.montecarlo['enable_full_relativity'] = False" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "workflow = NonhomologousTARDISWorkflow(config)\n", "hom_workflow = SimpleTARDISWorkflow(config)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "workflow.run()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "hom_workflow.run()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "spectrum = workflow.spectrum_solver.spectrum_real_packets\n", "spectrum_virtual = workflow.spectrum_solver.spectrum_virtual_packets\n", "spectrum_integrated = workflow.spectrum_solver.spectrum_integrated\n", "hom_spectrum = hom_workflow.spectrum_solver.spectrum_real_packets\n", "hom_spectrum_virtual = hom_workflow.spectrum_solver.spectrum_virtual_packets\n", "hom_spectrum_integrated = workflow.spectrum_solver.spectrum_integrated" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "plt.figure(figsize=(10, 6.5))\n", "\n", "spectrum.plot(label=\"Normal packets, non-homology\", c='C0', alpha=0.1)\n", "hom_spectrum.plot(label=\"Normal packets, homology\", c='C1', alpha=0.1)\n", "\n", "spectrum_virtual.plot(linewidth=3, c='w', alpha=1.0)\n", "hom_spectrum_virtual.plot(linewidth=4, c='w', alpha=1.0)\n", "spectrum_virtual.plot(label=\"Virtual packets, non-homology\", c='C0', alpha=0.35)\n", "hom_spectrum_virtual.plot(label=\"Virtual packets, homology\", c='C1', alpha=0.35)\n", "\n", "spectrum_integrated.plot(linewidth=3, c='w', alpha=1.0)\n", "spectrum_integrated.plot(label=\"Formal Integral, non-homology\", c='C0', alpha=1.0)\n", "hom_spectrum_integrated.plot(label=\"Formal Integral, homology\", c='C1', alpha=1.0, linestyle='--')\n", "\n", "\n", "plt.xlim(500, 9000)\n", "plt.title(\"TARDIS example model spectrum\")\n", "plt.xlabel(r\"Wavelength [$\\AA$]\")\n", "plt.ylabel(r\"Luminosity density [erg/s/$\\AA$]\")\n", "plt.legend()\n", "plt.show()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.3" } }, "nbformat": 4, "nbformat_minor": 2 }