GRAMPA is a Python-based tool for modeling magnetic fields as Gaussian random fields following a specified power spectrum and electron density profile, as described in Murgia et al. (2004) and originally proposed by Tribble (1991). This framework is designed primarily for analyzing Faraday rotation experiments in galaxy clusters but can be applied more generally to other magnetized plasmas, depending on the chosen parameters.
Install GRAMPA from PyPI with
pip install grampa
To begin using GRAMPA, refer to the Jupyter notebook examples/example_cluster_Bfield.ipynb, which provides an example workflow to help users understand the implementation and features of the code.
If you use this code in your research, please cite the following works:
- Osinga et al. 2022: A&A, 665, A71
- Osinga et al. 2025: A&A, 694, A44
If your work involves lognormal density fluctuations, please also cite:
- Khadir et al. 2026: ApJ, 997-2, id214, 26 pp
- PyFC: PyFC on PiWheels
This software is provided under an open-source license. Please check the GitHub repository for details.
For questions or feedback, please reach out to the authors or open an issue on the Github repository
Pull requests are welcome for users that want to add features!
GRAMPA uses a set of developer tools that can be installed with
git clone git@github.com:ErikOsinga/grampa.git
cd grampa
pip install '.[dev]'
These tools can run upon git commit by using
pre-commit install
GRAMPA will follow the Conventional Commit Message format: for versioning
- For a feature (MINOR VERSION UPDATE): (e.g. git commit -m "feat(optional scope): description")
- For a bugfix (PATCH VERSION UPDATE): (e.g. git commit -m "fix(optional scope): description")
- For a breaking change (!) (MAJOR VERSION UPDATE): (e.g. git commit -m "featorfix!(optional scope): description")
