Skip to content

Commit

Permalink
Merge branch 'CRPropa:master' into cringe_reproduction
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienDoerner authored Feb 7, 2024
2 parents a88e05a + bc17418 commit b461fe9
Show file tree
Hide file tree
Showing 26 changed files with 225 additions and 474 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/create_documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: create-documentation
on: [workflow_dispatch]

jobs:
create-documentation:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
config:
- name: "ubuntu-20"
os: ubuntu-20.04
cxx: "g++-9"
cc: "gcc-9"
fc: "gfortran-9"
swig_builtin: "Off" #uses swig 4.0.1

# define steps to take
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Python install
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip' # caching pip dependencies
- name: Prerequirements
run: |
sudo apt-get update
sudo apt-get install libmuparser-dev libhdf5-serial-dev libomp5 libomp-dev libfftw3-dev libcfitsio-dev lcov doxygen graphviz
sudo apt-get install pandoc # do not only use pip to install pandoc, see https://stackoverflow.com/questions/62398231/building-docs-fails-due-to-missing-pandoc
pip install -r doc/pages/example_notebooks/requirements.txt # load requirements for notebooks
pip install sphinx sphinx_rtd_theme m2r2 nbsphinx breathe pandoc exhale # load requirements for documentation
- name: Set up the build
env:
CXX: ${{ matrix.config.cxx }}
CC: ${{ matrix.config.cc }}
FC: ${{ matrix.config.fc }}
run: |
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/.local \
-DENABLE_PYTHON=True -DENABLE_TESTING=ON -DENABLE_SWIG_BUILTIN=${{ matrix.config.swig_builtin }} \
-DSIMD_EXTENSIONS=native -DBUILD_DOC=True -DENABLE_COVERAGE=True
- name: Build CRPropa
run: |
cd build
make -j
- name: run test
run: |
cd build
make test
continue-on-error: true
- name: coverage report
run: |
cd build
make coverage
tar -zcvf coverage.tar.gz coverageReport
- name: build documentation
run: |
cd build
make doc
tar -zcvf documentation.tar.gz doc
- name: archive documentation
uses: actions/upload-artifact@v3
with:
name: "documentation"
path: |
build/documentation.tar.gz
build/coverage.tar.gz
77 changes: 77 additions & 0 deletions .github/workflows/test_examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: crpropa-example-test
on: [push, pull_request]

jobs:
linux:
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- name: "ubuntu-20"
os: ubuntu-20.04
cxx: "g++-9"
cc: "gcc-9"
fc: "gfortran-9"
swig_builtin: "Off" #uses swig 4.0.1
py: "/usr/bin/python3" #python 3.8
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Preinstall
run: |
sudo apt-get update
sudo apt-get install libmuparser-dev python3-dev python-dev python3-numpy python-numpy python3-setuptools python-setuptools libhdf5-serial-dev libomp5 libomp-dev libfftw3-dev libcfitsio-dev lcov
pip3 install -r doc/pages/example_notebooks/requirements.txt # load requrements for notebooks
pip3 install --upgrade Pygments
pip3 install --upgrade numpy
- name: Set up the build
env:
CXX: ${{ matrix.config.cxx }}
CC: ${{ matrix.config.cc }}
FC: ${{ matrix.config.fc }}
run: |
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/.local -DENABLE_PYTHON=True -DPYTHON_EXECUTABLE=${{ matrix.config.py }} -DENABLE_TESTING=Off -DENABLE_SWIG_BUILTIN=${{ matrix.config.swig_builtin }} -DSIMD_EXTENSIONS=native
- name: Build CRPropa
run: |
cd build
make install -j
- name: convert notebooks to python
env:
PYTHONPATH: "/home/runner/.local/lib/python3.8/site-packages/"
runfolder: "/home/runner/notebook_run"
run: |
mkdir "$runfolder"
cd doc/pages/example_notebooks/
for file in */*.ipynb; do
echo "$file"
if [ -f "$file" ]; then
f=(${file//// })
f=${f[1]}
f=(${f//./})
finalFile="$runfolder"/"$f".py
echo "convert notebook $file to script $finalFile"
jupyter nbconvert --to python "$file" --stdout | grep -v -e "^get_ipython" > "$runfolder"/"$f".py
fi
done
- name: run all python scripts
env:
PYTHONPATH: "$/home/runner/.local/lib/python3.8/site-packages/"
runfolder: "/home/runner/notebook_run"
run: |
cp doc/pages/example_notebooks/galactic_lensing/crpropa_output.txt "$runfolder"/
cd "$runfolder"
for file in *.py; do
if [ "$file" = "custom-photon-fieldipynb.py" ] ||
[ "$file" = "MHD_modelsipynb.py" ] ||
[ "$file" = "density_grid_samplingipynb.py" ] ||
[ "$file" = "lensing_crv4ipynb.py" ] ||
[ "$file" = "lensing_mapsv4ipynb.py" ]; then
echo "skip file $file"
else
echo "run file $file"
python3 $file
fi
done
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## CRPropa vNext

### Bug fixes:
* Fixed sign for exponential decay of magn. field strength with Galactic height in LogarithmicSpiralField

### New features:

Expand All @@ -9,6 +10,8 @@
### Features that are deprecated and will be removed after this release

### Removed features
* AMRMagneticField - underlying library (saga) is no longer supported.
* ObserverPoint: Use Observer1D instead.

### New plugins and resources linked on the webpages

Expand Down
11 changes: 0 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -245,17 +245,6 @@ if(ENABLE_QUIMBY)
endif(QUIMBY_FOUND)
endif(ENABLE_QUIMBY)

# SAGA (optinal for AMR grids)
find_package(SAGA)
if(SAGA_FOUND)
list(APPEND CRPROPA_EXTRA_INCLUDES ${SAGA_INCLUDE_DIR})
list(APPEND CRPROPA_EXTRA_LIBRARIES ${SAGA_LIBRARY})
add_definitions (-DCRPROPA_HAVE_SAGA)
list(APPEND CRPROPA_SWIG_DEFINES -DCRPROPA_HAVE_SAGA)
list(APPEND SWIG_INCLUDE_DIRECTORIES ${SAGA_INCLUDE_DIR}/../python)
list(APPEND SWIG_INCLUDE_DIRECTORIES ${SAGA_INCLUDE_DIR})
endif(SAGA_FOUND)

# muparser (optional for generic source spectra)
find_package(muParser)
if(MUPARSER_FOUND)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CRPropa
========

![stable release](https://img.shields.io/badge/stable\_release-3.2.0-darkblue)
![stable release](https://img.shields.io/badge/stable\_release-3.2.1-darkblue)
[![Build status](https://github.com/crpropa/crpropa3/actions/workflows/testing.yml/badge.svg)](https://github.com/crpropa/crpropa3/actions/)
[![Average time to resolve an issue](https://isitmaintained.com/badge/resolution/CRPropa/CRPropa3.svg)](https://isitmaintained.com/project/CRPropa/CRPropa3)
[![Percentage of issues still open](https://isitmaintained.com/badge/open/CRPropa/CRPropa3.svg)](https://isitmaintained.com/project/CRPropa/CRPropa3)
Expand Down
4 changes: 2 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
# -- Project information -----------------------------------------------------

project = u'CRPropa3'
copyright = u'2022, The CRPropa Developers'
copyright = u'2024, The CRPropa Developers'
author = u'The CRPropa Developers'

# The short X.Y version
version = u'3.2'
# The full version, including alpha/beta/rc tags
release = u'3.2.0'
release = u'3.2.1'


# -- General configuration ---------------------------------------------------
Expand Down
14 changes: 7 additions & 7 deletions doc/pages/AdditionalResources.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@ Additional Resources
--------------------

- The Galactic magnetic field lenses can be downloaded
`here <https://syncandshare.desy.de/index.php/s/ReEXpW7Lngbn2j3>`__ .
`here <https://ruhr-uni-bochum.sciebo.de/s/VEaAL2HYbkaHL06>`__ .
- The multi-resolution 'Dolag' extragalactic magnetic field, using
`Quimby <https://github.com/CRPropa/Quimby>`__, can be
downloaded
`here <https://syncandshare.desy.de/index.php/s/StYK4jqcXMtgbZG>`__
`here <https://ruhr-uni-bochum.sciebo.de/s/qXJ4sGxA2qW8OQh>`__
- The 'Miniati', 'Dolag' and 'Benchmark' extragalactic magnetic field
models on regular grids are available in the same directory
`here <https://syncandshare.desy.de/index.php/s/StYK4jqcXMtgbZG>`__ and the
`here <https://ruhr-uni-bochum.sciebo.de/s/qXJ4sGxA2qW8OQh>`__ and the
corresponding large-scale structure density fields can be downloaded
`here <https://syncandshare.desy.de/index.php/s/7a948NZT98fP77Q>`__.
`here <https://ruhr-uni-bochum.sciebo.de/s/hQYDJfGwh9HCpQ8>`__.
- Data for the constrained `'Hackstein'
models <https://arxiv.org/abs/1710.01353>`__ of the local Universe
using initial conditions from the `CLUES
project <https://arxiv.org/abs/1510.04900>`__ can be downloaded
`here <https://syncandshare.desy.de/index.php/s/6HbWrBZeQtQ5t4c>`__.
`here <https://ruhr-uni-bochum.sciebo.de/s/kcsulGIhrnU9ks0>`__.
- Data for the strong extragalactic magnetic fields by `Alves Batista et al.
<https://arxiv.org/abs/1704.05869>`__ can be downloaded
`here <https://syncandshare.desy.de/index.php/s/Fo5xceXtwtk5Exo>`__.
`here <https://ruhr-uni-bochum.sciebo.de/s/oerRpvSzFKbkQNj>`__.
- Data for the Galactic mass distribution by `Mertsch et al. (2020) <https://arxiv.org/abs/2012.15770>`__ can be found
`here <https://syncandshare.desy.de/index.php/s/aR8wkqYYkDyfWgs>`__.
`here <https://ruhr-uni-bochum.sciebo.de/s/YD4wiiAdn3AK1SU>`__.


Note that these resources are completely external to CRPropa. We cannot supply any kind of additional information nor can we offer support on how to use them.
6 changes: 3 additions & 3 deletions doc/pages/Data-files.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CRPropa needs a number of data files to run. These include databases for nuclear mass and decay rates, interaction rates for photodisintegration, photo-pion production and electron-pair production, as well as the data files for DINT and EleCa.
CRPropa needs a number of data files to run. These include databases for nuclear mass and decay rates, interaction rates for photodisintegration, photo-pion production and electron-pair production.
The scripts and files that are used to prepare the data files are tracked by the [CRPropa3-data repository](https://github.com/CRPropa/CRPropa3-data).

Since a git repository is not well suited to store these large files (and git-lfs is not free on GitHub), the data files are downloaded automatically during cmake configuration. In case you want to use a different photodisintegration model or want to download the default data file manually use the following [link](https://www.desy.de/~crpropa/data/interaction_data/) to the tarballs files and extract them to your install folder.
Since a git repository is not well suited to store these large files (and git-lfs is not free on GitHub), the data files are downloaded automatically during cmake configuration. In case you want to use a different photodisintegration model or want to download the default data file manually use the following [link](https://ruhr-uni-bochum.sciebo.de/s/3juW9sntQX2IWBS) to the tarballs files and extract them to your install folder.

**Default data files:** (data-YYYY-MM-DD.tar.gz where YYYY-MM-DD depends on the data files version)
Contains interaction rates nuclei, electrons and photons and spectra of secondary particles from these interactions, as well as data on nuclear masses and decay rates.
Expand All @@ -21,7 +21,7 @@ $ ls data-YYYY-MM-DD.tar.gz | xargs -I{} sh -c 'md5sum "$1" > "$1-CHECKSUM"' --
```
where **YYYY-MM-DD** can be obtained directly with `date +"%Y-%m-%d"`.

To verify the integrity of the data files, a it is enough to download the checksum file in the same directory with the data file:
To verify the integrity of the data files, it is enough to download the checksum file in the same directory with the data file:
```
$ md5sum -c *-CHECKSUM
```
Expand Down
4 changes: 0 additions & 4 deletions doc/pages/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Optionally CRPropa can be compiled with the following dependencies to enable cer

The following packages are provided with the source code and do not need to be installed separately.
+ SOPHIA: photo-hadronic interactions
+ EleCa and dint: electromagnetic cascades
+ googletest: unit-testing
+ HepPID: particle ID library
+ kiss: small tool collection
Expand All @@ -31,9 +30,6 @@ The following packages are provided with the source code and do not need to be i
+ healpix_base: Equal area pixelization of the sphere





## Build and Installation Variants
### Installation in system path

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"metadata": {},
"source": [
"In this example a mass distribution is loaded from a given grid and used for the sampling of the source position of the candidates. \n",
"Here, we use the H2 distribution from [Mertsch & Vittino A&A 655, A64 (2021)](https://doi.org/10.1051/0004-6361/202141000). The original data can be found [here](https://zenodo.org/record/5501196) and have been converted to an CRPropa compatible format. The final data can be downloaded from the [additional rescources](https://desycloud.desy.de/index.php/f/451988900). We use the the Model SBM15. "
"Here, we use the H2 distribution from [Mertsch & Vittino A&A 655, A64 (2021)](https://doi.org/10.1051/0004-6361/202141000). The original data can be found [here](https://zenodo.org/record/5501196) and have been converted to an CRPropa compatible format. The final data can be downloaded from the [additional rescources](https://ruhr-uni-bochum.sciebo.de/s/YD4wiiAdn3AK1SU). We use the the Model SBM15. "
]
},
{
Expand Down
11 changes: 11 additions & 0 deletions doc/pages/example_notebooks/galactic_lensing/crpropa_output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# taken from https://github.com/CRPropa/CRPropa3/blob/2577c47ad898db13ce3b17c153e700041f304da4/galactic_lensing/crpropa_output.txt
1552.209 1000010010 1000260560 6.3094 1137.0405 118.8033 117.3283 120.0056 198.3873 -48.1072 250.9588 0.23085 0.06390 -0.97089 -0.76661 0.63718 -0.07947 0.000
1553.387 1000010010 1000260560 6.3049 1137.0405 119.3010 117.8840 119.3933 198.3873 -48.1072 250.9588 -0.52969 0.57890 -0.61993 -0.76661 0.63718 -0.07947 0.000
1552.209 1000010010 1000260560 6.3094 1137.0405 118.8033 117.3283 120.0056 198.3873 -48.1072 250.9588 0.23085 0.06390 -0.97089 -0.76661 0.63718 -0.07947 0.000
1553.387 1000010010 1000260560 6.3049 1137.0405 119.3010 117.8840 119.3933 198.3873 -48.1072 250.9588 -0.52969 0.57890 -0.61993 -0.76661 0.63718 -0.07947 0.000
2507.574 1000010010 1000020040 5.7274 157.5835 119.0234 117.9255 118.5094 64.1676 230.1578 58.0133 -0.24543 -0.93458 -0.25754 -0.21277 0.71704 -0.66376 0.000
597.459 1000010010 1000260560 9.6493 869.9225 119.0855 117.4122 119.7995 161.5538 74.8338 161.2846 -0.80199 0.46811 0.37105 -0.20573 0.14302 0.96810 0.000
1059.588 1000010010 1000260560 17.2427 7507.9875 118.9984 117.3895 118.5193 332.7822 143.8280 378.0030 -0.19054 0.28077 0.94067 -0.18628 0.64559 -0.74061 0.000
1342.343 1000010010 1000010010 17.7414 135.4199 118.9361 118.4267 118.8868 125.1438 25.9860 115.6526 0.01002 -0.98594 -0.16682 0.04910 -0.03836 -0.99806 0.000
140.527 1000010010 1000070140 50.7971 6946.8090 117.6596 117.8698 119.9085 173.0595 28.5316 197.1513 -0.17251 0.29795 -0.93886 -0.18122 0.95242 -0.24506 0.000
792.198 1000010010 1000070140 23.8203 765.9928 118.0031 117.7912 118.2653 221.2443 140.1373 120.6517 0.97493 0.06808 -0.21183 0.79843 0.58276 0.15130 0.000
10 changes: 10 additions & 0 deletions doc/pages/example_notebooks/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# collection of all packages used in the analyis of the example notebooks. This is used for the automatic test of the notebooks
numpy
matplotlib
pandas
healpy
seaborn
scipy
tqdm
h5py
jupyter
Loading

0 comments on commit b461fe9

Please sign in to comment.