Installing NuRadioMC / NuRadioReco
Requirements
In order to use NuRadioMC / NuRadioReco, please ensure you are using a version of Python >=3.7, and a UNIX operating system (linux or MacOS).
If you are using Windows, consider installing the Windows Subsystem for Linux.
Note
We highly recommend installing NuRadioMC inside a virtual environment.
You can either use python3 -m venv name_of_venv
or use a virtual environment manager like conda.
Installation using pip
NuRadioReco is a subpackage of NuRadioMC, so both are installed at once using pip:
pip install NuRadioMC
NuRadioMC/NuRadioReco will then be available from Python using import NuRadioMC and import NuRadioReco, respectively.
This installs all core dependencies. Some features require additional packages, which are grouped into
options and can be installed by appending [option],
i.e. pip install NuRadioMC[option]. One can also use [all] to install all (non-development) dependencies.
Important
Some optional dependencies cannot be installed using pip and have to be installed manually.
Note
This is the release version of NuRadioMC. If you want the latest (development) version, use
pip install git+https://github.com/nu-radio/NuRadioMC.git
instead, or install it manually (see below).
Development version
If you want the most recent, in-development version of NuRadioMC, or intend to contribute to its development,
you can get it via the NuRadioMC github:
git clone https://github.com/nu-radio/NuRadioMC.git
If you don’t already have it installed, you should install Git.
To install NuRadioMC and its dependencies, use the pip editable install.
Navigate to the NuRadioMC folder and run:
cd NuRadioMC/
pip install -e .[dev]
pre-commit install
(note the -e flag!). This will install the core dependencies, as well as the optional dev dependencies (use [dev,all] instead to also install all optional dependencies),
and tell python to look for NuRadioMC and NuRadioReco in this folder, so that you can edit and contribute to the codebase while using it.
The last line, pre-commit install installs a git hook using pre-commit. This is highly recommended for developers as it
helps to keep the repository clean from accidentally added large files. More details are given here.
Note
Users of zsh (the default shell on MacOS) have to wrap the argument in quotes, i.e. pip install -e '.[dev]',
as zsh otherwise interprets the square brackets itself.
Optional Dependencies
The core installation of NuRadioMC deliberately stays lightweight: several features rely on additional packages that are not installed by default. These are grouped into options (also called “extras”), which are appended in square brackets when installing NuRadioMC, e.g.
pip install NuRadioMC[proposal] # a single option
pip install NuRadioMC[proposal,galacticnoise] # several options at once
pip install -e .[dev,proposal] # the same for a development install
The available options are:
Option |
Installs |
Needed for |
|---|---|---|
|
|
Propagation of secondary leptons, |
|
|
Adding galactic noise, |
|
|
Atmospheric muon flux calculations, |
|
|
Interpolation of CoREAS star-shape simulations, |
|
|
Additional minimizers in |
|
|
Contributing to NuRadioMC and building the documentation locally |
|
all of the above except |
Convenience option to get all user-facing features |
Note that option names are normalised by pip, so [cr_interpolator] and [cr-interpolator] are equivalent.
To get everything, including the development dependencies, use pip install NuRadioMC[all,dev].
A few features additionally depend on packages that are not part of any option: they either
cannot be installed via pip or are only needed
for specific detectors or data formats.
[proposal]PROPOSAL is a lepton propagation code. It is needed to use the
NuRadioMC.EvtGen.NuRadioProposalmodule, which simulates the secondary interactions of muons and taus, i.e. the showers that these leptons induce along their path through the ice. Without it, NuRadioMC only simulates the shower produced at the neutrino interaction vertex itself.pip install proposal==7.6.2
Note that the pip installation for this version of proposal may not work on all systems, in particular:
conda cannot be used on all systems (eg. on Mac), in that case use a python venv, see details here
if the linux kernel is too old (eg. on some computing clusters), refer to this step-by-step guide
[galacticnoise]The
channelGalacticNoiseAdderandefieldGalacticNoiseAddermodules add the diffuse emission of the galaxy to simulated traces. This is the dominant noise source for detectors at frequencies below a few hundred MHz, e.g. for air-shower detection. The sky models are provided by PyGDSM (GSM, GSM2016, LFSM, …);pylfmapprovides the additional LFmap model used by LOFAR for calibration purposes, andhealpyis used to handle the sky maps.pip install pygdsm pylfmap healpy
[muon-flux]MCEqsolves the cascade equations for the atmosphere andcrfluxprovides parametrisations of the cosmic-ray flux. Together they are used byNuRadioMC.utilities.muon_fluxto calculate the flux of atmospheric muons at the surface, which is the main background for in-ice radio detectors at PeV energies.pip install MCEq crflux
[cr_interpolator]Installs the cosmic-ray pulse interpolator from https://github.com/nu-radio/cr-pulse-interpolator. CoREAS air-shower simulations are usually produced on a star-shaped pattern of observer positions. The
coreasInterpolatoruses this package to interpolate the simulated pulses to arbitrary positions in between, so that a single CoREAS simulation can be reused for many detector positions or shower cores.pip install cr-pulse-interpolator
[minimizers]The
Minimizerclass provides a common interface to different minimization algorithms used in reconstruction. Beyond thescipyminimizers (which are always available), it can use iminuit (MIGRAD/MINOS, including proper uncertainty estimation), scikit-optimize (Bayesian/global optimization) and noisyopt (minimization of noisy objective functions).pip install iminuit scikit-optimize noisyopt
[dev]For developers, we use pre-commit to prevent the accidental addition of large files that would clutter the repository, as well as run some simple code formatting checks (see here for more details):
pip install pre-commit
The documentation is created using Sphinx. We use the
readthedocstheme, and thenumpydocformat is used in our docstrings. These dependencies are needed only if you want to generate the documentation locally - the online documentation is generated by a Github action automatically. Note that we use the sphinx autodoc feature, which tries to import all modules it documents. So if you are missing some optional dependencies, it will not generate correct documentation for all the code.pip install sphinx sphinx_rtd_theme numpydoc
Not pip-installable packages
To speed up the
analytic ray tracing module, GSL needs to be installed, and$GSL_DIRshould point at the correct installation folder. On Linux, GSL can be installed usingsudo apt-get install libgsl-dev
(On MacOS, use
brew install gslinstead - you may have to install homebrew first). With GSL installed, compile the CPP ray tracer by navigating toNuRadioMC/NuRadioMC/SignalPropand running the includedinstall.shscript.To use the
RadioPropa numerical ray tracingmodule,radiopropaneeds to be installed. The radiopropa github, with installation instructions, can be found here.To read ARIANNA files, Snowshovel needs to be installed.
To read ARA files, ARA ROOT needs to be installed.
Other optional packages
These packages can be installed with pip, but are not part of any option because they are only needed for specific detectors or data formats.
mattak is required to open RNO-G root files:
pip install git+https://github.com/RNO-G/mattak
Optionally, to filter RNO-G data (during read in) the RNO-G run table database can be used. Note that this requires membership of the RNO-G Github organisation (not public):
pip install git+ssh://git@github.com/RNO-G/rnog-runtable.git
To use a detector description stored in an SQL database (
NuRadioReco.detector.detector_sql), install MySQL and mysql-connector-python:pip install mysql-connector-python