Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ jobs:
run: |
python -m unittest python/snewpy/test/simplerate_integrationtest.py
pytest -m 'snowglobes'
- name: Run notebooks test
run: |
pytest --nbval-lax doc/source/nb
- uses: r-lib/actions/setup-pandoc@v2

- name: Build HTML docs
Expand Down
1 change: 1 addition & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
# directories to ignore when looking for source files.
exclude_patterns = ['nb/dev']

nbsphinx_allow_errors = True
Comment thread
JostMigenda marked this conversation as resolved.
Outdated
# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None
Expand Down
21 changes: 8 additions & 13 deletions doc/source/nb/ccsn/Bollig_2016.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -141,28 +141,23 @@
"\n",
"for i, spec in enumerate([ispec, ospec_nmo]):\n",
" ax = axes[i]\n",
" for flavor in Flavor:\n",
" ax.plot(E, spec[flavor],\n",
" label=flavor.to_tex(),\n",
" color='C0' if flavor.is_electron else 'C1',\n",
" ls='-' if flavor.is_neutrino else ':', lw=2,\n",
" alpha=0.7)\n",
"\n",
" ax.set(xlabel=r'$E$ [{}]'.format(E.unit),\n",
" title='Initial Spectra: $t = ${:.1f}'.format(t) if i==0 else 'Oscillated Spectra: $t = ${:.1f}'.format(t))\n",
" plt.sca(ax)\n",
" spec.plot('energy')\n",
" \n",
" ax.set(title='Initial Spectra: $t = ${:.1f}'.format(t) if i==0 else 'Oscillated Spectra: $t = ${:.1f}'.format(t))\n",
" ax.grid()\n",
" ax.legend(loc='upper right', ncol=2, fontsize=16)\n",
"\n",
"ax = axes[0]\n",
"ax.set(ylabel=r'flux [erg$^{-1}$ s$^{-1}$]')\n",
"ax.set(ylabel=r'flux, MeV')\n",
"\n",
"fig.tight_layout();"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "snewpy",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -176,9 +171,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.2"
"version": "3.13.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
21 changes: 6 additions & 15 deletions doc/source/nb/ccsn/Fischer_2020.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -121,24 +121,15 @@
"\n",
"for i, spec in enumerate([ispec, ospec_nmo]):\n",
" ax = axes[i]\n",
" for flavor in Flavor:\n",
" if flavor.is_electron == True:\n",
" color='C0'\n",
" else:\n",
" color='C1'\n",
" ax.plot(E, spec[flavor],\n",
" label=flavor.to_tex(),\n",
" color=color,\n",
" ls='-' if flavor.is_neutrino else ':', lw=2,\n",
" alpha=0.7)\n",
"\n",
" ax.set(xlabel=r'$E$ [{}]'.format(E.unit),\n",
" title='Initial Spectra: $t = ${:.1f}'.format(t) if i==0 else 'Oscillated Spectra: $t = ${:.1f}'.format(t))\n",
" plt.sca(ax)\n",
" spec.plot('energy')\n",
" \n",
" ax.set(title='Initial Spectra: $t = ${:.1f}'.format(t) if i==0 else 'Oscillated Spectra: $t = ${:.1f}'.format(t))\n",
" ax.grid()\n",
" ax.legend(loc='upper right', ncol=2, fontsize=16)\n",
"\n",
"ax = axes[0]\n",
"ax.set(ylabel=r'flux [erg$^{-1}$ s$^{-1}$]')\n",
"ax.set(ylabel=r'flux, MeV')\n",
"\n",
"fig.tight_layout();"
]
Expand All @@ -160,7 +151,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
"version": "3.13.5"
},
"vscode": {
"interpreter": {
Expand Down
27 changes: 14 additions & 13 deletions doc/source/nb/ccsn/Fornax_2021.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
"\n",
"for i, ax in enumerate(axes.flatten()):\n",
" for line, flavor in zip(linestyles, Flavor):\n",
" ax.plot(E, spectra[flavor][i], lw=3, ls=line, label=flavor.to_tex())\n",
" ax.plot(E, spectra[flavor,i].array.squeeze(), lw=3, ls=line, label=flavor.to_tex())\n",
" ax.set(xlim=(0,100))\n",
" ax.set_title('$t$ = {:g}'.format(times[i]), fontsize=16)\n",
" ax.legend(loc='upper right', ncol=2, fontsize=12)\n",
Expand Down Expand Up @@ -164,11 +164,12 @@
"\n",
"linestyles = ['-', '--', '-.', ':']\n",
"\n",
"spectra = model.get_initial_spectra(times, E, interpolation='nearest')\n",
"model.interpolation='nearest'\n",
"spectra = model.get_initial_spectra(times, E)\n",
"\n",
"for i, ax in enumerate(axes.flatten()):\n",
" for line, flavor in zip(linestyles, Flavor):\n",
" ax.plot(E, spectra[flavor][i], lw=3, ls=line, label=flavor.to_tex())\n",
" ax.plot(E, spectra[flavor,i].array.squeeze(), lw=3, ls=line, label=flavor.to_tex())\n",
" ax.set(xlim=(0,100))\n",
" ax.set_title('$t$ = {:g}'.format(times[i]), fontsize=16)\n",
" ax.legend(loc='upper right', ncol=2, fontsize=12)\n",
Expand Down Expand Up @@ -227,13 +228,13 @@
" ax.legend(ncol=3, fontsize=12, title=r'$\\bar{\\nu}_e$');\n",
" \n",
" ax = axes[2]\n",
" flavor = Flavor.NU_X\n",
" flavor = Flavor.NU_MU\n",
" ax.plot(model.time, model.luminosity[flavor], lw=2, color=colors2[i], ls=linestyles[i%4],\n",
" label='${0.value:g}$ {0.unit:latex}'.format(model.progenitor_mass))\n",
" ax.set(xlabel='time [s]',\n",
" ylabel=r'$L_{\\nu_X}(t)$ [erg s$^{-1}$]')\n",
" ylabel=r'$L_{\\nu_\\mu}(t)$ [erg s$^{-1}$]')\n",
" ax.grid(ls=':', which='both')\n",
" ax.legend(ncol=3, fontsize=12, title=r'$\\nu_X$');"
" ax.legend(ncol=3, fontsize=12, title=r'$\\nu_\\mu$');"
]
},
{
Expand Down Expand Up @@ -265,11 +266,11 @@
"fig, axes = plt.subplots(2,4, figsize=(16,6), sharex=True, sharey=True, tight_layout=True)\n",
"\n",
"linestyles = ['-', '--', '-.', ':']\n",
"\n",
"model.interpolation='linear'\n",
"for model, ax in zip(models.values(), axes.flatten()):\n",
" spectra = model.get_initial_spectra(t, E)\n",
" for line, flavor in zip(linestyles, Flavor):\n",
" ax.plot(E, spectra[flavor][0], lw=3, ls=line, label=flavor.to_tex())\n",
" ax.plot(E, spectra[flavor,0].array.squeeze(), lw=3, ls=line, label=flavor.to_tex())\n",
" ax.set(xlim=(0,100))\n",
" ax.set_title('${0.value:g}$ {0.unit:latex}'.format(model.progenitor_mass))\n",
" ax.legend(loc='upper right', ncol=2, fontsize=12)\n",
Expand Down Expand Up @@ -300,11 +301,11 @@
"fig, axes = plt.subplots(2,4, figsize=(16,6), sharex=True, sharey=True, tight_layout=True)\n",
"\n",
"linestyles = ['-', '--', '-.', ':']\n",
"\n",
"model.interpolation='nearest'\n",
"for model, ax in zip(models.values(), axes.flatten()):\n",
" spectra = model.get_initial_spectra(t, E, interpolation='nearest')\n",
" spectra = model.get_initial_spectra(t, E)\n",
" for line, flavor in zip(linestyles, Flavor):\n",
" ax.plot(E, spectra[flavor][0], lw=3, ls=line, label=flavor.to_tex())\n",
" ax.plot(E, spectra[flavor,0].array.squeeze(), lw=3, ls=line, label=flavor.to_tex())\n",
" ax.set(xlim=(0,100))\n",
" ax.set_title('${0.value:g}$ {0.unit:latex}'.format(model.progenitor_mass))\n",
" ax.legend(loc='upper right', ncol=2, fontsize=12)\n",
Expand All @@ -317,7 +318,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.9.5 ('snews')",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -331,7 +332,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
"version": "3.13.5"
},
"vscode": {
"interpreter": {
Expand Down
29 changes: 15 additions & 14 deletions doc/source/nb/ccsn/Fornax_2022.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,12 @@
"fig, axes = plt.subplots(5,4, figsize=(15,12), sharex=True, sharey=True, tight_layout=True)\n",
"\n",
"linestyles = ['-', '--', '-.', ':']\n",
"\n",
"model.interpolation='linear'\n",
"spectra = model.get_initial_spectra(times, E)\n",
"\n",
"for i, ax in enumerate(axes.flatten()):\n",
" for line, flavor in zip(linestyles, Flavor):\n",
" ax.plot(E, spectra[flavor][i], lw=3, ls=line, label=flavor.to_tex())\n",
" ax.plot(E, spectra[flavor,i].array.squeeze(), lw=3, ls=line, label=flavor.to_tex())\n",
" ax.set(xlim=(0,100))\n",
" ax.set_title('$t$ = {:g}'.format(times[i]), fontsize=16)\n",
" ax.legend(loc='upper right', ncol=2, fontsize=12)\n",
Expand Down Expand Up @@ -186,12 +186,12 @@
"fig, axes = plt.subplots(5,4, figsize=(15,12), sharex=True, sharey=True, tight_layout=True)\n",
"\n",
"linestyles = ['-', '--', '-.', ':']\n",
"\n",
"spectra = model.get_initial_spectra(times, E, interpolation='nearest')\n",
"model.interpolation='nearest'\n",
"spectra = model.get_initial_spectra(times, E)\n",
"\n",
"for i, ax in enumerate(axes.flatten()):\n",
" for line, flavor in zip(linestyles, Flavor):\n",
" ax.plot(E, spectra[flavor][i], lw=3, ls=line, label=flavor.to_tex())\n",
" ax.plot(E, spectra[flavor,i].array.squeeze(), lw=3, ls=line, label=flavor.to_tex())\n",
" ax.set(xlim=(0,100))\n",
" ax.set_title('$t$ = {:g}'.format(times[i]), fontsize=16)\n",
" ax.legend(loc='upper right', ncol=2, fontsize=12)\n",
Expand Down Expand Up @@ -250,13 +250,13 @@
" ax.legend(ncol=3, fontsize=12, title=r'$\\bar{\\nu}_e$');\n",
" \n",
" ax = axes[2]\n",
" flavor = Flavor.NU_X\n",
" flavor = Flavor.NU_MU\n",
" ax.plot(model.time, model.luminosity[flavor], lw=2, color=colors2[i], ls=linestyles[i%4],\n",
" label='${0.value:g}$ {0.unit:latex}{1}'.format(model.progenitor_mass, ' (BH)' if 'bh' in model.progenitor else ''))\n",
" label='${0.value:g}$ {0.unit:latex}'.format(model.progenitor_mass))\n",
" ax.set(xlabel='time [s]',\n",
" ylabel=r'$L_{\\nu_X}(t)$ [erg s$^{-1}$]')\n",
" ylabel=r'$L_{\\nu_\\mu}(t)$ [erg s$^{-1}$]')\n",
" ax.grid(ls=':', which='both')\n",
" ax.legend(ncol=3, fontsize=12, title=r'$\\nu_X$');"
" ax.legend(ncol=3, fontsize=12, title=r'$\\nu_\\mu$');"
]
},
{
Expand Down Expand Up @@ -284,9 +284,10 @@
"linestyles = ['-', '--', '-.', ':']\n",
"\n",
"for model, ax in zip(models.values(), axes.flatten()):\n",
" model.interpolation='linear'\n",
" spectra = model.get_initial_spectra(t, E)\n",
" for line, flavor in zip(linestyles, Flavor):\n",
" ax.plot(E, spectra[flavor][0], lw=3, ls=line, label=flavor.to_tex())\n",
" ax.plot(E, spectra[flavor,0].array.squeeze(), lw=3, ls=line, label=flavor.to_tex())\n",
" ax.set(xlim=(0,100))\n",
" ax.set_title('${0.value:g}$ {0.unit:latex}{1}'.format(model.progenitor_mass, ' (BH)' if 'bh' in model.progenitor else ''))\n",
" ax.legend(loc='upper right', ncol=2, fontsize=12)\n",
Expand Down Expand Up @@ -317,11 +318,11 @@
"fig, axes = plt.subplots(2,3, figsize=(12,6), sharex=True, sharey=True, tight_layout=True)\n",
"\n",
"linestyles = ['-', '--', '-.', ':']\n",
"\n",
"for model, ax in zip(models.values(), axes.flatten()):\n",
" spectra = model.get_initial_spectra(t, E, interpolation='nearest')\n",
" model.interpolation='nearest'\n",
" spectra = model.get_initial_spectra(t, E)\n",
" for line, flavor in zip(linestyles, Flavor):\n",
" ax.plot(E, spectra[flavor][0], lw=3, ls=line, label=flavor.to_tex())\n",
" ax.plot(E, spectra[flavor,0].array.squeeze(), lw=3, ls=line, label=flavor.to_tex())\n",
" ax.set(xlim=(0,100))\n",
" ax.set_title('${0.value:g}$ {0.unit:latex}{1}'.format(model.progenitor_mass, ' (BH)' if 'bh' in model.progenitor else ''))\n",
" ax.legend(loc='upper right', ncol=2, fontsize=12)\n",
Expand All @@ -348,7 +349,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
"version": "3.13.5"
}
},
"nbformat": 4,
Expand Down
21 changes: 8 additions & 13 deletions doc/source/nb/ccsn/Kuroda_2020.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -152,28 +152,23 @@
"\n",
"for i, spec in enumerate([ispec, ospec_nmo]):\n",
" ax = axes[i]\n",
" for flavor in Flavor:\n",
" ax.plot(E, spec[flavor],\n",
" label=flavor.to_tex(),\n",
" color='C0' if flavor.is_electron else 'C1',\n",
" ls='-' if flavor.is_neutrino else ':', lw=2,\n",
" alpha=0.7)\n",
"\n",
" ax.set(xlabel=r'$E$ [{}]'.format(E.unit),\n",
" title='Initial Spectra: $t = ${:.1f}'.format(t) if i==0 else 'Oscillated Spectra: $t = ${:.1f}'.format(t))\n",
" plt.sca(ax)\n",
" spec.plot('energy')\n",
" \n",
" ax.set(title='Initial Spectra: $t = ${:.1f}'.format(t) if i==0 else 'Oscillated Spectra: $t = ${:.1f}'.format(t))\n",
" ax.grid()\n",
" ax.legend(loc='upper right', ncol=2, fontsize=16)\n",
"\n",
"ax = axes[0]\n",
"ax.set(ylabel=r'flux [erg$^{-1}$ s$^{-1}$]')\n",
"ax.set(ylabel=r'flux, MeV')\n",
"\n",
"fig.tight_layout();"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.9.5 ('snews')",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -187,7 +182,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.5"
"version": "3.13.5"
},
"vscode": {
"interpreter": {
Expand All @@ -196,5 +191,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
19 changes: 8 additions & 11 deletions doc/source/nb/ccsn/Nakazato_2013.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -165,20 +165,17 @@
"\n",
"for i, spec in enumerate([ispec, ospec_nmo]):\n",
" ax = axes[i]\n",
" for flavor in Flavor:\n",
" ax.plot(E, spec[flavor],\n",
" label=flavor.to_tex(),\n",
" color='C0' if flavor.is_electron else 'C1',\n",
" ls='-' if flavor.is_neutrino else ':', lw=2,\n",
" alpha=0.7)\n",
"\n",
" ax.set(xlabel=r'$E$ [{}]'.format(E.unit),\n",
" title='Initial Spectra: $t = ${:.1f}'.format(t) if i==0 else 'Oscillated Spectra: $t = ${:.1f}'.format(t))\n",
" plt.sca(ax)\n",
" spec.plot('energy')\n",
" \n",
" ax.set(title='Initial Spectra: $t = ${:.1f}'.format(t) if i==0 else 'Oscillated Spectra: $t = ${:.1f}'.format(t))\n",
" ax.grid()\n",
" ax.legend(loc='upper right', ncol=2, fontsize=16)\n",
"\n",
"ax = axes[0]\n",
"ax.set(ylabel=r'flux [erg$^{-1}$ s$^{-1}$]');"
"ax.set(ylabel=r'flux, MeV')\n",
"\n",
"fig.tight_layout();"
]
}
],
Expand All @@ -198,7 +195,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.13.5"
},
"vscode": {
"interpreter": {
Expand Down
Loading
Loading