A leightweight Python package for calculating and plotting Swarzschild black holes with thin accretion disk.
Project description
Luminet
Simulate and visualize Swarzschild black holes, based on the methods described in Luminet (1979).
:zap: Install
luminet is available from PyPI:
pip install luminet
:book: Documentation
:nut_and_bolt: Usage
All variables in this repo are in natural units: $G=c=1$
>>> from luminet.black_hole import BlackHole
>>> bh = BlackHole(
... mass=1,
... incl=1.5, # inclination in radians
... acc=1, # accretion rate
... outer_edge=40)
To create an image:
>>> ax = bh.plot() # Create image like above
To sample photons on the accretion disk:
>>> bh.sample_photons(100)
>>> bh.photons
radius alpha impact_parameter z_factor flux_o
10.2146 5.1946 1.8935 1.1290 1.8596e-05
... (99 more)
Note that sampling is biased towards the center of the black hole, since this is where most of the luminosity comes from.
:memo: Background
Swarzschild black holes have an innermost stable orbit of $6M$, and a photon sphere at $3M$. This means that the accretion disk orbiting the black hole emits photons at radii $r>6M$. As long as the photon perigee in curved space remains larger than $3M$ (also called the photon sphere), the photon is not captured by the black hole and can in theory be seen from some observer frame $(b, \alpha)$. The spacetime curvature is most easily interpreted as a lensing effect between the black hole frame $(r, \alpha)$ and the observer frame $(b, \alpha)$. The former are 2D polar coordinates that span the accretion disk area, and the latter are 2D polar coordinates that span the "photographic plate" of the observer frame. Think of the latter as a literal CCD camera. The photon orbit perigee and the radius in observer frame $b$ are directly related:
$$b^2 = \frac{P^3}{P-2M}$$
This makes many equations significantly more straightforward. You may notice this equation has a square on the left hand side, in contrast to Luminet (1979). The original manuscript has a handful of notation errors. I've contacted the author about this, to which he kindly responded:
"[...] à l’époque je n'avais pas encore l’expérience de relire très soigneusement les épreuves. Mais mes calculs avaient heureusement été faits avec les bonnes formules, sinon le résultat visuel n’aurait pas été correct!"
"Back in the day, I did not have the habit of carefully double-checking my proofs. Luckily, I did calculate the results with the correct formulas, otherwise the image wouldn't be right!".
Just so you know. I tried to be diligent about noting where this code differs from the paper.
The relationship between the angles of both coordinate systems is trivial, but the relationship between the radii in the two reference frames is given by the monstruous Equation 13:
$$\frac{1}{r} = - \frac{Q - P + 2M}{4MP} + \frac{Q-P+6M}{4MP}{sn}^2\left( \frac{\gamma}{2}\sqrt{\frac{Q}{P}} + F(\zeta_\infty, k) \right)$$
Here, $F$ is an incomplete Jacobian elliptic integral of the first kind, $k$ and $Q$ are a function of the perigee $P$, $\zeta$ are trigonometric functions of $P$, and $\gamma$ satisfies:
$$\cos(\gamma) = \frac{\cos(\alpha)}{\sqrt{\cos^2\alpha + \cot^2\theta_0}}$$
In curved spacetime, there is usually more than one photon orbit that originates from the accretion disk, and arrives at the observer frame. Photon orbits that curve around the black hole and reach the observer frame are called "higher order" images, or "ghost" images. In this case, $\gamma$ satisfies:
$$2n\pi - \gamma = 2\sqrt{\frac{Q}{P}} \left( 2K(k) - F(\zeta_\infty, k) - F(\zeta_r, k) \right)$$
These ghost photons are what you see on the lower half of the image above, as well as the barely visible halo of light that wraps thinly around the photon sphere. For inclinations that are less edge-on, this ghost image is less pronounced though.
This repo uses scipy.optimize.brentq to solve these equations, and provides convenient API to the concepts presented in Luminet (1979). The BlackHole class is the most obvious one, but it's also educative to play around with e.g. the Isoradial class: lines in observer frame describing photons emitted from the same radius in the black hole frame. The Isoredshift class provides lines of equal redshift in the observer frame.
:closed_book: Bibliography
[1] Luminet, J.-P., “Image of a spherical black hole with thin accretion disk.”, Astronomy and Astrophysics, vol. 75, pp. 228–235, 1979.
[2] J.-P. Luminet, “An Illustrated History of Black Hole Imaging : Personal Recollections (1972-2002).” arXiv, 2019. doi: 10.48550/ARXIV.1902.11196.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file luminet-0.1.0.tar.gz.
File metadata
- Download URL: luminet-0.1.0.tar.gz
- Upload date:
- Size: 22.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
adf4355d333a00969ed1564daddf7992eaba78b5ab86be90de29c2c85f035688
|
|
| MD5 |
15e719fd3739e90460d2c86b604f6966
|
|
| BLAKE2b-256 |
255baaea8b0b1ad4f2f013cd39f06a29fceb626f97ad1f5c201f764bb93fdbdc
|
Provenance
The following attestation bundles were made for luminet-0.1.0.tar.gz:
Publisher:
publish-to-pypi.yml on bgmeulem/luminet
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
luminet-0.1.0.tar.gz -
Subject digest:
adf4355d333a00969ed1564daddf7992eaba78b5ab86be90de29c2c85f035688 - Sigstore transparency entry: 174617547
- Sigstore integration time:
-
Permalink:
bgmeulem/luminet@00e3bb294cedebc9b5cb9cfdf9945dd0e7fb6d34 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/bgmeulem
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@00e3bb294cedebc9b5cb9cfdf9945dd0e7fb6d34 -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file luminet-0.1.0-py3-none-any.whl.
File metadata
- Download URL: luminet-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b155d28d5d1037190499fe4972b852d0d298d94e6fbe5ff12e754a72350c91b
|
|
| MD5 |
9273bd842313c908442692d0d74ac09b
|
|
| BLAKE2b-256 |
6ba4b4a747adf6ab3402b11491f86a200071ee226f0ddd2ff96ff0fd5e4ef885
|
Provenance
The following attestation bundles were made for luminet-0.1.0-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on bgmeulem/luminet
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
luminet-0.1.0-py3-none-any.whl -
Subject digest:
5b155d28d5d1037190499fe4972b852d0d298d94e6fbe5ff12e754a72350c91b - Sigstore transparency entry: 174617550
- Sigstore integration time:
-
Permalink:
bgmeulem/luminet@00e3bb294cedebc9b5cb9cfdf9945dd0e7fb6d34 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/bgmeulem
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@00e3bb294cedebc9b5cb9cfdf9945dd0e7fb6d34 -
Trigger Event:
workflow_run
-
Statement type: