Commit 2ff2fc0
fix: vmap-blocker bugs in convert.py and FitEllipse cached_property
Two bugs uncovered when validating fitness._vmap(parameters) on the
new JAX path:
1. autogalaxy/convert.py line ~65: (a == 0) & (b == 0) on JAX scalar
tracers triggers TracerArrayConversionError via Python's __and__.
Switch to xp.logical_and so the bool combination stays in JAX-land.
Fixed all four occurrences: axis_ratio_and_angle_from, two spots in
shear_magnitude_and_angle_from, and multipole_k_m_and_phi_m_from.
2. autogalaxy/ellipse/fit_ellipse.py: _points_from_major_axis was
decorated @cached_property. Caching a tracer in self.__dict__
breaks under vmap (different batch elements share one stale cache).
Switch to @Property and recompute on access. The numpy path takes a
~2x hit on this property but the absolute cost is negligible.
Numpy-path numerics unchanged. 870/870 unit tests pass.
Issue PyAutoGalaxy#411.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 1f4a81a commit 2ff2fc0
2 files changed
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
205 | | - | |
| 205 | + | |
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | | - | |
| 213 | + | |
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
312 | | - | |
| 312 | + | |
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| |||
0 commit comments