Skip to main content

A Python package for working with supernova neutrinos

Project description

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/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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

snewpy-1.6b1.tar.gz (75.5 kB view details)

Uploaded Source

Built Distribution

snewpy-1.6b1-py3-none-any.whl (86.3 kB view details)

Uploaded Python 3

File details

Details for the file snewpy-1.6b1.tar.gz.

File metadata

  • Download URL: snewpy-1.6b1.tar.gz
  • Upload date:
  • Size: 75.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for snewpy-1.6b1.tar.gz
Algorithm Hash digest
SHA256 0a603eaa0b7952b77dfe3f77c887c7b369f4a19acc7224297a42e3851fe6c678
MD5 3c6df80cd0e91349a36b34f90ed01a68
BLAKE2b-256 54f386d50db6bce95a555732ac1b9f2d6c333b3ecbc4dc4355ced0048f2b0136

See more details on using hashes here.

File details

Details for the file snewpy-1.6b1-py3-none-any.whl.

File metadata

  • Download URL: snewpy-1.6b1-py3-none-any.whl
  • Upload date:
  • Size: 86.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for snewpy-1.6b1-py3-none-any.whl
Algorithm Hash digest
SHA256 4eff5e0e6979e14b053285584fe743f3834a9cc3b0c147ce0df6ef4dceb5bb38
MD5 22e7a0328ebb6b13250664894c13d855
BLAKE2b-256 ecb766fbf2af039f55bc519f7fd8ad217bebd3652da5d788279a98a760438722

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page