Skip to main content

GRAVITYp

GRAVITYp is a Python package for studying the optical appearance of spherically symmetric compact objects in General Relativity. It stands for Geodesic RAys and Visualization of IntensiTY profiles.

About the project

This is the Python implementation of GRAVITYp, which is originally a numerical code in Wolfram language developed by G.J. Olmo, D. Rubiera García, J.L. Rosa, D. Sáez-Chillón and collaborators arXiv:2307.06778v2. It was developed to study the optical appearance or shadow cast by black holes, wormholes and different kinds of exotic compact objects, inspired by the work of S.E. Gralla et al. arXiv:1906.00873.

Then, Á. Salazar Cuadros preferred to work on Python seeking faster execution times for simulations and a language better suited for Version Control Systems (VCS), and that's how the Python implementation was born. The goal of this open source version is to provide open access to anyone interested in using the package or learning how simulated black hole shadow images are generated.

Installation

You can clone GRAVITYp locally in editable mode for research and development:

git clone git@github.com:alvaroslzar/GRAVITYp.git       # SSH
git clone https://github.com/alvaroslzar/GRAVITYp.git   # HTTPS

Then, install it in your virtual environment

cd GRAVITYp
pip install -e .

Usage

Quick example

import numpy as np
from gravityp import make_geodesics_plot

def g_rr(r: float, dummy) -> float:
    """Radial function g^{rr} of the Schwarzschild metric in units of M=1"""
    return 1 - 2./r

def g_thth(r: float, dummy) -> float:
    """Areal radius squared g^{theta theta} of the Schwarzschild in units of M=1"""
    return r**2

# Dictionary codifying Schwarzschild metric and required params
Schwarzschild_kwargs = {
    'r_phs': [3.,],         # Photon sphere at r=3M
    'inner_edge': 2.,       # Inner edge of disk at horizon r=2M
    'radial_fun': g_rr,     # Above defined radial function
    'radial_params': None,  # g_rr has no additional params
    'areal': g_thth,        # Above defined areal radius squared
    'areal_params': None,   # g_thth has no additional params
}

# Array of impact parameters from 0M to 10M
impact_parameters = np.arange(0,10,0.2)
make_geodesics_plot(impact_parameters, figsize=(4,4), **Schwarzschild_kwargs)

The output image looks like this:

ray-tracing

For a more detailed explanation, check the Jupyter notebooks in the Examples folder for details.

Intensity profiles and black hole shadows

The primary use is to obtain the observed intensity profile $I_\mathrm{ob}(b)$ as a function of the impact parameter $b$ given some predefined emission profile $I_\mathrm{em}(r)$. The emitted light is due to the matter in the accretion disk, which is assumed to be both geometrically and optically thin. Moreover, the orientation is assumed to be face-on with respect to the accretion disk, so the optical appearance has have rotational symmetry.

In the following images, the emission profile of the accretion disk has been chosen to peak at the event horizon $r=2M$, and the optical appearance corresponds to a Schwarzschild black hole.ç The code properly reproduces the predicted light rings up to two intersections with the accretion disk, as well as the central brightness depression or shadow characteristic of compact objects such as black holes.

emitted observed shadow

Further references

Watch Prof. D. Rubiera García's talk for an overview of the main concepts involved in the ray-tracing method and analysis of intensity profiles.

For an introductory discussion of the inner workings of the Wolfram Mathematica code, watch Prof. G.J. Olmo's tutorial; for a more user-friendly application, watch Dr. J.L. Rosa's talk.

Finally, for a more advanced topic regarding compact objects, watch Prof. D. Sáez-Chillón's contribution.

Citation

The use of GRAVITYp in scientific publications must be properly acknowledged. Please cite the following:

BibTeX

@article{Nojiri:2026tjn,
    author = "Nojiri, Shin'ichi and Odintsov, Sergei D. and S{\'a}ez-Chill{\'o}n G{\'o}mez, Diego and Cuadros, {\'A}lvaro Salazar",
    title = "{Horizon singularity, energy conditions and shadows in time-dependent and spherically symmetric spacetime}",
    eprint = "2608.15740",
    archivePrefix = "arXiv",
    primaryClass = "gr-qc",
    reportNumber = "KEK-TH-2861, KEK-Cosmo-0429",
    month = "8",
    year = "2026"
}

Publications using GRAVITYp

Let us know if you use GRAVITYp in your publication, and we will add it to the list of publications!

Author

The author and mantainer of the Python code is Álvaro Salazar Cuadros.

License

The software is licensed under the MIT license.

Metadata

Release files for gravityp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gravityp 0.1.0
File Size Uploaded
gravityp-0.1.0.tar.gz 16.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gravityp 0.1.0
File Interpreter ABI Platform
gravityp-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 34.4 kB

Release files / gravityp-0.1.0.tar.gz

Download URL gravityp-0.1.0.tar.gz
Size 16.9 kB
Tags Source
SHA-256 checksum
How to use checksums
335bfc133de1125b299c9dd15bc7a38e1ee93c19aae44fcd8ecbcaeeca9c22f8
BLAKE2b-256 checksum
How to use checksums
05329a76953a8f3aff9397b8524aa279c6b67d47c6d86b495e6bfd823e40f112
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / gravityp-0.1.0-py3-none-any.whl

Download URL gravityp-0.1.0-py3-none-any.whl
Size 17.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7e167cbde07319bff5813f32d39a56e2fd18e707ec590c66d7a580f21bda7c28
BLAKE2b-256 checksum
How to use checksums
ed1ef022b9bc374ba8888fab27aff68cb40bc98da0db37097764a849bacaa79b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release history Release notifications | RSS feed

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page