Skip to main content

optixstuff

PyPI Documentation Status Tests License Python 3.12+ DOI

Shared hardware objects - with standard values - for the HWO direct-imaging simulation suite.

What optixstuff is

optixstuff is a thin shared dependency that defines the observatory's hardware as composable JAX modules: primary aperture, throughput-affecting elements, coronagraph backend, detector. Its job is to be the single source of truth for the hardware configuration that downstream tools consume.

coronagraphoto (2D image simulation), coronachrome (lenslet-IFS dispersion + spectral extraction), and jaxEDITH (exposure-time and yield calculations) import the same OpticalPath class and the same detector / throughput / primary / disperser types from optixstuff. Change a value here and every downstream tool picks it up on the next import.

What optixstuff is not

  • Not a wavefront tool. Diffraction, E-field propagation, and PSFs-from-first-principles belong to dLux and HCIPy.
  • Not a PSF interpolator. Image providers implement the shared AbstractCoronagraph contract; optixstuff owns the contract and scalar models.
  • Not a scene model. Stars, planets, disks, and zodi live in skyscapes.
  • Not a simulator. Downstream tools (coronagraphoto, coronachrome, jaxEDITH) consume an OpticalPath to produce images, dispersed IFS frames, or count rates.

Architecture

Built on JAX and Equinox, optixstuff provides:

  • Abstract interfaces - AbstractPrimary, AbstractOpticalElement, AbstractCoronagraph, AbstractDetector, AbstractDisperser
  • Concrete implementations - SimplePrimary, SegmentedPrimary (carries hex segment geometry for a diffraction backend), ConstantThroughput, IdealDetector, Detector (with optional wavelength-dependent QE), LensletDisperser
  • Container - OpticalPath, a composable hardware configuration passed to all simulators

Optical elements and coronagraphs accept fidelity axes - wavelength, position, and time - with defaults so that simple implementations can ignore unused axes while future high-fidelity models (wavelength-dependent coatings, position-dependent vignetting, time-dependent detector degradation) can use them without breaking the interface.

Primary geometry and coronagraph grids

Primaries expose diameter("circumscribed"), diameter("inscribed"), and collecting_area_m2. Build a lambda/D frame with primary.frame(500.0). SimplePrimary takes both diameters and collecting area as keyword arguments; SegmentedPrimary derives them from segment size, gap, and ring count. OpticalPath raises ValueError when its primary's diameter differs from the diameter of the coronagraph's lambda/D frame, so the tables and the collecting area describe one telescope. A yippy Coronagraph carries the matching primary.

Coronagraph images use hwoutils.grids.Image and an explicit target PixelGrid. Coordinates are (x, y), arrays are (..., y, x), and even-grid centres fall between pixels. For example, band.off_axis_psf(500.0, 3.0, target) returns per-pixel fractions of unocculted source flux. Use .data to obtain its array. Select the imaging model with band = coro.band(500.0). Its at_wavelength(500.0) gives the source, stellar and uniform-sky grids. Scene models return an image and a validity flag from render_scene(scene_image, 500.0, grid=target).

coro.curves(Circular(0.7)) is the single performance record for that aperture. Import Circular from optixstuff; prepare every required rule before JIT when constructing an image provider. Records contain throughput, core area, stellar leakage fraction, leakage density, raw contrast, iwa_lod, and data_extent_lod. A known design limit is separately named outer_working_angle_lod. ScalarCoronagraph stores calibrated constants for one declared aperture. MultiBandCoronagraph selects the first declared bandpass covering the wavelength. Coronagraph and speckle timestamps use time_d, days from the scene epoch; exposure durations remain seconds.

Linear speckle fields

Subclass LinearSpeckleField and implement coefficients(time_d), subtracting its static host epoch_d internally. Construct a FocalResponse with the complex nominal amplitude density e_nom, sensitivity density G, native lod grid, unocculted input energy and reference wavelength. The shared law uses response.per_pixel() and returns the excess [2 Re(conj(e_nom) G eps) + |G eps|^2] / input_energy, with G scaled by reference_wavelength_nm / wavelength_nm.

realize(wavelength_nm=..., time_d=...) returns an Image on the field's own grid, with Measure.integral(), stellar_flux_fraction, band_limited, and reflect metadata. Wavelength arrays, including quadrature nodes (W, Q), become leading axes. Each native lambda/D coordinate uses the node wavelength: convert with image.grid.to_arcsec(node_nm) before resampling that node onto a detector.

broadened(quadrature=..., time_d=...) averages realized nodes at fixed native lambda/D coordinates, normalizing the nm weights to sum to one per band. Detector-band images instead require resampling and spectral weighting at each node before integration. realize_average(..., exposure_s=..., start_time_d=...) retains its midpoint time-average meaning. Enable JAX x64 for deep contrast and for adding small offsets to absolute day timestamps. Nonlinear replay models continue to implement AbstractSpeckleField directly.

Detector chain

Readers supply PhotonRates in photons/s/nm at shared quadrature nodes. The detector converts them to ElectronRates with spectral QE and survival applied once, before integration. The observer owns the frame plan.

import jax
import jax.numpy as jnp
from hwoutils.spectral import Band, Quadrature
from optixstuff import Detector, PhotonRates, frames_for_time

detector = Detector(pixel_scale_arcsec=0.01, shape=(1, 1), qe=0.9)
quadrature = Quadrature.build([Band(500.0, 600.0)], detector, order=3)
rates = PhotonRates(quadrature, planet=jnp.ones((1, 3)))
electrons = detector.electrons(rates)
plan = frames_for_time(time_s=600.0, frame_time_s=300.0)
mean, variance = detector.mean_and_variance(electrons, plan)
counts = detector.draw(jax.random.key(0), electrons, plan)

The six source fields retain their names throughout the chain. Image readers use (W, Q, ny, nx) integrands; aperture readers use (W, Q). The detector returns (W, *spatial) electrons/s and count moments. See the detector contract for noise parameters, gain statistics, and readout overlap.

Ecosystem position

flowchart TB
    physopt["<b>Physical optics</b><br/>dLux / HCIPy / PROPER<br/>E-fields -> PSFs"]
    provider["<b>Image provider</b><br/>PSF interpolation"]
    optix["<b>optixstuff</b><br/>Telescope / Coronagraph / Detector / OpticalPath<br/>Throughput chains / QE / Noise rates"]
    jaxedith["<b>jaxEDITH</b><br/>Scalar count rates<br/>Exposure-time calculations"]
    corono["<b>coronagraphoto</b><br/>2D image simulation<br/>Multi-epoch scenes"]
    coronachrome["<b>coronachrome</b><br/>Lenslet-IFS dispersion<br/>Spectral extraction"]

    physopt -- PSF tables --> provider
    provider -- AbstractCoronagraph --> optix
    optix --> jaxedith
    optix --> corono
    optix --> coronachrome

Installation

pip install optixstuff

Metadata

Release files for optixstuff 6.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 optixstuff 6.0.0
File Size Uploaded Provenance Actions
optixstuff-6.0.0.tar.gz 62.1 kB With provenance Details for optixstuff-6.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 120.4 kB

Release files / optixstuff-6.0.0.tar.gz

Download URL optixstuff-6.0.0.tar.gz
Size 62.1 kB
Tags Source
SHA-256 checksum
How to use checksums
41d2ccecd50e0346c51064028f65e9954d8221560503f07cd1a0d0c4c3214a4f
BLAKE2b-256 checksum
How to use checksums
940a0b69294a648d30b21a4ae99f3dfc5d0329f937977877b49b0bcaf25f69cc
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 19, 2026.

Transparency log

Release files / optixstuff-6.0.0-py3-none-any.whl

Download URL optixstuff-6.0.0-py3-none-any.whl
Size 58.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
82943542d2bfe0d1d7862b4690ef0178c105b4f8388d31fc67f81ae54bb588a8
BLAKE2b-256 checksum
How to use checksums
fb4a9af91e6c9a9ed05b147dd15ea938fe90a0722ab2b77e319757d97fcb45b4
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 19, 2026.

Transparency log

Security for optixstuff 6.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 optixstuff-6.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 19, 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