Skip to main content

A library for calculating atmospheric neutrino fluxes

Project description

Tests codecov PyPI version Conda-Forge AUR DOI

nuflux

Nuflux is a library for calculating atmospheric neutrino fluxes.

Installation

Packages

nuflux is available on pypi. If you only need to use nuflux in python this is the easiest way to install it. Run pip install nuflux.

nuflux is packaged on conda-forge. Install with conda install -c conda-forge nuflux.

On MacOS you can use homebrew. IceCube maintains a tap which includes a formulat for nuflux. Run:

brew tap "icecube/icecube"
brew install nuflux

From source

nuflux uses two different build systems: one based on setuptools and one based on meson. Which one you should use depends on whether you need to build C++ libraries against nuflux, or are content to use the Python bindings.

Prerequisites

  • cfitsio
  • photospline
  • boost_python

setuptools

If you only need to use python you can install it directly through pip:

pip install --user git+https://github.com/icecube/nuflux

Note that this may fail if photospline and boost_python are installed in nonstandard locations, e.g. headers in /opt/toolsets/photospline/include, libraries in /opt/toolsets/photospline/lib. In this case, set the CMAKE_PREFIX_PATH environment variable to the root of your photospline installation and BOOST_ROOT to the root of your boost installation:

CMAKE_PREFIX_PATH=/opt/toolsets/photospline BOOST_ROOT=/opt/toolsets/boost pip install --user git+https://github.com/icecube/nuflux

If you are running it in IceCube's cvmfs environment you will want to set CMAKE_PREFIX_PATH and BOOST_ROOT to the base of the cvmfs environment which is stored in the environment variable SROOT:

eval `/cvmfs/icecube.opensciencegrid.org/py3-v4.3.0/setup.sh`
CMAKE_PREFIX_PATH=${SROOT} BOOST_ROOT=${SROOT} pip install --user git+https://github.com/icecube/nuflux

Meson

If you want to use nuflux from a c++ program you need to install it with meson

git clone https://github.com/icecube/nuflux
cd nuflux
meson build
ninja -C build
sudo ninja -C build install

If boost and photospline are installed in nonstandard locations, you might need to let meson know with environment variables. Since photospline is detected with cmake you need to set CMAKE_PREFIX_PATH=/path/to/photospline. Boost uses BOOST_ROOT.

For example, in IceCube's cvmfs environment you should do:

CMAKE_PREFIX_PATH=${SROOT} BOOST_ROOT=${SROOT} meson setup build . --prefix=/path/to/install/to

the option -Ddata_path can be used to install the raw flux tables to a directory outside of the PREFIX directory.

If you want to install to a read-only file system you can pass -Dinstall_data=False

You may also use the environment variable NUFLUX_DATA to specify the path of the raw flux tables if they are in a place other than where they were installed to.

Documentation

You can build the documentation yourself using sphinx:

pip3 install sphinx breathe sphinx_rtd_theme

Run ninja with docs/html target:

ninja docs/html

The latest version of the documentation is automatically uploaded to IceCube documentation server

Usage

From python:

>>> import nuflux
>>> flux = nuflux.makeFlux('honda2006')
>>> nu_type=nuflux.NuMu
>>> nu_energy=1e3 # in GeV
>>> nu_cos_zenith = 0.5
>>> flux.getFlux(nu_type,nu_energy,nu_cos_zenith)
2.2395566552347364e-11

from c++:

#include <nuflux/nuflux.h>

int main(){
  boost::shared_ptr<nuflux::FluxFunction> flux;
  flux=nuflux::makeFlux("honda2006");
  nuflux::ParticleType pdgid = nuflux::NuMu;
  double energy = 1e3; // in GeV
  double cos_zenith = 0;
  double f = flux->getFlux(pdgid, energy, cos_zenith);
  assert(f == 4.6476245267530432e-11);
}

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

nuflux-2.0.7.tar.gz (4.3 MB view details)

Uploaded Source

Built Distributions

nuflux-2.0.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.7 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

nuflux-2.0.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.7 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

nuflux-2.0.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.7 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

nuflux-2.0.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.7 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

nuflux-2.0.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.7 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

nuflux-2.0.7-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.7 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

File details

Details for the file nuflux-2.0.7.tar.gz.

File metadata

  • Download URL: nuflux-2.0.7.tar.gz
  • Upload date:
  • Size: 4.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for nuflux-2.0.7.tar.gz
Algorithm Hash digest
SHA256 fda399992fa1510845fc0224cc9b5857169f98c2687eb965de67a87a916a7cb2
MD5 dec8025b21a0a180ea7c33ede1af0803
BLAKE2b-256 fe2aa5c98b60d16f35ff699ece238cc944e87ef76102754c841e6aaa0a0c9aae

See more details on using hashes here.

File details

Details for the file nuflux-2.0.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nuflux-2.0.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ee9e1e30da21bcc9f341d8c343ae86d3c81f4d126a82609b991f751186446a76
MD5 47bb72f0daeb5d7cb784affc2e393366
BLAKE2b-256 e14f28ae3c5c401657ca7cabae0ff01d46b4efccdf59c3683f9e49feab0995b8

See more details on using hashes here.

File details

Details for the file nuflux-2.0.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nuflux-2.0.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e48e7bde9ac56ee93e5308583231db2517b583dec9cd39878b9e5e380da5e6d5
MD5 bb857dd695a4bf176ccee1f7be92653e
BLAKE2b-256 606df8daedadd775878a1dc793916ecde0da2ccac31d8374486858ce516a9064

See more details on using hashes here.

File details

Details for the file nuflux-2.0.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nuflux-2.0.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fdb84c23c4da3798ad5308e2059d49c3f7706f35e7f9fa889ee0497b19d0870e
MD5 661e5d5c928d962148334ed0b5531f02
BLAKE2b-256 fccebc9580323d5c58cd4f8a4ea9cf14ce2533d0ded74979a35c2d4987be2963

See more details on using hashes here.

File details

Details for the file nuflux-2.0.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nuflux-2.0.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6bfe80a4d7d36ead1cae275d96683468d52d3ff6b9f7214926c434342c39869c
MD5 1cc6f0c7fec2214e5d8939a01c84f9f5
BLAKE2b-256 c3a457962d737899f3b15940cdc779480ff7a2aca699dd9c5412f251df2418ba

See more details on using hashes here.

File details

Details for the file nuflux-2.0.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nuflux-2.0.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2c6e0c980cd96a4a19008227cc1babf00707595a38b416fd01ad4e1f6edb4cb2
MD5 faec0e27f41ffa63bf7a0b8bb8e04d32
BLAKE2b-256 afb76e8a340deaf0545a09cb83911ed737b125efa766d83243f08900eda707e3

See more details on using hashes here.

File details

Details for the file nuflux-2.0.7-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nuflux-2.0.7-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 22bbde304c719427d4886cfbddfb1fea1e085f20af529829f4915d93ca6b0190
MD5 446c076a78141c5b5c5a247168f6ed9f
BLAKE2b-256 af7a3fc872f20cdae9858ead64787ebd586f005a2370655503dc860ada90c986

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