Commit aee5e94
fix(inversion): make AbstractMeshGeometry picklable
Carve-out from PyAutoFit #1279 Q2 (Phase 4 of the JAX visualization
roadmap). A picklability spike found FitImaging cannot be pickled
today because AbstractMeshGeometry.__init__ stores `self._xp = xp`
— the literal numpy or jax.numpy module — and Python's pickle cannot
serialise module references. This blocked sending a FitImaging over
an mp.Process+Queue or ProcessPoolExecutor boundary, which is the
production target for Phase 4 subprocess visualization.
Replace the module-attribute pattern with `self._use_jax: bool` +
`_xp` as a property derived from that flag. Same pattern already
used in Analysis._xp (PyAutoFit) and AbstractMaker._xp (PyAutoArray
decorators per CLAUDE.md). All existing `self._xp` reads continue to
work transparently via the property.
End-to-end verified: a populated FitImaging round-trips through
pickle.dumps/loads with log_likelihood delta=0.00e+00 on both numpy
and JAX backends. Pickle size ~4.6 MB for a Rectangular-adaptive-
density pixelization fit.
Closes #320. Carve-out from #1279.1 parent 41465a3 commit aee5e94
2 files changed
Lines changed: 85 additions & 1 deletion
File tree
- autoarray/inversion/mesh/mesh_geometry
- test_autoarray/inversion/pixelization/mesh_geometry
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
Lines changed: 77 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
0 commit comments