-
-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Basic skeleton * Lots of progress Solvers pass info to each other Simplified some parts * Adds setup method, refactors some functions, removes unused items * Move convergence setup to setup method * Add docs notebook, fix a couple of errors * Move setup to init * Fix iteration and convergence * Simplify spectrumsolver init * Separate plasma "solver" and simulation state updates * Simplify convergence solver setup with a dict. * Minor formatting change * Minor refactoring * Fixes plasma update step * Fixes loggers and progress bars Also adds docstrings to methods. Updates some methods to use new functionality of the plasma. Adds requirements for the convergence plots (still broken) * Fixes convergence plot rendering * Fixes convergence plots in the final iteration * black * Simplify convergence plot updating * Move logging handling to a separate class * Add HDF output capability to solver * Move more basic logging back into workflow * Add not-converged error message * Update notebook with export option * Added simple base workflow and changed some verbiage * Fix typo * Black format * Fixes spectrum solver test * Some suggested refactoring * Fix and rename workflows * Apply black * Match Jack's opacity state setup for easier fixing later * Ruff formatting
- Loading branch information
1 parent
494d625
commit 5f11626
Showing
8 changed files
with
1,081 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 8, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from tardis.io.configuration.config_reader import Configuration\n", | ||
"from tardis.workflows.simple_tardis_workflow import SimpleTARDISWorkflow\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 9, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"config = Configuration.from_yaml('../tardis_example.yml')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"workflow = SimpleTARDISWorkflow(config)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"workflow.run()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 12, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import matplotlib.pyplot as plt" | ||
] | ||
}, | ||
{ | ||
"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" | ||
] | ||
}, | ||
{ | ||
"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\")\n", | ||
"spectrum_virtual.plot(label=\"Virtual packets\")\n", | ||
"spectrum_integrated.plot(label='Formal integral')\n", | ||
"\n", | ||
"plt.xlim(500, 9000)\n", | ||
"plt.title(\"TARDIS example model spectrum\")\n", | ||
"plt.xlabel(\"Wavelength [$\\AA$]\")\n", | ||
"plt.ylabel(\"Luminosity density [erg/s/$\\AA$]\")\n", | ||
"plt.legend()\n", | ||
"plt.show()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "tardis", | ||
"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.12.4" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from tardis.io.configuration.config_reader import Configuration\n", | ||
"from tardis.workflows.standard_tardis_workflow import StandardTARDISWorkflow\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"config = Configuration.from_yaml('../tardis_example.yml')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"workflow = StandardTARDISWorkflow(config, show_convergence_plots=True,show_progress_bars=True,convergence_plots_kwargs={\"export_convergence_plots\":True})" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"workflow.run()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import matplotlib.pyplot as plt" | ||
] | ||
}, | ||
{ | ||
"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" | ||
] | ||
}, | ||
{ | ||
"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\")\n", | ||
"spectrum_virtual.plot(label=\"Virtual packets\")\n", | ||
"spectrum_integrated.plot(label='Formal integral')\n", | ||
"\n", | ||
"plt.xlim(500, 9000)\n", | ||
"plt.title(\"TARDIS example model spectrum\")\n", | ||
"plt.xlabel(\"Wavelength [$\\AA$]\")\n", | ||
"plt.ylabel(\"Luminosity density [erg/s/$\\AA$]\")\n", | ||
"plt.legend()\n", | ||
"plt.show()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "tardis", | ||
"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.12.4" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.