optixstuff 5.0.0__tar.gz → 6.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {optixstuff-5.0.0 → optixstuff-6.0.0}/.pre-commit-config.yaml +2 -6
- {optixstuff-5.0.0 → optixstuff-6.0.0}/CHANGELOG.md +57 -0
- {optixstuff-5.0.0 → optixstuff-6.0.0}/PKG-INFO +99 -21
- optixstuff-6.0.0/README.md +164 -0
- {optixstuff-5.0.0 → optixstuff-6.0.0}/pyproject.toml +7 -4
- optixstuff-6.0.0/src/optixstuff/__init__.py +90 -0
- {optixstuff-5.0.0 → optixstuff-6.0.0}/src/optixstuff/_repr.py +2 -1
- {optixstuff-5.0.0 → optixstuff-6.0.0}/src/optixstuff/_version.py +2 -2
- optixstuff-6.0.0/src/optixstuff/aperture_binding.py +479 -0
- optixstuff-6.0.0/src/optixstuff/apertures.py +77 -0
- optixstuff-6.0.0/src/optixstuff/coronagraph.py +661 -0
- optixstuff-6.0.0/src/optixstuff/detector.py +336 -0
- {optixstuff-5.0.0 → optixstuff-6.0.0}/src/optixstuff/disperser.py +15 -6
- optixstuff-6.0.0/src/optixstuff/exposure.py +76 -0
- {optixstuff-5.0.0 → optixstuff-6.0.0}/src/optixstuff/optical_elements.py +22 -34
- {optixstuff-5.0.0 → optixstuff-6.0.0}/src/optixstuff/optical_path.py +74 -37
- optixstuff-6.0.0/src/optixstuff/performance.py +1507 -0
- optixstuff-6.0.0/src/optixstuff/primary.py +173 -0
- optixstuff-6.0.0/src/optixstuff/rates.py +109 -0
- optixstuff-6.0.0/src/optixstuff/speckle.py +256 -0
- optixstuff-5.0.0/README.md +0 -86
- optixstuff-5.0.0/src/optixstuff/__init__.py +0 -56
- optixstuff-5.0.0/src/optixstuff/coronagraph.py +0 -775
- optixstuff-5.0.0/src/optixstuff/detector.py +0 -510
- optixstuff-5.0.0/src/optixstuff/exposure.py +0 -36
- optixstuff-5.0.0/src/optixstuff/primary.py +0 -251
- optixstuff-5.0.0/src/optixstuff/speckle.py +0 -145
- optixstuff-5.0.0/src/optixstuff/yippy_coronagraph.py +0 -313
- optixstuff-5.0.0/tools/check_internal_refs.py +0 -80
- {optixstuff-5.0.0 → optixstuff-6.0.0}/.codespellrc +0 -0
- {optixstuff-5.0.0 → optixstuff-6.0.0}/.editorconfig +0 -0
- {optixstuff-5.0.0 → optixstuff-6.0.0}/.gitattributes +0 -0
- {optixstuff-5.0.0 → optixstuff-6.0.0}/.gitignore +0 -0
- {optixstuff-5.0.0 → optixstuff-6.0.0}/.readthedocs.yaml +0 -0
- {optixstuff-5.0.0 → optixstuff-6.0.0}/.zenodo.json +0 -0
- {optixstuff-5.0.0 → optixstuff-6.0.0}/CITATION.cff +0 -0
- {optixstuff-5.0.0 → optixstuff-6.0.0}/LICENSE +0 -0
- {optixstuff-5.0.0 → optixstuff-6.0.0}/SECURITY.md +0 -0
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
repos:
|
|
2
|
-
- repo:
|
|
2
|
+
- repo: https://github.com/CoreySpohn/hwoutils
|
|
3
|
+
rev: 7ea5d77
|
|
3
4
|
hooks:
|
|
4
5
|
- id: no-internal-refs
|
|
5
|
-
name: no internal research references
|
|
6
|
-
entry: python3 tools/check_internal_refs.py
|
|
7
|
-
language: system
|
|
8
|
-
types: [text]
|
|
9
|
-
exclude: ^(CHANGELOG\.md|tools/check_internal_refs\.py)$
|
|
10
6
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
11
7
|
rev: "v6.0.0"
|
|
12
8
|
hooks:
|
|
@@ -1,5 +1,62 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [6.0.0](https://github.com/CoreySpohn/optixstuff/compare/v5.0.0...v6.0.0) (2026-11-19)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* reduce the scalar sky and stellar leakage to annular means of the aperture integral
|
|
9
|
+
* mark transmission intensive and integrate native PSFs by measure
|
|
10
|
+
* declare spectral breaks on hardware models and bind photon and electron rates to their quadrature
|
|
11
|
+
* split the coronagraph contract into performance, imaging and scene capabilities with named sky responses
|
|
12
|
+
* add FocalResponse as the one calibrated complex speckle response
|
|
13
|
+
* add SampledProfile for standalone sampled curves and drop the zero-filled performance record
|
|
14
|
+
* align frame plans to the rates' band axis and refuse ambiguous shapes
|
|
15
|
+
* make Matched an inverse-variance aperture evaluated from scene rates at the exposure query
|
|
16
|
+
* carry separate mean and variance moments for weighted apertures and integrate hard-edged rules over one region
|
|
17
|
+
* bind fixed-angular apertures to quadrature nodes with prepare_aperture and the prepared and stellar_frame contract methods
|
|
18
|
+
* own aperture rules and performance records, add bandpass, and drop the yippy backend
|
|
19
|
+
* optical elements hold a hwoutils Transmission; delete SpectralThroughput
|
|
20
|
+
* contract maps on AbstractCoronagraph; native grid=None reads; drop noise floors and off-contract methods
|
|
21
|
+
* delete ExposureConfig, make dispersion_px public and read geometric centres from the grid
|
|
22
|
+
* detector pixel scale is a validated static host float so readers jit with the path as an argument
|
|
23
|
+
* one linear speckle field with the stable cross-term law, node-wavelength scaling and a day clock
|
|
24
|
+
* put coronagraph products on shared grids with primary diameters, a centred fold and one performance record per rule
|
|
25
|
+
* one detector contract with photon rates, a frame plan and a draw that matches its variance
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
* add FocalResponse as the one calibrated complex speckle response ([b20c708](https://github.com/CoreySpohn/optixstuff/commit/b20c708b655b94cd06ea8fc3acb26326952e7314))
|
|
30
|
+
* add SampledProfile for standalone sampled curves and drop the zero-filled performance record ([650f1b7](https://github.com/CoreySpohn/optixstuff/commit/650f1b787c8f97c1db1148f99fd167350fda9b06))
|
|
31
|
+
* bind fixed-angular apertures to quadrature nodes with prepare_aperture and the prepared and stellar_frame contract methods ([027cd1b](https://github.com/CoreySpohn/optixstuff/commit/027cd1b46b753ba3e80e2ec7a9aaf3ad3d2b569c))
|
|
32
|
+
* contract maps on AbstractCoronagraph; native grid=None reads; drop noise floors and off-contract methods ([816ba79](https://github.com/CoreySpohn/optixstuff/commit/816ba7901e62ba9adf489a0a7132679edaaa9778))
|
|
33
|
+
* **coronagraph:** accept a stellar diameter in leakage queries and add leakage_density_map ([6132543](https://github.com/CoreySpohn/optixstuff/commit/6132543bea44556aefda1c79b341a2923b2816fb))
|
|
34
|
+
* declare spectral breaks on hardware models and bind photon and electron rates to their quadrature ([2f34050](https://github.com/CoreySpohn/optixstuff/commit/2f340505cfb52eb140d955adf96a6fc22c325eab))
|
|
35
|
+
* detectors report their QE breakpoints for band quadrature ([ada25d1](https://github.com/CoreySpohn/optixstuff/commit/ada25d19f33419f0e63511fae7e028a614fa3eec))
|
|
36
|
+
* make Matched an inverse-variance aperture evaluated from scene rates at the exposure query ([c2bfa51](https://github.com/CoreySpohn/optixstuff/commit/c2bfa515bb34416c617eae2f530f1d197a830a10))
|
|
37
|
+
* one detector contract with photon rates, a frame plan and a draw that matches its variance ([e463415](https://github.com/CoreySpohn/optixstuff/commit/e463415c4bac98d63ca61a67c383339efd4c4751))
|
|
38
|
+
* one linear speckle field with the stable cross-term law, node-wavelength scaling and a day clock ([c2cf7cb](https://github.com/CoreySpohn/optixstuff/commit/c2cf7cb8a670d0cfcda3bec15812753338707a9d))
|
|
39
|
+
* own aperture rules and performance records, add bandpass, and drop the yippy backend ([15d38cb](https://github.com/CoreySpohn/optixstuff/commit/15d38cb23450bcd0b0dda106fa9d75d0e616f488))
|
|
40
|
+
* put coronagraph products on shared grids with primary diameters, a centred fold and one performance record per rule ([03c46a6](https://github.com/CoreySpohn/optixstuff/commit/03c46a6c991cb9b82483b161bb7450ce45c66b8e))
|
|
41
|
+
* split the coronagraph contract into performance, imaging and scene capabilities with named sky responses ([f36da34](https://github.com/CoreySpohn/optixstuff/commit/f36da343288629265b8017b56bea8e92889ab50a))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### Bug Fixes
|
|
45
|
+
|
|
46
|
+
* align frame plans to the rates' band axis and refuse ambiguous shapes ([0a8ad40](https://github.com/CoreySpohn/optixstuff/commit/0a8ad40150bb2c5ff863ebe913928671d964952b))
|
|
47
|
+
* carry separate mean and variance moments for weighted apertures and integrate hard-edged rules over one region ([4476403](https://github.com/CoreySpohn/optixstuff/commit/4476403e0d2f70cec8eaecc16425cf638e7178c5))
|
|
48
|
+
* **coronagraph:** resample native products on their own grid instead of returning them verbatim ([fb80cf4](https://github.com/CoreySpohn/optixstuff/commit/fb80cf44bc53b85c7f6534f6f07966b777fa4e75))
|
|
49
|
+
* detector pixel scale is a validated static host float so readers jit with the path as an argument ([5f94077](https://github.com/CoreySpohn/optixstuff/commit/5f940779ccdf21466dc2145e5e441572bb52ba4f))
|
|
50
|
+
* **optical-path:** reject a primary whose diameter disagrees with the coronagraph frame ([5ffa85c](https://github.com/CoreySpohn/optixstuff/commit/5ffa85cdb4a38a931832241074106d969edaf547))
|
|
51
|
+
* reduce the scalar sky and stellar leakage to annular means of the aperture integral ([5895336](https://github.com/CoreySpohn/optixstuff/commit/589533660dc799e70e33a78ba2af85af616e2b8a))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### Code Refactoring
|
|
55
|
+
|
|
56
|
+
* delete ExposureConfig, make dispersion_px public and read geometric centres from the grid ([ea44609](https://github.com/CoreySpohn/optixstuff/commit/ea44609c8be960d070b92807553a06e591948aff))
|
|
57
|
+
* mark transmission intensive and integrate native PSFs by measure ([ef602df](https://github.com/CoreySpohn/optixstuff/commit/ef602df71fe4bd8b57ba3e580d2f0761ddd3b0f3))
|
|
58
|
+
* optical elements hold a hwoutils Transmission; delete SpectralThroughput ([bb00975](https://github.com/CoreySpohn/optixstuff/commit/bb00975cd9beab205e06eda0730765f8a5ec32ec))
|
|
59
|
+
|
|
3
60
|
## [5.0.0](https://github.com/CoreySpohn/optixstuff/compare/v4.1.0...v5.0.0) (2026-11-16)
|
|
4
61
|
|
|
5
62
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: optixstuff
|
|
3
|
-
Version:
|
|
3
|
+
Version: 6.0.0
|
|
4
4
|
Summary: Hardware abstractions for the HWO direct imaging simulation suite
|
|
5
5
|
Project-URL: Homepage, https://github.com/CoreySpohn/optixstuff
|
|
6
6
|
Project-URL: Issues, https://github.com/CoreySpohn/optixstuff/issues
|
|
@@ -33,14 +33,14 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
33
33
|
Classifier: Programming Language :: Python :: 3
|
|
34
34
|
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
35
35
|
Requires-Python: >=3.12
|
|
36
|
-
Requires-Dist: astropy>=6.1
|
|
37
36
|
Requires-Dist: equinox>=0.13.2
|
|
38
|
-
Requires-Dist: hwoutils>=
|
|
37
|
+
Requires-Dist: hwoutils>=2.0.0
|
|
39
38
|
Requires-Dist: interpax>=0.3.12
|
|
40
39
|
Requires-Dist: jax>=0.8.1
|
|
41
40
|
Requires-Dist: jaxlib>=0.8.1
|
|
42
41
|
Requires-Dist: jaxtyping>=0.3.3
|
|
43
|
-
Requires-Dist:
|
|
42
|
+
Requires-Dist: numpy>=2.0
|
|
43
|
+
Requires-Dist: scipy>=1.13
|
|
44
44
|
Provides-Extra: dev
|
|
45
45
|
Requires-Dist: pre-commit>=3.5; extra == 'dev'
|
|
46
46
|
Provides-Extra: docs
|
|
@@ -74,7 +74,7 @@ Description-Content-Type: text/markdown
|
|
|
74
74
|
<a href="https://doi.org/10.5281/zenodo.20819379"><img src="https://img.shields.io/badge/DOI-10.5281%2Fzenodo.20819379-blue?style=flat-square" alt="DOI"/></a>
|
|
75
75
|
</p>
|
|
76
76
|
|
|
77
|
-
Shared hardware objects
|
|
77
|
+
Shared hardware objects - with standard values - for the HWO direct-imaging
|
|
78
78
|
simulation suite.
|
|
79
79
|
|
|
80
80
|
## What optixstuff is
|
|
@@ -96,8 +96,8 @@ Change a value here and every downstream tool picks it up on the next import.
|
|
|
96
96
|
|
|
97
97
|
- **Not a wavefront tool.** Diffraction, E-field propagation, and PSFs-from-first-principles
|
|
98
98
|
belong to [dLux](https://github.com/LouisDesdoigts/dLux) and [HCIPy](https://github.com/ehpor/hcipy).
|
|
99
|
-
- **Not a PSF interpolator.**
|
|
100
|
-
|
|
99
|
+
- **Not a PSF interpolator.** Image providers implement the shared
|
|
100
|
+
`AbstractCoronagraph` contract; optixstuff owns the contract and scalar models.
|
|
101
101
|
- **Not a scene model.** Stars, planets, disks, and zodi live in
|
|
102
102
|
[skyscapes](https://github.com/CoreySpohn/skyscapes).
|
|
103
103
|
- **Not a simulator.** Downstream tools (coronagraphoto, coronachrome, jaxEDITH)
|
|
@@ -108,33 +108,115 @@ Change a value here and every downstream tool picks it up on the next import.
|
|
|
108
108
|
Built on [JAX](https://github.com/google/jax) and
|
|
109
109
|
[Equinox](https://github.com/patrick-kidger/equinox), `optixstuff` provides:
|
|
110
110
|
|
|
111
|
-
- **Abstract interfaces**
|
|
111
|
+
- **Abstract interfaces** - `AbstractPrimary`, `AbstractOpticalElement`,
|
|
112
112
|
`AbstractCoronagraph`, `AbstractDetector`, `AbstractDisperser`
|
|
113
|
-
- **Concrete implementations**
|
|
113
|
+
- **Concrete implementations** - `SimplePrimary`, `SegmentedPrimary` (carries
|
|
114
114
|
hex segment geometry for a diffraction backend), `ConstantThroughput`,
|
|
115
115
|
`IdealDetector`, `Detector` (with optional wavelength-dependent QE),
|
|
116
116
|
`LensletDisperser`
|
|
117
|
-
- **Container**
|
|
117
|
+
- **Container** - `OpticalPath`, a composable hardware configuration passed to all
|
|
118
118
|
simulators
|
|
119
119
|
|
|
120
|
-
|
|
121
|
-
**time**
|
|
120
|
+
Optical elements and coronagraphs accept fidelity axes - **wavelength**, **position**, and
|
|
121
|
+
**time** - with defaults so that simple implementations can ignore unused axes while
|
|
122
122
|
future high-fidelity models (wavelength-dependent coatings, position-dependent vignetting,
|
|
123
123
|
time-dependent detector degradation) can use them without breaking the interface.
|
|
124
124
|
|
|
125
|
+
### Primary geometry and coronagraph grids
|
|
126
|
+
|
|
127
|
+
Primaries expose `diameter("circumscribed")`, `diameter("inscribed")`, and
|
|
128
|
+
`collecting_area_m2`. Build a lambda/D frame with `primary.frame(500.0)`.
|
|
129
|
+
`SimplePrimary` takes both diameters and collecting area as keyword arguments;
|
|
130
|
+
`SegmentedPrimary` derives them from segment size, gap, and ring count.
|
|
131
|
+
`OpticalPath` raises `ValueError` when its primary's diameter differs from the
|
|
132
|
+
diameter of the coronagraph's lambda/D frame, so the tables and the collecting
|
|
133
|
+
area describe one telescope. A yippy `Coronagraph` carries the matching
|
|
134
|
+
`primary`.
|
|
135
|
+
|
|
136
|
+
Coronagraph images use `hwoutils.grids.Image` and an explicit target `PixelGrid`.
|
|
137
|
+
Coordinates are `(x, y)`, arrays are `(..., y, x)`, and even-grid centres fall
|
|
138
|
+
between pixels. For example, `band.off_axis_psf(500.0, 3.0, target)` returns
|
|
139
|
+
per-pixel fractions of unocculted source flux. Use `.data` to obtain its array.
|
|
140
|
+
Select the imaging model with `band = coro.band(500.0)`. Its
|
|
141
|
+
`at_wavelength(500.0)` gives the source, stellar and uniform-sky grids.
|
|
142
|
+
Scene models return an image and a validity flag from
|
|
143
|
+
`render_scene(scene_image, 500.0, grid=target)`.
|
|
144
|
+
|
|
145
|
+
`coro.curves(Circular(0.7))` is the single performance record for that aperture.
|
|
146
|
+
Import `Circular` from `optixstuff`; prepare every required rule before JIT
|
|
147
|
+
when constructing an image provider.
|
|
148
|
+
Records contain throughput, core area, stellar leakage fraction, leakage density,
|
|
149
|
+
raw contrast, `iwa_lod`, and `data_extent_lod`. A known design limit is separately
|
|
150
|
+
named `outer_working_angle_lod`. `ScalarCoronagraph` stores calibrated constants
|
|
151
|
+
for one declared aperture.
|
|
152
|
+
`MultiBandCoronagraph` selects the first declared bandpass covering the wavelength.
|
|
153
|
+
Coronagraph and speckle timestamps use `time_d`, days from the scene epoch;
|
|
154
|
+
exposure durations remain seconds.
|
|
155
|
+
|
|
156
|
+
### Linear speckle fields
|
|
157
|
+
|
|
158
|
+
Subclass `LinearSpeckleField` and implement `coefficients(time_d)`, subtracting
|
|
159
|
+
its static host `epoch_d` internally. Construct a `FocalResponse` with the
|
|
160
|
+
complex nominal amplitude density `e_nom`, sensitivity density `G`, native
|
|
161
|
+
`lod` grid, unocculted input energy and reference wavelength. The shared law
|
|
162
|
+
uses `response.per_pixel()` and returns the excess
|
|
163
|
+
`[2 Re(conj(e_nom) G eps) + |G eps|^2] / input_energy`, with `G` scaled by
|
|
164
|
+
`reference_wavelength_nm / wavelength_nm`.
|
|
165
|
+
|
|
166
|
+
`realize(wavelength_nm=..., time_d=...)` returns an `Image` on the field's own
|
|
167
|
+
grid, with `Measure.integral()`, `stellar_flux_fraction`, `band_limited`, and `reflect`
|
|
168
|
+
metadata. Wavelength arrays, including quadrature nodes `(W, Q)`, become leading
|
|
169
|
+
axes. Each native lambda/D coordinate uses the node wavelength: convert with
|
|
170
|
+
`image.grid.to_arcsec(node_nm)` before resampling that node onto a detector.
|
|
171
|
+
|
|
172
|
+
`broadened(quadrature=..., time_d=...)` averages realized nodes at fixed native
|
|
173
|
+
lambda/D coordinates, normalizing the nm weights to sum to one per band.
|
|
174
|
+
Detector-band images instead require resampling and spectral weighting at each
|
|
175
|
+
node before integration. `realize_average(..., exposure_s=..., start_time_d=...)`
|
|
176
|
+
retains its midpoint time-average meaning. Enable JAX x64 for deep contrast and
|
|
177
|
+
for adding small offsets to absolute day timestamps. Nonlinear replay models
|
|
178
|
+
continue to implement `AbstractSpeckleField` directly.
|
|
179
|
+
|
|
180
|
+
### Detector chain
|
|
181
|
+
|
|
182
|
+
Readers supply `PhotonRates` in photons/s/nm at shared quadrature nodes.
|
|
183
|
+
The detector converts them to `ElectronRates` with spectral QE and survival
|
|
184
|
+
applied once, before integration. The observer owns the frame plan.
|
|
185
|
+
|
|
186
|
+
```python
|
|
187
|
+
import jax
|
|
188
|
+
import jax.numpy as jnp
|
|
189
|
+
from hwoutils.spectral import Band, Quadrature
|
|
190
|
+
from optixstuff import Detector, PhotonRates, frames_for_time
|
|
191
|
+
|
|
192
|
+
detector = Detector(pixel_scale_arcsec=0.01, shape=(1, 1), qe=0.9)
|
|
193
|
+
quadrature = Quadrature.build([Band(500.0, 600.0)], detector, order=3)
|
|
194
|
+
rates = PhotonRates(quadrature, planet=jnp.ones((1, 3)))
|
|
195
|
+
electrons = detector.electrons(rates)
|
|
196
|
+
plan = frames_for_time(time_s=600.0, frame_time_s=300.0)
|
|
197
|
+
mean, variance = detector.mean_and_variance(electrons, plan)
|
|
198
|
+
counts = detector.draw(jax.random.key(0), electrons, plan)
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
The six source fields retain their names throughout the chain. Image readers
|
|
202
|
+
use `(W, Q, ny, nx)` integrands; aperture readers use `(W, Q)`. The detector
|
|
203
|
+
returns `(W, *spatial)` electrons/s and count moments. See the
|
|
204
|
+
[detector contract](https://optixstuff.readthedocs.io/en/latest/explanation/detector_models.html)
|
|
205
|
+
for noise parameters, gain statistics, and readout overlap.
|
|
206
|
+
|
|
125
207
|
### Ecosystem position
|
|
126
208
|
|
|
127
209
|
```mermaid
|
|
128
210
|
flowchart TB
|
|
129
|
-
physopt["<b>Physical optics</b><br/>dLux
|
|
130
|
-
|
|
131
|
-
optix["<b>optixstuff</b><br/>Telescope
|
|
211
|
+
physopt["<b>Physical optics</b><br/>dLux / HCIPy / PROPER<br/>E-fields -> PSFs"]
|
|
212
|
+
provider["<b>Image provider</b><br/>PSF interpolation"]
|
|
213
|
+
optix["<b>optixstuff</b><br/>Telescope / Coronagraph / Detector / OpticalPath<br/>Throughput chains / QE / Noise rates"]
|
|
132
214
|
jaxedith["<b>jaxEDITH</b><br/>Scalar count rates<br/>Exposure-time calculations"]
|
|
133
215
|
corono["<b>coronagraphoto</b><br/>2D image simulation<br/>Multi-epoch scenes"]
|
|
134
216
|
coronachrome["<b>coronachrome</b><br/>Lenslet-IFS dispersion<br/>Spectral extraction"]
|
|
135
217
|
|
|
136
|
-
physopt --
|
|
137
|
-
|
|
218
|
+
physopt -- PSF tables --> provider
|
|
219
|
+
provider -- AbstractCoronagraph --> optix
|
|
138
220
|
optix --> jaxedith
|
|
139
221
|
optix --> corono
|
|
140
222
|
optix --> coronachrome
|
|
@@ -145,7 +227,3 @@ flowchart TB
|
|
|
145
227
|
```bash
|
|
146
228
|
pip install optixstuff
|
|
147
229
|
```
|
|
148
|
-
|
|
149
|
-
## Status
|
|
150
|
-
|
|
151
|
-
This package is in early development (pre-v0.1.0).
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# optixstuff
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://pypi.org/project/optixstuff/"><img src="https://img.shields.io/pypi/v/optixstuff.svg?style=flat-square&logo=pypi" alt="PyPI"/></a>
|
|
5
|
+
<a href="https://optixstuff.readthedocs.io"><img src="https://readthedocs.org/projects/optixstuff/badge/?version=latest&style=flat-square" alt="Documentation Status"/></a>
|
|
6
|
+
<a href="https://github.com/CoreySpohn/optixstuff/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/CoreySpohn/optixstuff/ci.yml?branch=main&style=flat-square&logo=github&label=tests" alt="Tests"/></a>
|
|
7
|
+
<a href="https://github.com/CoreySpohn/optixstuff/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square" alt="License"/></a>
|
|
8
|
+
<a href="https://github.com/CoreySpohn/optixstuff/blob/main/pyproject.toml"><img src="https://img.shields.io/badge/python-3.12%2B-blue.svg?style=flat-square&logo=python" alt="Python 3.12+"/></a>
|
|
9
|
+
<a href="https://doi.org/10.5281/zenodo.20819379"><img src="https://img.shields.io/badge/DOI-10.5281%2Fzenodo.20819379-blue?style=flat-square" alt="DOI"/></a>
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
Shared hardware objects - with standard values - for the HWO direct-imaging
|
|
13
|
+
simulation suite.
|
|
14
|
+
|
|
15
|
+
## What optixstuff is
|
|
16
|
+
|
|
17
|
+
`optixstuff` is a **thin shared dependency** that defines the observatory's
|
|
18
|
+
hardware as composable JAX modules: primary aperture, throughput-affecting
|
|
19
|
+
elements, coronagraph backend, detector. Its job is to be the single source of
|
|
20
|
+
truth for the hardware configuration that downstream tools consume.
|
|
21
|
+
|
|
22
|
+
[coronagraphoto](https://github.com/CoreySpohn/coronagraphoto)
|
|
23
|
+
(2D image simulation), [coronachrome](https://github.com/CoreySpohn/coronachrome)
|
|
24
|
+
(lenslet-IFS dispersion + spectral extraction), and
|
|
25
|
+
[jaxEDITH](https://github.com/CoreySpohn/jaxedith)
|
|
26
|
+
(exposure-time and yield calculations) import the same `OpticalPath` class and
|
|
27
|
+
the same detector / throughput / primary / disperser types from optixstuff.
|
|
28
|
+
Change a value here and every downstream tool picks it up on the next import.
|
|
29
|
+
|
|
30
|
+
## What optixstuff is *not*
|
|
31
|
+
|
|
32
|
+
- **Not a wavefront tool.** Diffraction, E-field propagation, and PSFs-from-first-principles
|
|
33
|
+
belong to [dLux](https://github.com/LouisDesdoigts/dLux) and [HCIPy](https://github.com/ehpor/hcipy).
|
|
34
|
+
- **Not a PSF interpolator.** Image providers implement the shared
|
|
35
|
+
`AbstractCoronagraph` contract; optixstuff owns the contract and scalar models.
|
|
36
|
+
- **Not a scene model.** Stars, planets, disks, and zodi live in
|
|
37
|
+
[skyscapes](https://github.com/CoreySpohn/skyscapes).
|
|
38
|
+
- **Not a simulator.** Downstream tools (coronagraphoto, coronachrome, jaxEDITH)
|
|
39
|
+
consume an `OpticalPath` to produce images, dispersed IFS frames, or count rates.
|
|
40
|
+
|
|
41
|
+
## Architecture
|
|
42
|
+
|
|
43
|
+
Built on [JAX](https://github.com/google/jax) and
|
|
44
|
+
[Equinox](https://github.com/patrick-kidger/equinox), `optixstuff` provides:
|
|
45
|
+
|
|
46
|
+
- **Abstract interfaces** - `AbstractPrimary`, `AbstractOpticalElement`,
|
|
47
|
+
`AbstractCoronagraph`, `AbstractDetector`, `AbstractDisperser`
|
|
48
|
+
- **Concrete implementations** - `SimplePrimary`, `SegmentedPrimary` (carries
|
|
49
|
+
hex segment geometry for a diffraction backend), `ConstantThroughput`,
|
|
50
|
+
`IdealDetector`, `Detector` (with optional wavelength-dependent QE),
|
|
51
|
+
`LensletDisperser`
|
|
52
|
+
- **Container** - `OpticalPath`, a composable hardware configuration passed to all
|
|
53
|
+
simulators
|
|
54
|
+
|
|
55
|
+
Optical elements and coronagraphs accept fidelity axes - **wavelength**, **position**, and
|
|
56
|
+
**time** - with defaults so that simple implementations can ignore unused axes while
|
|
57
|
+
future high-fidelity models (wavelength-dependent coatings, position-dependent vignetting,
|
|
58
|
+
time-dependent detector degradation) can use them without breaking the interface.
|
|
59
|
+
|
|
60
|
+
### Primary geometry and coronagraph grids
|
|
61
|
+
|
|
62
|
+
Primaries expose `diameter("circumscribed")`, `diameter("inscribed")`, and
|
|
63
|
+
`collecting_area_m2`. Build a lambda/D frame with `primary.frame(500.0)`.
|
|
64
|
+
`SimplePrimary` takes both diameters and collecting area as keyword arguments;
|
|
65
|
+
`SegmentedPrimary` derives them from segment size, gap, and ring count.
|
|
66
|
+
`OpticalPath` raises `ValueError` when its primary's diameter differs from the
|
|
67
|
+
diameter of the coronagraph's lambda/D frame, so the tables and the collecting
|
|
68
|
+
area describe one telescope. A yippy `Coronagraph` carries the matching
|
|
69
|
+
`primary`.
|
|
70
|
+
|
|
71
|
+
Coronagraph images use `hwoutils.grids.Image` and an explicit target `PixelGrid`.
|
|
72
|
+
Coordinates are `(x, y)`, arrays are `(..., y, x)`, and even-grid centres fall
|
|
73
|
+
between pixels. For example, `band.off_axis_psf(500.0, 3.0, target)` returns
|
|
74
|
+
per-pixel fractions of unocculted source flux. Use `.data` to obtain its array.
|
|
75
|
+
Select the imaging model with `band = coro.band(500.0)`. Its
|
|
76
|
+
`at_wavelength(500.0)` gives the source, stellar and uniform-sky grids.
|
|
77
|
+
Scene models return an image and a validity flag from
|
|
78
|
+
`render_scene(scene_image, 500.0, grid=target)`.
|
|
79
|
+
|
|
80
|
+
`coro.curves(Circular(0.7))` is the single performance record for that aperture.
|
|
81
|
+
Import `Circular` from `optixstuff`; prepare every required rule before JIT
|
|
82
|
+
when constructing an image provider.
|
|
83
|
+
Records contain throughput, core area, stellar leakage fraction, leakage density,
|
|
84
|
+
raw contrast, `iwa_lod`, and `data_extent_lod`. A known design limit is separately
|
|
85
|
+
named `outer_working_angle_lod`. `ScalarCoronagraph` stores calibrated constants
|
|
86
|
+
for one declared aperture.
|
|
87
|
+
`MultiBandCoronagraph` selects the first declared bandpass covering the wavelength.
|
|
88
|
+
Coronagraph and speckle timestamps use `time_d`, days from the scene epoch;
|
|
89
|
+
exposure durations remain seconds.
|
|
90
|
+
|
|
91
|
+
### Linear speckle fields
|
|
92
|
+
|
|
93
|
+
Subclass `LinearSpeckleField` and implement `coefficients(time_d)`, subtracting
|
|
94
|
+
its static host `epoch_d` internally. Construct a `FocalResponse` with the
|
|
95
|
+
complex nominal amplitude density `e_nom`, sensitivity density `G`, native
|
|
96
|
+
`lod` grid, unocculted input energy and reference wavelength. The shared law
|
|
97
|
+
uses `response.per_pixel()` and returns the excess
|
|
98
|
+
`[2 Re(conj(e_nom) G eps) + |G eps|^2] / input_energy`, with `G` scaled by
|
|
99
|
+
`reference_wavelength_nm / wavelength_nm`.
|
|
100
|
+
|
|
101
|
+
`realize(wavelength_nm=..., time_d=...)` returns an `Image` on the field's own
|
|
102
|
+
grid, with `Measure.integral()`, `stellar_flux_fraction`, `band_limited`, and `reflect`
|
|
103
|
+
metadata. Wavelength arrays, including quadrature nodes `(W, Q)`, become leading
|
|
104
|
+
axes. Each native lambda/D coordinate uses the node wavelength: convert with
|
|
105
|
+
`image.grid.to_arcsec(node_nm)` before resampling that node onto a detector.
|
|
106
|
+
|
|
107
|
+
`broadened(quadrature=..., time_d=...)` averages realized nodes at fixed native
|
|
108
|
+
lambda/D coordinates, normalizing the nm weights to sum to one per band.
|
|
109
|
+
Detector-band images instead require resampling and spectral weighting at each
|
|
110
|
+
node before integration. `realize_average(..., exposure_s=..., start_time_d=...)`
|
|
111
|
+
retains its midpoint time-average meaning. Enable JAX x64 for deep contrast and
|
|
112
|
+
for adding small offsets to absolute day timestamps. Nonlinear replay models
|
|
113
|
+
continue to implement `AbstractSpeckleField` directly.
|
|
114
|
+
|
|
115
|
+
### Detector chain
|
|
116
|
+
|
|
117
|
+
Readers supply `PhotonRates` in photons/s/nm at shared quadrature nodes.
|
|
118
|
+
The detector converts them to `ElectronRates` with spectral QE and survival
|
|
119
|
+
applied once, before integration. The observer owns the frame plan.
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
import jax
|
|
123
|
+
import jax.numpy as jnp
|
|
124
|
+
from hwoutils.spectral import Band, Quadrature
|
|
125
|
+
from optixstuff import Detector, PhotonRates, frames_for_time
|
|
126
|
+
|
|
127
|
+
detector = Detector(pixel_scale_arcsec=0.01, shape=(1, 1), qe=0.9)
|
|
128
|
+
quadrature = Quadrature.build([Band(500.0, 600.0)], detector, order=3)
|
|
129
|
+
rates = PhotonRates(quadrature, planet=jnp.ones((1, 3)))
|
|
130
|
+
electrons = detector.electrons(rates)
|
|
131
|
+
plan = frames_for_time(time_s=600.0, frame_time_s=300.0)
|
|
132
|
+
mean, variance = detector.mean_and_variance(electrons, plan)
|
|
133
|
+
counts = detector.draw(jax.random.key(0), electrons, plan)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
The six source fields retain their names throughout the chain. Image readers
|
|
137
|
+
use `(W, Q, ny, nx)` integrands; aperture readers use `(W, Q)`. The detector
|
|
138
|
+
returns `(W, *spatial)` electrons/s and count moments. See the
|
|
139
|
+
[detector contract](https://optixstuff.readthedocs.io/en/latest/explanation/detector_models.html)
|
|
140
|
+
for noise parameters, gain statistics, and readout overlap.
|
|
141
|
+
|
|
142
|
+
### Ecosystem position
|
|
143
|
+
|
|
144
|
+
```mermaid
|
|
145
|
+
flowchart TB
|
|
146
|
+
physopt["<b>Physical optics</b><br/>dLux / HCIPy / PROPER<br/>E-fields -> PSFs"]
|
|
147
|
+
provider["<b>Image provider</b><br/>PSF interpolation"]
|
|
148
|
+
optix["<b>optixstuff</b><br/>Telescope / Coronagraph / Detector / OpticalPath<br/>Throughput chains / QE / Noise rates"]
|
|
149
|
+
jaxedith["<b>jaxEDITH</b><br/>Scalar count rates<br/>Exposure-time calculations"]
|
|
150
|
+
corono["<b>coronagraphoto</b><br/>2D image simulation<br/>Multi-epoch scenes"]
|
|
151
|
+
coronachrome["<b>coronachrome</b><br/>Lenslet-IFS dispersion<br/>Spectral extraction"]
|
|
152
|
+
|
|
153
|
+
physopt -- PSF tables --> provider
|
|
154
|
+
provider -- AbstractCoronagraph --> optix
|
|
155
|
+
optix --> jaxedith
|
|
156
|
+
optix --> corono
|
|
157
|
+
optix --> coronachrome
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Installation
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
pip install optixstuff
|
|
164
|
+
```
|
|
@@ -17,15 +17,14 @@ classifiers = [
|
|
|
17
17
|
"Topic :: Scientific/Engineering :: Astronomy",
|
|
18
18
|
]
|
|
19
19
|
dependencies = [
|
|
20
|
-
# SimplePrimary.from_yip reads the response header; yippy's own floor.
|
|
21
|
-
"astropy>=6.1",
|
|
22
20
|
"equinox>=0.13.2",
|
|
23
|
-
"
|
|
21
|
+
"numpy>=2.0",
|
|
22
|
+
"scipy>=1.13",
|
|
23
|
+
"hwoutils>=2.0.0",
|
|
24
24
|
"interpax>=0.3.12",
|
|
25
25
|
"jax>=0.8.1",
|
|
26
26
|
"jaxlib>=0.8.1",
|
|
27
27
|
"jaxtyping>=0.3.3",
|
|
28
|
-
"yippy>=2.10.6",
|
|
29
28
|
]
|
|
30
29
|
|
|
31
30
|
[project.optional-dependencies]
|
|
@@ -110,3 +109,7 @@ python-version = "3.11"
|
|
|
110
109
|
|
|
111
110
|
[tool.ty.src]
|
|
112
111
|
include = ["src/optixstuff"]
|
|
112
|
+
|
|
113
|
+
[tool.codespell]
|
|
114
|
+
# "lod" is the lambda/D grid unit name; "unser" is a cited author.
|
|
115
|
+
ignore-words-list = "lod,unser"
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"""optixstuff -- Hardware abstractions for the HWO simulation suite."""
|
|
2
|
+
|
|
3
|
+
from optixstuff._version import __version__
|
|
4
|
+
from optixstuff.aperture_binding import (
|
|
5
|
+
MatchedStamps,
|
|
6
|
+
PreparedAperture,
|
|
7
|
+
matched_moments,
|
|
8
|
+
prepare_aperture,
|
|
9
|
+
)
|
|
10
|
+
from optixstuff.apertures import (
|
|
11
|
+
DEFAULT_APERTURE_RULE,
|
|
12
|
+
ApertureRule,
|
|
13
|
+
Circular,
|
|
14
|
+
HalfMaximum,
|
|
15
|
+
Matched,
|
|
16
|
+
)
|
|
17
|
+
from optixstuff.coronagraph import (
|
|
18
|
+
AbstractCoronagraph,
|
|
19
|
+
AbstractImagingCoronagraph,
|
|
20
|
+
AbstractSceneCoronagraph,
|
|
21
|
+
AbstractTableCoronagraph,
|
|
22
|
+
MultiBandCoronagraph,
|
|
23
|
+
ProductGrids,
|
|
24
|
+
ScalarCoronagraph,
|
|
25
|
+
SceneRender,
|
|
26
|
+
SourcePSFs,
|
|
27
|
+
)
|
|
28
|
+
from optixstuff.detector import (
|
|
29
|
+
AbstractDetector,
|
|
30
|
+
Detector,
|
|
31
|
+
IdealDetector,
|
|
32
|
+
)
|
|
33
|
+
from optixstuff.disperser import AbstractDisperser, LensletDisperser
|
|
34
|
+
from optixstuff.exposure import FramePlan, frames_for_time
|
|
35
|
+
from optixstuff.optical_elements import (
|
|
36
|
+
AbstractOpticalElement,
|
|
37
|
+
AbstractUniformElement,
|
|
38
|
+
ConstantThroughput,
|
|
39
|
+
TransmissiveElement,
|
|
40
|
+
)
|
|
41
|
+
from optixstuff.optical_path import OpticalPath
|
|
42
|
+
from optixstuff.performance import PerformanceCurves, SampledProfile
|
|
43
|
+
from optixstuff.primary import AbstractPrimary, SegmentedPrimary, SimplePrimary
|
|
44
|
+
from optixstuff.rates import ElectronRates, IntegratedPhotonRates, PhotonRates
|
|
45
|
+
from optixstuff.speckle import AbstractSpeckleField, FocalResponse, LinearSpeckleField
|
|
46
|
+
|
|
47
|
+
__all__ = [
|
|
48
|
+
"DEFAULT_APERTURE_RULE",
|
|
49
|
+
"AbstractCoronagraph",
|
|
50
|
+
"AbstractDetector",
|
|
51
|
+
"AbstractDisperser",
|
|
52
|
+
"AbstractImagingCoronagraph",
|
|
53
|
+
"AbstractOpticalElement",
|
|
54
|
+
"AbstractPrimary",
|
|
55
|
+
"AbstractSceneCoronagraph",
|
|
56
|
+
"AbstractSpeckleField",
|
|
57
|
+
"AbstractTableCoronagraph",
|
|
58
|
+
"AbstractUniformElement",
|
|
59
|
+
"ApertureRule",
|
|
60
|
+
"Circular",
|
|
61
|
+
"ConstantThroughput",
|
|
62
|
+
"Detector",
|
|
63
|
+
"ElectronRates",
|
|
64
|
+
"FocalResponse",
|
|
65
|
+
"FramePlan",
|
|
66
|
+
"HalfMaximum",
|
|
67
|
+
"IdealDetector",
|
|
68
|
+
"IntegratedPhotonRates",
|
|
69
|
+
"LensletDisperser",
|
|
70
|
+
"LinearSpeckleField",
|
|
71
|
+
"Matched",
|
|
72
|
+
"MatchedStamps",
|
|
73
|
+
"MultiBandCoronagraph",
|
|
74
|
+
"OpticalPath",
|
|
75
|
+
"PerformanceCurves",
|
|
76
|
+
"PhotonRates",
|
|
77
|
+
"PreparedAperture",
|
|
78
|
+
"ProductGrids",
|
|
79
|
+
"SampledProfile",
|
|
80
|
+
"ScalarCoronagraph",
|
|
81
|
+
"SceneRender",
|
|
82
|
+
"SegmentedPrimary",
|
|
83
|
+
"SimplePrimary",
|
|
84
|
+
"SourcePSFs",
|
|
85
|
+
"TransmissiveElement",
|
|
86
|
+
"__version__",
|
|
87
|
+
"frames_for_time",
|
|
88
|
+
"matched_moments",
|
|
89
|
+
"prepare_aperture",
|
|
90
|
+
]
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Each leaf class in optixstuff (primary, detector, throughput elements,
|
|
4
4
|
coronagraphs) defines its own one-line ``__repr__``; the
|
|
5
5
|
:class:`OpticalPath` aggregator uses :func:`indent` to nest the
|
|
6
|
-
children one level deeper.
|
|
6
|
+
children one level deeper. Primary summaries label both diameter conventions;
|
|
7
|
+
coronagraph summaries distinguish data extent from a design working angle.
|
|
7
8
|
"""
|
|
8
9
|
|
|
9
10
|
from __future__ import annotations
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '
|
|
22
|
-
__version_tuple__ = version_tuple = (
|
|
21
|
+
__version__ = version = '6.0.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (6, 0, 0)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|