Skip to content

Commit

Permalink
Merge remote-tracking branch 'master/master' into cringe_reproduction
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienDoerner committed Nov 8, 2024
2 parents 7ffbf70 + 61a6257 commit ec64d2f
Show file tree
Hide file tree
Showing 39 changed files with 1,623 additions and 146 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/create_coverage_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: create-coverage-report
on: [workflow_dispatch]

jobs:
create-coverage-report:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
config:
- name: "ubuntu-22"
os: ubuntu-22.04
cxx: "g++-11"
cc: "gcc-11"
fc: "gfortran-11"
swig_builtin: "On" #uses swig 4.0.2
py: "/usr/bin/python3" #python 3.10
# define steps to take
steps:
- name: Checkout repository
uses: actions/checkout@v4
- 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==7.2.6 sphinx_rtd_theme m2r2 nbsphinx lxml_html_clean 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 -DPython_EXECUTABLE=${{ matrix.config.py }} -DENABLE_TESTING=On -DENABLE_SWIG_BUILTIN=${{ matrix.config.swig_builtin }} -DSIMD_EXTENSIONS=native -DPython_INSTALL_PACKAGE_DIR=/home/runner/.local/ -DBUILD_DOC=OFF -DENABLE_COVERAGE=On
- 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: archive documentation
uses: actions/upload-artifact@v4
with:
name: "coverage"
path: |
build/coverage.tar.gz
7 changes: 3 additions & 4 deletions .github/workflows/create_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
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
pip install sphinx==7.2.6 sphinx_rtd_theme m2r2 nbsphinx lxml_html_clean breathe pandoc exhale # load requirements for documentation
- name: Set up the build
env:
CXX: ${{ matrix.config.cxx }}
Expand All @@ -50,16 +50,15 @@ jobs:
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
cp -r coverageReport doc/pages/coverageReport
tar -zcvf documentation.tar.gz doc
- name: archive documentation
uses: actions/upload-artifact@v4
with:
name: "documentation"
path: |
build/documentation.tar.gz
build/coverage.tar.gz
69 changes: 69 additions & 0 deletions .github/workflows/deploy_new_documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: deploy-documentation
on:
push:
branches:
- main
- 'releases/**'

jobs:
build-and-deploy:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
config:
- name: "ubuntu-22"
os: ubuntu-22.04
cxx: "g++-11"
cc: "gcc-11"
fc: "gfortran-11"
swig_builtin: "On" #uses swig 4.0.2
py: "/usr/bin/python3" #python 3.10

# define steps to take
steps:
- name: Checkout repository
uses: actions/checkout@v4
- 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==7.2.6 sphinx_rtd_theme m2r2 nbsphinx lxml_html_clean 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 -DPython_EXECUTABLE=${{ matrix.config.py }} -DENABLE_TESTING=On -DENABLE_SWIG_BUILTIN=${{ matrix.config.swig_builtin }} -DSIMD_EXTENSIONS=native -DPython_INSTALL_PACKAGE_DIR=/home/runner/.local/ -DBUILD_DOC=On -DENABLE_COVERAGE=On
- 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
- name: build documentation
run: |
cd build
make doc
- name: move final documentation # to avoid conflict with .gitignore
run: |
mv build/doc ~/final_doc
cp -r build/coverageReport ~/final_doc/pages/coverageReport
- name: deploy documentation #deploys the documentation to the gh-pages branch
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: ~/final_doc

3 changes: 1 addition & 2 deletions .github/workflows/test_examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ jobs:
- name: Preinstall
run: |
sudo apt-get update
sudo apt-get install libmuparser-dev python3 python3-dev python3-numpy python3-setuptools python-setuptools libhdf5-serial-dev libomp5 libomp-dev libfftw3-dev libcfitsio-dev lcov
sudo apt-get install libmuparser-dev python3 python3-dev 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 }}
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/testing_OSX.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ jobs:
os: macos-14
cxx: "clang++"
cc: "clang"
fc: "gfortran-11"
fc: "gfortran-14"
swig_builtin: "On" #uses swig 4.0.2
py: "/usr/bin/python3"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Preinstall
run: |
brew install hdf5 fftw cfitsio muparser libomp numpy swig
brew install hdf5 fftw cfitsio muparser libomp swig
pip install numpy==1.26
- name: Set up the build
env:
CXX: ${{ matrix.config.cxx }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ lib/
share/
doc/api/

!final_doc/ # needed for deployment of the documentation

cmake/CMakeCache.txt
cmake/CMakeFiles/

Expand Down
29 changes: 16 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
## CRPropa vNext

### Bug fixes:
* Fixed sign for exponential decay of magn. field strength with Galactic height in LogarithmicSpiralField
* Fixed r term in source distribution for SNR and Pulsar
* Fixed sign for exponential decay of magn. field strength with Galactic height in LogarithmicSpiralField
* Fixed r term in source distribution for SNR and Pulsar
* Fixed wrong mass inheritance for secondaries other than nuclei or electron/positron

### New features:
* Added new backwards-compatible function particleMass that returns particle mass also for non-nuclei
* Added the new Galactic magnetic field models from Unger&Farrar arXiv:2311.12120
* Added EBL model from Finke et al. 2022

### Interface changes:

### Features that are deprecated and will be removed after this release
* EBL model from Finke et al. 2022

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

Expand Down Expand Up @@ -40,8 +43,8 @@
* ObserverPoint will be renamed into Observer1D.
* AMRMagneticField - underlying library (saga) is no longer supported.

### Removed features
* External extensions DINT and Eleca, which can be replaced with the
### Removed features
* External extensions DINT and Eleca, which can be replaced with the
EM*-modules combined with the thinning option for reasonable computation
times.

Expand All @@ -50,20 +53,20 @@
* grplinst
* monopole
* ROOTOutputPlugin


## CRPropa 3.2

### Bug fixes:
* Fix of reflective boundary condition for scalar- and vectorgrids
that showed asymmetry and discontinuities (See issue [#361]).
* Fix in EMTripletPairProduction
* Fix of the data files of the Hackstein EGMF models as well as the
* Fix of the data files of the Hackstein EGMF models as well as the
corresponding example notebook.
* Fix of axis normalization of getRotated in Vector3.h.
* Fix of secondary spectra in electromagnetic interactions
(EM*-modules), issue [#334] and pull request [#15] in crpropa-data.
* Fix weight inheritance for secondary particles; they are created with
* Fix weight inheritance for secondary particles; they are created with
their parents weights as intial weights now.

### New features:
Expand All @@ -73,15 +76,15 @@
and vectorgrids.
* Add the new PolarizedSingleModeMagneticField class for polarized/
helical single mode magnetic field models.
* Add a source feature for targeted emission, following the
* Add a source feature for targeted emission, following the
von-Mises-Fisher distribution
* Updates in SNR and pulsar source distributions
* Updates in SNR and pulsar source distributions

### Interface changes:
* Plane wave and grid turbulence models use same parameter convention now
* Plane wave and grid turbulence models use same parameter convention now

### Features that are deprecated and will be removed after this release
* External extensions DINT and Eleca, which can be replaced with the
* External extensions DINT and Eleca, which can be replaced with the
EM*-modules combined with the thinning option for reasonable computation
times.

Expand Down
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,12 @@ endif(APPLE)
# Download data files (interaction data, masses, decay data ...)
# ----------------------------------------------------------------------------
OPTION(DOWNLOAD_DATA "Download CRPropa data files" ON)
set(CRPROPA_DATAFILE_VER "2024-03-11")
set(CRPROPA_DATAFILE_VER "2024-04-30")
if(DOWNLOAD_DATA)
message("-- Downloading data files from sciebo ~ 73 MB")
file(DOWNLOAD
https://ruhr-uni-bochum.sciebo.de/public.php/webdav/data-${CRPROPA_DATAFILE_VER}.tar.gz-CHECKSUM
${CMAKE_BINARY_DIR}/data-${CRPROPA_DATAFILE_VER}.tar.gz-CHECKSUM
${CMAKE_BINARY_DIR}/data-${CRPROPA_DATAFILE_VER}.tar.gz-CHECKSUM
USERPWD "3juW9sntQX2IWBS")
file(STRINGS ${CMAKE_BINARY_DIR}/data-${CRPROPA_DATAFILE_VER}.tar.gz-CHECKSUM DATA_CHECKSUM LIMIT_COUNT 1 LENGTH_MINIMUM 32 LENGTH_MAXIMUM 32)
file(DOWNLOAD
Expand Down Expand Up @@ -403,6 +403,7 @@ add_library(crpropa SHARED
src/magneticField/turbulentField/PlaneWaveTurbulence.cpp
src/magneticField/turbulentField/SimpleGridTurbulence.cpp
src/magneticField/TF17Field.cpp
src/magneticField/UF23Field.cpp
src/magneticField/CMZField.cpp
src/advectionField/AdvectionField.cpp
src/massDistribution/ConstantDensity.cpp
Expand Down Expand Up @@ -467,7 +468,7 @@ if(ENABLE_PYTHON AND Python_FOUND)
endif(Python_Development_FOUND)


# use Python_INSTALL_PACKAGE_DIR if provided; otherwise, install in Python_SITELIB
# use Python_INSTALL_PACKAGE_DIR if provided; otherwise, install in Python_SITELIB
set(Python_INSTALL_PACKAGE_DIR "${Python_SITELIB}" CACHE PATH "folder in which the python package is installed")
message(STATUS " package install directory: ${Python_INSTALL_PACKAGE_DIR}")

Expand Down
4 changes: 1 addition & 3 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ Contents

.. toctree::
:caption: DEVEL
:maxdepth: 1
:maxdepth: 2

pages/Debugging.md
pages/Code-Coverage.md
pages/Data-files.md


3 changes: 3 additions & 0 deletions doc/pages/Code-Coverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ make test
make coverage
```
The final report is in ```~/build/coverageReport/index.html```

### Coverage report of the current master branch
The coverage report of the current master branch can be accesed `by clicking here <coverageReport/index.html>`_ now.
113 changes: 47 additions & 66 deletions doc/pages/example_notebooks/density/density_grid_sampling.ipynb

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"\n",
"# magnetic field setup\n",
"B = JF12Field()\n",
"#B = UF23Field(UF23Field.base) # options: base,neCL,expX,spur,cre10,synCG,twistX,nebCor \n",
"#seed = 691342\n",
"#B.randomStriated(seed)\n",
"#B.randomTurbulent(seed)\n",
Expand Down
2 changes: 1 addition & 1 deletion doc/pages/example_notebooks/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# collection of all packages used in the analyis of the example notebooks. This is used for the automatic test of the notebooks
numpy
numpy==1.26.4
matplotlib
pandas
healpy
Expand Down
1 change: 1 addition & 0 deletions include/CRPropa.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#include "crpropa/magneticField/PT11Field.h"
#include "crpropa/magneticField/QuimbyMagneticField.h"
#include "crpropa/magneticField/TF17Field.h"
#include "crpropa/magneticField/UF23Field.h"
#include "crpropa/magneticField/CMZField.h"
#include "crpropa/magneticField/turbulentField/GridTurbulence.h"
#include "crpropa/magneticField/turbulentField/HelicalGridTurbulence.h"
Expand Down
Loading

0 comments on commit ec64d2f

Please sign in to comment.