Skip to main content

SNEWPY: Supernova Neutrino Early Warning Models for Python

snewpy logo: The word 'snewpy' in a monospace font, with an explosion emoji inside the letter 'p'.

DOI PyPI tests Documentation Status

SNEWPY is a Python package for working with supernova neutrinos. It offers …

  • … a simple and unified interface to hundreds of supernova simulations.
  • … a large library of flavor transformations that relate neutrino fluxes produced in the supernova to those reaching a detector on Earth.
  • … and a Python interface to SNOwGLoBES which lets you estimate and plot event rates in many different neutrino detectors.

Installation

Run pip install snewpy to install SNEWPY.

SNEWPY includes a large number of supernova models from different simulation groups. Since these models have a size of several 100 MB, they are not included in the initial install but will be downloaded automatically when needed. Alternatively, you can run the following command to explicitly download models you want to use to a subdirectory named SNEWPY-models/<model_name>/ in the current directory:

python -c 'import snewpy; snewpy.get_models()'

Usage and Documentation

SNEWPY gives you easy access to hundreds of included SN simulations …

import astropy.units as u
from snewpy.models.ccsn import Nakazato_2013, Bollig_2016

# Initialise two SN models. This automatically downloads the required data files if necessary.
nakazato = Nakazato_2013(progenitor_mass=20*u.solMass, revival_time=100*u.ms, metallicity=0.004, eos='shen')
bollig = Bollig_2016(progenitor_mass=27*u.solMass)

… and many flavor transformations that neutrinos could experience on the way to Earth …

from snewpy.flavor_transformation import AdiabaticMSW
from snewpy.neutrino import MassHierarchy

# Adiabatic MSW flavor transformation with normal mass ordering
msw_nmo = AdiabaticMSW(mh=MassHierarchy.NORMAL)

… letting you quickly calculate the neutrino flux reaching Earth:

times = [0.5, 1] * u.s
energies = range(5,50) * u.MeV
# Assume a SN at the fiducial distance of 10 kpc and normal mass ordering.
flux = bollig.get_flux(times, energies, distance=10*u.kpc, flavor_xform=msw_nmo)

You can also calculate the observed event rate in all neutrino detectors supported by SNOwGLoBES, use the included SN models and flavor transformations in third-party code (like event generators), and much more.

Jupyter notebooks showcasing the downloadable supernova models available through SNEWPY and much of its functionality are available in the doc/source/nb/ subfolder. Additional example scripts are in the python/snewpy/scripts/ subfolder.

Papers describing SNEWPY and the underlying physics are published in the Astrophysical Journal (DOI:10.3847/1538-4357/ac350f, arXiv:2109.08188) and the Journal of Open Source Software (DOI:10.21105/joss.03772).

For more, see the full documentation on Read the Docs.

Contributing

Your contributions to SNEWPY are welcome! For minor changes, simply submit a pull request. If you plan larger changes, it’s probably a good idea to open an issue first to coordinate our work.

We use a Fork & Pull Request workflow, which is common on GitHub. Please see the Contributing page in our full documentation for details.

Metadata

Release files for snewpy 1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for snewpy 1.6
File Size Uploaded Provenance Actions
snewpy-1.6.tar.gz 73.8 kB Without provenance Details for snewpy-1.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for snewpy 1.6
File Interpreter ABI Platform Actions
snewpy-1.6-py3-none-any.whl Python 3 none any Details for snewpy-1.6-py3-none-any.whl

Total release size: 157.2 kB

Release files / snewpy-1.6.tar.gz

Download URL snewpy-1.6.tar.gz
Size 73.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b8e46fa869b081562822f8bf6350a5a14eca7441ad4167f6d316e51e698efc75
BLAKE2b-256 checksum
How to use checksums
6ea242abee59def88e9524bd325e024fd81adceb6c69218cdb99f6ad64ca4666
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.12

Release files / snewpy-1.6-py3-none-any.whl

Download URL snewpy-1.6-py3-none-any.whl
Size 83.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cfd6affa61e81e4f372b9d66a0d665abb39eeb33283a18032674973bbe8362ce
BLAKE2b-256 checksum
How to use checksums
b0b06d527e08329edc581462c2043fb706614afade028d55a85b86c06481ac06
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.12

Security for snewpy 1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page