optixstuff
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
(analytic aperture rates for exposure-time calculations) import the same
Instrument class and the same detector / throughput / primary types from
optixstuff; jaxEDITH reads coronagraph performance as PerformanceCurves
data, not from the coronagraph slot. Change a value here and every downstream
tool picks it up on the next import. The S/N and exposure-time reduction of a
Rates record, optixstuff.snr and optixstuff.exposure_time with
optixstuff.PostProcessing, lives here because both producers end at it; how an exposure time is
computed
follows both.
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
AbstractCoronagraphcontract; 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
Instrumentto produce images, dispersed IFS frames, or count rates. The calculator here only reduces rates they produce to S/N or time.
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 -
Instrument, 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.
Instrument 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 optixstuff.grids.Image and an explicit target PixelGrid.
Coordinates are (x, y), arrays are (..., y, x), and even-grid centres fall
between pixels. For example, model.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 model = coro.coronagraph_at(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). The image is always finite; the
flag is False only when lit flux lies outside the cells the model covers, and
that flux contributes zero. AbstractSceneCoronagraph.scene_grid is the grid on
which a scene (a disk, for example) is built so that it reaches every source the
model can render.
A product ends where its data end. resample and Image never reflect or
extrapolate: a target pixel that reaches past the source footprint reads zero.
optixstuff.grids.coverage(source_grid, target_grid, margin) returns the target
pixels wholly inside the footprint, and reconstruction_margin(name) supplies
the margin that also excludes pixels whose value depends on the zero beyond the
data. When the pixels are at least as large as the product's cells, resample
deposits instead of sampling and reaches further, so pass
reconstruction= and measure= in place of margin to get the margin of the
read that is performed. cubic_spline, the not-a-knot cubic spline, and
band_limited have no finite reach, so their margin marks a support boundary
rather than an exact bound. on_grid reads every density as the integral of
its declared reconstruction over each pixel, on axis-aligned grids only. Consumers mask with it, and exposure_time and snr report an
unsupported aperture through Rates.supported rather than a number. NaN is
reserved for terminal statistics such as snr and exposure_time.
A speckle field is a product too, and its grid usually covers less of the
detector than the static coronagraph products. Rates.supported is the strict
flag: True where every product the render reads covers the pixel, the speckle
field included. Rates.static_supported is the same flag without the speckle
field, so static_supported & ~supported marks the pixels that lack only the
drift model; None means the record does not distinguish the two, and a reader
falls back to supported. Terminal statistics read supported alone. A
renderer may offer, on request, to keep the static light where only the field
is missing; such a record carries both flags beside its values, and the excess
it holds there is the field's stored samples, zero-filled, under the field's
own reconstruction. For reconstructions of finite reach (nearest, linear and
cubic) that excess is exactly zero beyond the field's footprint grown by the
margin coverage uses; cubic_spline and band_limited fields carry no such
bound. A field whose array is wider than its data (values on a list of pixels,
zero elsewhere) says so through data_mask(), and
coverage(..., valid=mask, reconstruction=..., measure=...) then refuses every
pixel whose read reaches a cell without data. A mask is accepted only for
reconstructions of finite reach.
The coronagraph slot is the image capability only: a frame, a bandpass and the
image methods above. Summary curves are a separate characterization record,
PerformanceCurves: throughput, core area, stellar leakage fraction, leakage
density, raw contrast, iwa_lod and data_extent_lod. A provider that stores a
record hands it out as data, and record.evaluate("throughput", separation_lod)
is the one read. A record holds data from its first to its last sample and
while the aperture fits inside data_extent_lod; record.supported(separation_lod)
reports exactly that. Beyond the samples evaluate only continues the end
segments of its interpolant, so a consumer gates on supported and treats the
rest as unsupported, never as a measurement. HalfMaximum and Circular are the aperture rules a record is
built for; import them from optixstuff.
MultiBandCoronagraph selects the first declared bandpass covering the wavelength.
Coronagraph timestamps use time_d, days from the scene epoch; exposure
durations remain seconds. A speckle field runs on its own clock: its methods
take elapsed_s, seconds since its clock origin, and field.elapsed_s(time_d)
converts scene days.
Linear speckle fields
Subclass LinearSpeckleField and implement coefficients(*, elapsed_s); it
never reads the static host epoch_d. 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=..., elapsed_s=...) returns an Image on the field's own
grid, with Measure.integral(), stellar_flux_fraction and band_limited
metadata; the image is zero past its grid. 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=..., elapsed_s=...) 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_elapsed_s=...)
retains its midpoint time-average meaning. Enable JAX x64 for deep contrast.
With a nonzero epoch_d, elapsed_s(time_d) refuses a time that is not
binary64. Nonlinear replay models
continue to implement AbstractSpeckleField directly.
Detector chain
Readers supply Rates tagged "photon", in photons/s/nm at shared quadrature
nodes. The detector converts them to Rates tagged "electron", with spectral
QE and survival applied once, before integration. The observer owns the frame plan.
import jax
import jax.numpy as jnp
from optixstuff.spectral import Band, Quadrature
from optixstuff import Detector, Rates, 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 = Rates(quadrature, "photon", 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 / Instrument<br/>Throughput chains / QE / Noise rates"]
jaxedith["<b>jaxEDITH</b><br/>Analytic aperture rates"]
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 7.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| optixstuff-7.0.0.tar.gz | 138.9 kB | With provenance | Details for optixstuff-7.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| optixstuff-7.0.0-py3-none-any.whl | Python 3 | none | any | Details for optixstuff-7.0.0-py3-none-any.whl |
Total release size: 269.1 kB
Release files / optixstuff-7.0.0.tar.gz
| Download URL | optixstuff-7.0.0.tar.gz |
|---|---|
| Size | 138.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fde82f3878ab5d370d832c9646cc31590a6a4c8b1255ec7d0bfee7ae0b2b0583
|
|
BLAKE2b-256 checksum How to use checksums |
287a9388d796fe1e3b63f02bde572666f99cd054df6c7106782fbce6e40c125f
|
| 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 logRelease files / optixstuff-7.0.0-py3-none-any.whl
| Download URL | optixstuff-7.0.0-py3-none-any.whl |
|---|---|
| Size | 130.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cb7f8007495553231d24d5162bf3f55be0bb7041cb93b47a8edddf5752d94997
|
|
BLAKE2b-256 checksum How to use checksums |
1954dd01941d1ccb0bdbabe7f0222d8e46ce1556958ec470dbbbb84993393a34
|
| 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 logSecurity for optixstuff 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.
Attestation for optixstuff-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 logA 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.