pyc2ray is the updated version of C2Ray (G. Mellema, I.T. Illiev, A. Alvarez & P.R. Shapiro, 2006), an astrophysical radiative transfer code widely used to simulate the Epoch of Reionization (EoR). pyc2ray features a new raytracing method developed for GPUs, named Accelerated Short-characteristics Octhaedral RAytracing (ASORA). pyc2ray has a modern python interface that allows easy and customizable use of the code without compromising computational efficiency. A full description of the update and new raytracing method can be found at Hirling, Bianco, Giri, Iliev, Mellema & Kneib (2024).
The core features of C2Ray, written in Fortran90, are wrapped using f2py as a Python extension module, while the new raytracing library, ASORA, is implemented in C++ using CUDA. Both are native Python C extensions and can be directly accessed from any Python script.
Visit the ReadTheDocs of pyc2ray for the complete documentation, tutorials, installation instructions, and more.
Requirements:
- C++ compiler that supports the c++20 standard, e.g. gcc >= 12.0
- Fortran compiler, e.g. gfortran >= 12.0
- CUDA toolkit with
nvcccompiler, at least version 12.0
In your environment simply run
pip install .To specify a different host compiler for nvcc than the default one, you can run
pip install . -Csetup-args="-Dcuda_ccbindir=my-other-compiler"If the setuptools method doesn't work, you can alway compile the libraries manually.
Please see our documentation for step-by-step instructions on how to install pyc2ray.
A few example scripts summarizing the installation steps can be found in the repository /install_script/.
Here we list a series of numerical and astrophysical implementations we would like to include in future version of pyc2ray.
- Helium ionization, HeII and HeIII
- Sources radiative feedback
- Sources X-ray heating
- GPU implementation of the chemistry solver
- multi-frequency UV radiation
If you find any bugs or unexpected behavior in the code, please feel free to open a Github issue. The issue page is also good if you seek help or have suggestions for us.
Please follow these instructions to ensure a smooth integration, at least until a CI system is put into place:
- Only the first time, install
pre-commitin your enviornment and the pre-commit hooks withpre-commit install. - Create a new branch off the main trunk and make your modifications there.
- Commit your changes and fix any issue highlighted by the pre-commit hooks; code format is automatically fixed.
- Push your branch to the remote repository.
- Open a Pull Request on GitHub to the main branch.
- It is strongly suggested to squash all the commits into one.
- In the PR's description on GitHub, specify blocking dependencies with the message "Depends on #..." and close issues with "Closes #...".
- Ask the code to be reviewed before merging.
This project was initially developed by Patrick Hirling as part of the astrophysics practical workshop supervised by Michele Bianco during his master's degree at EPFL. You can find the original version of the code on his GitHub page: asora.
