Skip to main content

coronachrome

PyPI Tests License Python 3.12+

coronachrome is a JAX lenslet integral-field-spectrograph (IFS) forward model and spectral extractor for high-contrast imaging, built for the Habitable Worlds Observatory (HWO) simulation suite.

Given a band-integrated focal-plane datacube (for example from coronagraphoto) and a hardware descriptor (an optixstuff.LensletDisperser), coronachrome compiles the instrument geometry into a single sparse linear operator, renders the dispersed IFS detector image of per-lenslet micro-spectra, and inverts the same operator to recover per-spaxel spectra with calibrated uncertainties. Everything is JAX-native: JIT-compilable, GPU-capable, and differentiable end to end.

Features

  • Compiled forward model: the lenslet grid, dispersion polynomial, and pixel-integrated PSFlets (Gaussian, Moffat, or tabulated templates) become one sparse matrix-vector product, with no per-lenslet loops at runtime.
  • Derived spatial sampling: the focal-plane pixels per lenslet follow from the descriptor's on-sky pitch and the cube plate scale, with build-time coverage and Nyquist diagnostics, rather than from a free knob.
  • Nyquist spectral grids: helpers implement the n = ceil(R ln(lam2 / lam1)) channel rule, log-spaced channel grids, and flux-conserving rebinning from an oversampled render grid.
  • PSFlet template packs: a documented npz format carries pixel-integrated PSFlet templates (per field anchor and wavelength, with optional wavecal centroid corrections) from any generator, such as a wave-optics propagation of the lenslet train, into the forward model.
  • Linear extraction with error bars: a matched filter, a matrix-free noise-weighted least-squares solve, and the per-spaxel Gauss-Markov covariance whose diagonal gives per-wavelength uncertainties.
  • One operator everywhere: the extraction exports the same H the simulation used, so simulation studies and data reduction share a single forward model.

Installation

pip install coronachrome

Quick example

import jax.numpy as jnp
from optixstuff.grids import Image, Measure, PixelGrid, SkyOrientation
from optixstuff import LensletDisperser

from coronachrome import IFSRenderer, build_ir, lstsq, spectral_grid

disperser = LensletDisperser(
    pitch_m=174e-6,
    pixsize_m=13e-6,
    angle_rad=0.4636,
    lam_ref_nm=660.0,
    pix_per_reselt=2.0,
    dispersion_coeffs=jnp.array([100.0, 0.0]),
    psflet_params=jnp.array([0.7]),
    psflet_ref_nm=660.0,
    grid_kind="square",
    n_lenslets=8,
    psflet_kind="gaussian",
    detector_shape=(256, 256),
    sky_pitch_arcsec=0.014,
)

bands = spectral_grid(resolving_power=50.0, low_nm=620.0, high_nm=700.0)
fp_grid = PixelGrid.regular(
    (64, 64), 0.007, "arcsec", orientation=SkyOrientation(pa_y_deg=0, parity=-1)
)
ir = build_ir(disperser, bands, fp_grid)
renderer = IFSRenderer(ir)

cube = Image(
    jnp.ones((len(bands), 64, 64)),
    fp_grid,
    ("band",),
    measure=Measure.integral(),
    quantity="phot/s",
    reconstruction="nearest",
)
detector = renderer.forward_spmv(cube)  # Image on a meter detector grid
spectra = lstsq(renderer, detector)  # Image on the lenslet sky grid
assert spectra.quantity == "phot/s"

LensletLayout centres every layout geometrically: square centres subtract (n-1)/2; hex centres also remove the mean row stagger. Focal-plane centres come from the input grid; detector centres come from hwoutils.radial.get_center.

Each cube plane integrates one optixstuff.spectral.Band interval. Its reference wavelength is Band.geometric_center_nm, distinct from the arithmetic Band.center_nm. Lenslet collection exactly integrates piecewise-constant focal pixels by cell/pixel overlap; smooth reconstructions, including band-limited images, use that approximation (see the sampling contracts). An input in lambda/D must convert its grid through its Frame before rendering. Extraction preserves the detector quantity, so electron counts produce extracted electron counts. Use detector_statistics and extraction_weights with electron Rates and a FramePlan for count statistics; detector yield belongs in detector.electrons before wavelength contributions are combined.

Documentation

Full documentation, including the mathematical formulation, the sampling contracts, the PSFlet template pack format, and the CRISPY heritage mapping, lives at coronachrome.readthedocs.io.

Heritage and roadmap

coronachrome is a JAX reimplementation of the forward model in CRISPY, the WFIRST/Roman CGI IFS simulator, generalized to configurable dispersion laws and extended with differentiability and an analytic extraction covariance. Planned directions include an image-slicer geometry (a second build_ir registration), a regularized positivity and total-variation extractor, and physically propagated PSFlet template packs. See the documentation roadmap page for detail.

Metadata

Release files for coronachrome 2.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 coronachrome 2.0.0
File Size Uploaded Provenance Actions
coronachrome-2.0.0.tar.gz 247.8 kB With provenance Details for coronachrome-2.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 295.6 kB

Release files / coronachrome-2.0.0.tar.gz

Download URL coronachrome-2.0.0.tar.gz
Size 247.8 kB
Tags Source
SHA-256 checksum
How to use checksums
25cfdee3384f4581c0c6b203e78b0dbcf74ae7f4e39d571801c5a9a829e84ea5
BLAKE2b-256 checksum
How to use checksums
d30bb748c69275dc67908d514b7fc0681333320ab63e6ffc15e87452b0751dcf
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 / coronachrome-2.0.0-py3-none-any.whl

Download URL coronachrome-2.0.0-py3-none-any.whl
Size 47.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
05e132885a4d14fda2eebf32cc3be763bdb72ea3ba537463edbb2849515b826b
BLAKE2b-256 checksum
How to use checksums
19a4038551c202acb7d7bc2c824f3470b24cf60ec4f69b193c7f1a6f1a7b3515
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 coronachrome 2.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 coronachrome-2.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