optixstuff 4.0.1__tar.gz → 4.1.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.
Files changed (27) hide show
  1. {optixstuff-4.0.1 → optixstuff-4.1.0}/CHANGELOG.md +12 -0
  2. {optixstuff-4.0.1 → optixstuff-4.1.0}/PKG-INFO +2 -1
  3. {optixstuff-4.0.1 → optixstuff-4.1.0}/pyproject.toml +2 -0
  4. {optixstuff-4.0.1 → optixstuff-4.1.0}/src/optixstuff/_version.py +2 -2
  5. {optixstuff-4.0.1 → optixstuff-4.1.0}/src/optixstuff/detector.py +8 -2
  6. {optixstuff-4.0.1 → optixstuff-4.1.0}/src/optixstuff/primary.py +68 -0
  7. {optixstuff-4.0.1 → optixstuff-4.1.0}/.codespellrc +0 -0
  8. {optixstuff-4.0.1 → optixstuff-4.1.0}/.editorconfig +0 -0
  9. {optixstuff-4.0.1 → optixstuff-4.1.0}/.gitattributes +0 -0
  10. {optixstuff-4.0.1 → optixstuff-4.1.0}/.gitignore +0 -0
  11. {optixstuff-4.0.1 → optixstuff-4.1.0}/.pre-commit-config.yaml +0 -0
  12. {optixstuff-4.0.1 → optixstuff-4.1.0}/.readthedocs.yaml +0 -0
  13. {optixstuff-4.0.1 → optixstuff-4.1.0}/.zenodo.json +0 -0
  14. {optixstuff-4.0.1 → optixstuff-4.1.0}/CITATION.cff +0 -0
  15. {optixstuff-4.0.1 → optixstuff-4.1.0}/LICENSE +0 -0
  16. {optixstuff-4.0.1 → optixstuff-4.1.0}/README.md +0 -0
  17. {optixstuff-4.0.1 → optixstuff-4.1.0}/SECURITY.md +0 -0
  18. {optixstuff-4.0.1 → optixstuff-4.1.0}/src/optixstuff/__init__.py +0 -0
  19. {optixstuff-4.0.1 → optixstuff-4.1.0}/src/optixstuff/_repr.py +0 -0
  20. {optixstuff-4.0.1 → optixstuff-4.1.0}/src/optixstuff/coronagraph.py +0 -0
  21. {optixstuff-4.0.1 → optixstuff-4.1.0}/src/optixstuff/disperser.py +0 -0
  22. {optixstuff-4.0.1 → optixstuff-4.1.0}/src/optixstuff/exposure.py +0 -0
  23. {optixstuff-4.0.1 → optixstuff-4.1.0}/src/optixstuff/optical_elements.py +0 -0
  24. {optixstuff-4.0.1 → optixstuff-4.1.0}/src/optixstuff/optical_path.py +0 -0
  25. {optixstuff-4.0.1 → optixstuff-4.1.0}/src/optixstuff/speckle.py +0 -0
  26. {optixstuff-4.0.1 → optixstuff-4.1.0}/src/optixstuff/yippy_coronagraph.py +0 -0
  27. {optixstuff-4.0.1 → optixstuff-4.1.0}/tools/check_internal_refs.py +0 -0
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.1.0](https://github.com/CoreySpohn/optixstuff/compare/v4.0.1...v4.1.0) (2026-11-12)
4
+
5
+
6
+ ### Features
7
+
8
+ * **primary:** add SimplePrimary.from_yip ([f8f563e](https://github.com/CoreySpohn/optixstuff/commit/f8f563e94eeb326eebb5a4600236ad20b79068b3))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **detector:** default dqe to 1.0 so the default means no QE degradation ([735a651](https://github.com/CoreySpohn/optixstuff/commit/735a651607741091a494b8a0f710821d71da0bb5))
14
+
3
15
  ## [4.0.1](https://github.com/CoreySpohn/optixstuff/compare/v4.0.0...v4.0.1) (2026-11-06)
4
16
 
5
17
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: optixstuff
3
- Version: 4.0.1
3
+ Version: 4.1.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,6 +33,7 @@ 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
36
37
  Requires-Dist: equinox>=0.13.2
37
38
  Requires-Dist: hwoutils>=1.10.0
38
39
  Requires-Dist: interpax>=0.3.12
@@ -17,6 +17,8 @@ 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",
20
22
  "equinox>=0.13.2",
21
23
  "hwoutils>=1.10.0",
22
24
  "interpax>=0.3.12",
@@ -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 = '4.0.1'
22
- __version_tuple__ = version_tuple = (4, 0, 1)
21
+ __version__ = version = '4.1.0'
22
+ __version_tuple__ = version_tuple = (4, 1, 0)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -286,6 +286,9 @@ class IdealDetector(AbstractDetector):
286
286
 
287
287
  Suitable for broadband imager studies where wavelength-dependent
288
288
  QE variation is not important and CIC/read noise are negligible.
289
+
290
+ ``dqe`` is the multiplicative QE degradation factor; the default 1.0
291
+ means no degradation, so the effective QE is ``quantum_efficiency * dqe``.
289
292
  """
290
293
 
291
294
  pixel_scale_arcsec: float
@@ -308,7 +311,7 @@ class IdealDetector(AbstractDetector):
308
311
  clock_induced_charge_rate_e_per_frame: float = 0.0,
309
312
  frame_time_s: float = 1.0,
310
313
  read_time_s: float = 0.05,
311
- dqe: float = 0.0,
314
+ dqe: float = 1.0,
312
315
  ) -> None:
313
316
  """Create a simple constant-QE detector."""
314
317
  self.pixel_scale_arcsec = pixel_scale_arcsec
@@ -379,6 +382,9 @@ class Detector(AbstractDetector):
379
382
  sources matter. Uses Poisson statistics for dark/CIC and Gaussian
380
383
  for read noise, matching the coronagraphoto convention.
381
384
 
385
+ ``dqe`` is the multiplicative QE degradation factor; the default 1.0
386
+ means no degradation.
387
+
382
388
  Warning: ``num_frames = jnp.ceil(exposure_time_s / frame_time_s)`` is
383
389
  kept as a float. Never cast it to int inside JIT -- that triggers a
384
390
  ConcretizationTypeError when exposure_time_s is traced.
@@ -405,7 +411,7 @@ class Detector(AbstractDetector):
405
411
  clock_induced_charge_rate_e_per_frame: float = 0.0,
406
412
  frame_time_s: float = 1.0,
407
413
  read_time_s: float = 0.05,
408
- dqe: float = 0.0,
414
+ dqe: float = 1.0,
409
415
  qe_curve: tuple[ArrayLike, ArrayLike] | None = None,
410
416
  ) -> None:
411
417
  """Create a full detector with all noise sources.
@@ -1,5 +1,8 @@
1
1
  """Primary mirror abstractions."""
2
2
 
3
+ from math import sqrt
4
+ from pathlib import Path
5
+
3
6
  import equinox as eqx
4
7
  import jax.numpy as jnp
5
8
  from equinox import AbstractVar
@@ -23,6 +26,11 @@ class AbstractPrimary(eqx.Module):
23
26
  class SimplePrimary(AbstractPrimary):
24
27
  """A simple circular primary mirror with a central obscuration.
25
28
 
29
+ The obscuration is the inner-to-outer diameter ratio, so the annular
30
+ collecting area is ``pi * (diameter_m / 2)**2 * (1 - obscuration**2)``
31
+ times ``shape_factor``. :meth:`from_yip` converts the YIP ``OBSCURED``
32
+ area fraction to this linear ratio by taking its square root.
33
+
26
34
  Args:
27
35
  diameter_m: Primary mirror diameter in meters.
28
36
  obscuration: Linear obscuration fraction (0 = no obscuration).
@@ -45,6 +53,66 @@ class SimplePrimary(AbstractPrimary):
45
53
  self.obscuration = obscuration
46
54
  self.shape_factor = shape_factor
47
55
 
56
+ @classmethod
57
+ def from_yip(cls, yip, shape_factor: float = 1.0) -> "SimplePrimary":
58
+ """Build an aperture from YIP diameter and obscured area metadata.
59
+
60
+ Args:
61
+ yip: YIP directory or stellar-intensity FITS path, a
62
+ YippyCoronagraph, or a yippy Coronagraph/EqxCoronagraph.
63
+ Objects must retain the header or diameter metadata.
64
+ Paths read only the header, without loading PSF arrays.
65
+ shape_factor: Fraction of remaining area that collects light.
66
+
67
+ Returns:
68
+ An aperture with diameter in meters and linear obscuration.
69
+
70
+ Raises:
71
+ ValueError: If D or OBSCURED is missing or None. Some yippy
72
+ EqxCoronagraph versions discard D; use the original YIP
73
+ path or yippy Coronagraph in that case.
74
+ """
75
+ from astropy.io import fits
76
+ from yippy.header import HeaderData
77
+
78
+ from optixstuff.yippy_coronagraph import YippyCoronagraph
79
+
80
+ if isinstance(yip, YippyCoronagraph):
81
+ yip = yip._backend
82
+ if isinstance(yip, (str, Path)):
83
+ path = Path(yip)
84
+ if path.is_dir():
85
+ path = path / "stellar_intens.fits"
86
+ raw_header = fits.getheader(path, 0)
87
+ for key in ("D", "OBSCURED"):
88
+ if raw_header.get(key) is None:
89
+ raise ValueError(f"YIP header is missing {key}")
90
+ header = HeaderData.from_fits_header(raw_header)
91
+ else:
92
+ header = getattr(yip, "header", None)
93
+
94
+ if header is not None:
95
+ diameter = getattr(header, "diameter", None)
96
+ obscured = getattr(header, "obscured", None)
97
+ else:
98
+ diameter = getattr(yip, "diameter_m", None)
99
+ obscured = getattr(yip, "frac_obscured", None)
100
+ if diameter is None:
101
+ raise ValueError(
102
+ "YIP metadata is missing D (diameter); use the original YIP "
103
+ "path or yippy Coronagraph if the backend discarded it"
104
+ )
105
+ if obscured is None:
106
+ raise ValueError(
107
+ "YIP metadata is missing OBSCURED (obscured area fraction)"
108
+ )
109
+ diameter_m = (
110
+ float(diameter.to_value("m"))
111
+ if hasattr(diameter, "to_value")
112
+ else float(diameter)
113
+ )
114
+ return cls(diameter_m, obscuration=sqrt(obscured), shape_factor=shape_factor)
115
+
48
116
  @property
49
117
  def diameter_m(self) -> float:
50
118
  """Primary mirror diameter in meters."""
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes