Skip to main content

coronagraphoto logo

PyPI Documentation Status Tests License Python 3.12+ DOI


coronagraphoto

coronagraphoto is a Python library designed to simulate coronagraphic observations of exoplanetary systems. The base "thing" it produces are images/photos, hence the name. It has been designed to bridge the gap between yield calculations and concrete image generation for missions like the Habitable Worlds Observatory (HWO).

The library integrates high-fidelity coronagraph models from the standard format used for yield calculations (dubbed a "Yield Input Package" and loaded via yippy) with detailed planetary system simulations (via ExoVista) to produce realistic detector images.

Built on JAX, coronagraphoto supports JIT compilation and differentiation of scene predictions with fixed instrument geometry. JAX provides CPU and accelerator execution.

Key Features

  • End-to-End Simulation: From astrophysical scenes to detector readouts.
  • JAX & JIT Compatible: High-performance simulations using functional programming patterns.
  • Modular Design: flexible optical paths, easily swappable coronagraphs and detectors.
  • HWO Ready: Specifically designed to support yield modeling for future direct imaging missions.

Installation

pip install coronagraphoto

(Note: You may need to install JAX separately to match your specific hardware acceleration requirements (CUDA/TPU/CPU).)

Photon budgets and detector images

Scenes come from skyscapes; hardware and detector statistics come from optixstuff. One Exposure record, built once with build_exposure, carries the epoch, roll, wavelength quadrature and frame plan. The image reader takes (scene, instrument, exposure):

Function Output Units
photon_rates photon Rates, each field (W, Q, ny, nx) photons/s/nm/pixel
expected electron Rates, each field (W, ny, nx) electrons/s/pixel
observe Image, data (W, ny, nx) electrons/pixel

The fields are planet, star_leakage, local_zodi, exozodi, thermal and stellar_companions; the reader does not model the last one, so it holds zeros. thermal is the warm telescope's uniform emission from Instrument.warm_emission, zero without it. Call .total() to combine terms. Optical throughput excludes detector yield. Only detector.electrons applies QE and survival, at the quadrature nodes. observe calls detector.draw once on the combined electron budget.

expected scans nodes and accumulates band images, holding one node's images at a time. photon_rates retains all nodes for inspection and small problems. build_exposure builds the quadrature on the host from the scene's tabulated sources and the instrument. Its Gauss-Legendre rule splits at every declared break, including detector QE knots, and the exposure also holds the Resolution that reduces each tabulated spectrum (star, planet, local zodi) to the band's nodes, so a line-rich table integrates exactly with few nodes. A band a table does not cover is refused. A table's knot grid is a static Knots value, never a leaf, so the exposure declares no reads; a scene that holds a NumPy leaf is refused at entry. Reuse one exposure across readers, and change other fields with dataclasses.replace.

Exposure times

A yield or scheduling code needs the time to a signal-to-noise ratio for millions of candidate planets, far more than can each be rendered. The image path fills tables once and the answer is read from them:

Function When Output
aperture_response(instrument, quadrature) once per instrument and band set planet throughput against separation, aperture pixel weights
aperture_record(scene, instrument, exposure, response) once per target and exposure star-leakage, uniform-sky and exozodi tables summed in the aperture on a half-pixel lattice, and planet_response plus build-time star
aperture_rates(record, east_arcsec, north_arcsec, *, contrast=None, planet=None, time_d=...) once per planet and time aperture Rates, photons/s/nm, with n_pix and squared-weight variance
scene_aperture_rates(record, scene, time_d) once per scene and set of times the same read for every planet at every time, Rates fields (W, Q, K, T), ready for optixstuff.exposure_time
optixstuff.snr(rates, detector, time_s, frame_time_s=..., post_processing=...) once per planet S/N per band
optixstuff.exposure_time(rates, detector, target_snr, frame_time_s=..., post_processing=...) once per planet ExposureTime(time_s, valid) per band

The last three are pure array functions for jax.jit, jax.vmap and jax.grad. The local zodi is read from scene.local_zodi and the disk from the scene, exactly as in the images. See aperture rates and exposure time and how an exposure time is computed.

Quick start

Enable float64 before loading orbital state vectors. This example downloads a public scene and YIP on first use; the epoch must lie in the scene's recorded time range.

import jax

jax.config.update("jax_enable_x64", True)

from optixstuff import ConstantThroughput, FramePlan, IdealDetector, Instrument
from optixstuff.spectral import Band
from skyscapes import from_exovista
from skyscapes.datasets import fetch_scene
from yippy import fetch_yip, open_yip
from coronagraphoto import build_exposure, expected, observe

scene = from_exovista(fetch_scene(), load_disk=False)
coronagraph = open_yip(fetch_yip("eac1_aavc_2d")).prepare()
instrument = Instrument(
    primary=coronagraph.primary,  # the telescope the YIP was computed for
    attenuating_elements=(ConstantThroughput(throughput=0.4),),
    coronagraph=coronagraph,
    detector=IdealDetector(pixel_scale_arcsec=0.01, shape=(128, 128)),
)
bands = (Band(500.0, 600.0),)
exposure = build_exposure(
    scene,
    instrument,
    bands,
    time_d=0.0,
    roll_deg=30.0,
    plan=FramePlan(frame_time_s=100.0, n_frames=36),
)
rates = expected(scene, instrument, exposure)
image = observe(jax.random.PRNGKey(0), scene, instrument, exposure)
# imshow(image.data[0], origin="lower")

For disks, load the disk and give the coronagraph a scene renderer with coronagraph.with_scene_operator(). The reader requests disk photon radiance on the detector sky grid and passes its per-pixel flux through the coronagraph's field-dependent PSFs.

Rows increase along detector +y and columns along detector +x. Pixel (j,i) is centred at (x,y)=(i,j), including even grids. roll_deg is the position angle of detector +y, north through east. At zero, east is left and north is up; at 90 degrees, north is right. A roll changes this orientation for both planets and disks.

Speckle fields are supplied through Instrument.speckle. Their positive excess joins star_leakage; their existing physics is retained. The reader calls realize(wavelength_nm=..., elapsed_s=speckle.elapsed_s(time_d)): the field converts scene time to seconds on its own clock. Under x32 a field with a nonzero epoch_d is refused, because a float32 scene time near that epoch has already lost the offset; enable x64, move the scene epoch to the observation so that epoch_d is zero, or anchor the field at zero. The speckle pattern remains fixed in detector coordinates as pointing rolls.

Select record fields for per-source access. See rate and observation contracts and JAX and memory for details.

Metadata

Release files for coronagraphoto 7.0.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 coronagraphoto 7.0.0
File Size Uploaded Provenance Actions
coronagraphoto-7.0.0.tar.gz 3.2 MB With provenance Details for coronagraphoto-7.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 3.2 MB

Release files / coronagraphoto-7.0.0.tar.gz

Download URL coronagraphoto-7.0.0.tar.gz
Size 3.2 MB
Tags Source
SHA-256 checksum
How to use checksums
88067e6f90d452abbce136e37f30851b69c09b90d8eee8b54908f3fda14e35aa
BLAKE2b-256 checksum
How to use checksums
f7275564f315b6722553966301d979a0cbf001963835c4292773dc6c71c1c646
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / coronagraphoto-7.0.0-py3-none-any.whl

Download URL coronagraphoto-7.0.0-py3-none-any.whl
Size 36.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b82559b977f635edaf0dea71b3e3099af189c1e64a72d816fe208b1a5a99e023
BLAKE2b-256 checksum
How to use checksums
e116e6fc9619b8e5ea2dab76d87a7f956b3412082fb8cba591e5811b17426bae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Security for coronagraphoto 7.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for coronagraphoto-7.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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