Skip to content

Commit

Permalink
Merge pull request #322 from SNEWS2/JostMigenda/ModelNotebookTests
Browse files Browse the repository at this point in the history
Run Jupyter notebooks in CI
  • Loading branch information
JostMigenda committed Apr 30, 2024
2 parents c554810 + 92629e6 commit a2f4d36
Show file tree
Hide file tree
Showing 10 changed files with 233 additions and 187 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,11 @@ jobs:
run: |
python -m unittest python/snewpy/test/simplerate_integrationtest.py
pytest -m 'snowglobes'
- name: Run Jupyter notebooks
run: |
pip install nbclient ipykernel
jupyter kernelspec list
cd doc/nb/
jupyter execute ccsn/*.ipynb
jupyter execute presn/*.ipynb
jupyter execute AnalyticFluence.ipynb FlavorTransformation.ipynb
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ dist/
# default directory for downloaded model files
SNEWPY_models/

# snewpy.snowglobes output files
## SNEWPY output files
# snewpy.snowglobes intermediate results
*_SNOprocessed.tar.gz
*.npy
*.npz

# used for integration tests in test_snowglobes.py
fluence_Bollig_2016_s*
# plots generated by FlavorTransformation.ipynb
doc/nb/*_adiabaticmsw*.pdf

# editor-specific
.ipynb_checkpoints/
Expand Down
14 changes: 9 additions & 5 deletions doc/nb/FlavorTransformation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,11 @@
"outputs": [],
"source": [
"fig = plot_total_flux(model, AdiabaticMSW(), AdiabaticMSW(mh=MassHierarchy.INVERTED) )\n",
"fig.savefig('flux_adiabaticmsw.pdf')\n",
"fig.show()\n",
"# fig.savefig('flux_adiabaticmsw.pdf')\n",
"fig = plot_spectra(model, AdiabaticMSW(), AdiabaticMSW(mh=MassHierarchy.INVERTED), 100*u.ms)\n",
"fig.savefig('spectra_adiabaticmsw.pdf')"
"fig.show()\n",
"# fig.savefig('spectra_adiabaticmsw.pdf')"
]
},
{
Expand All @@ -264,9 +266,11 @@
"xf_imo = AdiabaticMSWes(angles_imo)\n",
"\n",
"fig = plot_total_flux(model, xf_nmo, xf_imo)\n",
"fig.savefig('flux_adiabaticmswes.pdf')\n",
"fig.show()\n",
"# fig.savefig('flux_adiabaticmswes.pdf')\n",
"fig = plot_spectra(model, xf_nmo, xf_imo, 100*u.ms)\n",
"fig.savefig('spectra_adiabaticmswes.pdf')"
"fig.show()\n",
"# fig.savefig('spectra_adiabaticmswes.pdf')"
]
}
],
Expand All @@ -286,7 +290,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.5"
"version": "3.12.3"
},
"vscode": {
"interpreter": {
Expand Down
Loading

0 comments on commit a2f4d36

Please sign in to comment.