nuflux

A library for calculating atmospheric neutrino fluxes.

https://github.com/icecube/nuflux

Science Score: 72.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    3 of 10 committers (30.0%) from academic institutions
  • Institutional organization owner
    Organization icecube has institutional domain (icecube.wisc.edu)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.7%) to scientific vocabulary

Keywords

atmospheric-neutrinos flux-models
Last synced: 6 months ago · JSON representation ·

Repository

A library for calculating atmospheric neutrino fluxes.

Basic Info
Statistics
  • Stars: 17
  • Watchers: 8
  • Forks: 5
  • Open Issues: 2
  • Releases: 8
Topics
atmospheric-neutrinos flux-models
Created over 7 years ago · Last pushed 8 months ago
Metadata Files
Readme License Citation

README.md

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 boostpython are installed in nonstandard locations, e.g. headers in /opt/toolsets/photospline/include, libraries in /opt/toolsets/photospline/lib. In this case, set the `CMAKEPREFIXPATHenvironment variable to the root of your photospline installation andBOOSTROOT` 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);
}

Troubleshooting

If you get an error message like this:

conv_flux = nuflux.makeFlux("honda2006") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Boost.Python.ArgumentError: Python argument types in _nuflux.makeFlux(str) did not match C++ signature: makeFlux(std::string)

It is most likely due to a conflict between nuflux and icetray registering python bindings. The solution is to import nuflux before icetray in your python script

Owner

  • Name: IceCube Neutrino Observatory
  • Login: icecube
  • Kind: organization
  • Location: South Pole Station, Antarctica

Repo Guide: https://github.com/icecube/icecube.github.io/wiki

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
  - family-names: "IceCube Collaboration"
    given-names: ""
title: "NuFlux: A library for calculating atmospheric neutrino fluxes"
version: 2.0.7
date-released: 2024-07-03
doi: 10.5281/zenodo.5874708
url: "https://doi.org/10.5281/zenodo.5874708"

GitHub Events

Total
  • Watch event: 2
  • Push event: 6
  • Pull request event: 1
Last Year
  • Watch event: 2
  • Push event: 6
  • Pull request event: 1

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 158
  • Total Committers: 10
  • Avg Commits per committer: 15.8
  • Development Distribution Score (DDS): 0.297
Past Year
  • Commits: 5
  • Committers: 1
  • Avg Commits per committer: 5.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Kevin Meagher 1****r@u****m 111
nechnif r****e@w****e 33
Jakob van Santen j****n@g****m 5
Kevin Meagher k****r@c****u 2
Carlos Arguelles c****d@m****u 2
Austin Schneider h****n@g****m 1
Jakob van Santen j****n@d****e 1
pabloferm 4****m@u****m 1
nechnif r****e@u****e 1
Carlos A Arguelles Delgado a****s@u****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 13
  • Total pull requests: 19
  • Average time to close issues: 5 months
  • Average time to close pull requests: 17 days
  • Total issue authors: 10
  • Total pull request authors: 6
  • Average comments per issue: 2.23
  • Average comments per pull request: 1.16
  • Merged pull requests: 13
  • Bot issues: 0
  • Bot pull requests: 3
Past Year
  • Issues: 0
  • Pull requests: 3
  • Average time to close issues: N/A
  • Average time to close pull requests: about 12 hours
  • Issue authors: 0
  • Pull request authors: 2
  • Average comments per issue: 0
  • Average comments per pull request: 1.33
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 2
Top Authors
Issue Authors
  • briedel (2)
  • austinschneider (2)
  • diaza (1)
  • BenSmithers (1)
  • samiur06 (1)
  • jvansanten (1)
  • kjmeagher (1)
  • 329gkp (1)
  • NehaLad9 (1)
  • vedant8 (1)
Pull Request Authors
  • kjmeagher (13)
  • pre-commit-ci[bot] (5)
  • nechnif (2)
  • pabloferm (2)
  • austinschneider (1)
  • vedant8 (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 52 last-month
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 0
    (may contain duplicates)
  • Total versions: 5
  • Total maintainers: 1
pypi.org: nuflux

A library for calculating atmospheric neutrino fluxes

  • Documentation: https://docs.icecube.aq/nuflux/main/
  • License: GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.
  • Latest release: 2.0.7
    published over 1 year ago
  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 52 Last month
Rankings
Dependent packages count: 10.0%
Average: 37.9%
Dependent repos count: 65.8%
Maintainers (1)
Last synced: 6 months ago
conda-forge.org: nuflux
  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 39.0%
Average: 48.8%
Forks count: 50.5%
Dependent packages count: 51.6%
Stargazers count: 54.1%
Last synced: 6 months ago