diff --git a/AGENTS.md b/AGENTS.md index 7e9749d..c4196bf 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -40,7 +40,8 @@ scripts/ point_source_source_chi_squared/visualization.py VisualizerPoint, FitPositionsSource multi_galaxy/visualization.py VisualizerImaging, two lenses + extra galaxy group/visualization.py VisualizerImaging, main lens + two extra galaxies - cluster/visualization.py PlotterPoint, multi-plane: point_/{dataset,fit}.png + cluster/visualization.py VisualizerPoint, multi-plane: cluster overviews, + point_/{dataset,fit,fit_image_plane}.png and extras multi_dataset/visualization.py VisualizerImaging per band: /{dataset,fit}.png weak/visualization.py VisualizerWeak misc/simulators/ one simulator per dataset (regenerate datasets) @@ -66,17 +67,14 @@ the full figure set. Every other producer tracks only `dataset.png` and `fit.png `visualize_before_fit`, then `visualize(..., quick_update=True)` with the true model, then `_viz_cli.keep_dataset_and_fit` renames the plotter's files where they differ (point: `dataset_point.png`; weak: `subplot_weak_dataset.png` / `subplot_fit_weak.png`) and deletes -everything else. Producers with several sub-datasets write one pair per sub-folder -(`multi_dataset` per band, the datacube per channel, `cluster` per point-source plane). Many -of these figures are the galaxy-scale plots and look poor on point / cluster / weak data — -bespoke figures are a follow-up through the Eyes dashboard. `cluster` calls the -`PlotterPoint` methods directly instead of `VisualizerPoint`, skipping the untracked tracer and -galaxy figures; the "Fit Positions" and point-solver panels still draw the critical curves, which -cost ~2 min per dataset on the 15-galaxy multi-plane lens (the PNGs match the visualizer's). -Every point-source `fit.png` (both chi-squared domains and `cluster`) also has a "Fit Source -Plane" panel — the observed positions traced to the point's own plane — whose presentation -follows the fit class: context only for an image-plane chi-squared, the chi-squared's own noise -footprint and value for a source-plane chi-squared (PyAutoLens#789). +everything else. Producers with several sub-datasets use sub-folders (`multi_dataset` per band, +the datacube per channel, `cluster` per point-source family). The cluster producer keeps the +combined figures and selected per-dataset figures from `VisualizerPoint`. Its full combined +update writes `point_/fit.png` for the source-plane likelihood. A second full update with +the image-plane likelihood supplies `point_/fit_image_plane.png`. Both use the simulator's +model with a 0.003 arcsec y offset to the first point source. The family fit shows the observed +positions traced to the point's own plane, along with per-image contributions from the +likelihood used. **Point solver.** `point_source_image_chi_squared` (via `visualize(quick_update=False)`) and `cluster` (per plane) also keep `point_solver.png`: the model's real `PointSolver` refining onto @@ -127,8 +125,8 @@ are no mtimes: it is reproducible from a checkout. `--check` ignores only `gener `rendered_with:`; any added, removed or byte-changed PNG fails it. It is the read contract of the PyAutoEyes dashboard — change its shape only together with the organ. -Each producer pushes `config/` via `conf.instance.push` (the all-true `plots.yaml`), loads its -tracked dataset, builds the simulator's **true model** (every parameter fixed), and calls +Each producer pushes `config/` via `conf.instance.push`, loads its tracked dataset, builds a +fixed model from the simulator's model, and calls `Visualizer*.visualize_before_fit` once and `Visualizer*.visualize` once per source type (the imaging and interferometer `visualization.py` producers; the others are described above) (`parametric/` = SersicCore, `delaunay/` = Overlay image-mesh + `Delaunay` + `ConstantSplit`), @@ -154,8 +152,8 @@ The newer datasets are simulated here from `scripts/misc/simulators/.py`, from the matching `autolens_workspace` simulator (`datacube.py` from `interferometer/features/datacube/simulator.py`) and cut down to stay small, with seeded noise. Their true models live in `true_models/.py`, imported by both the simulator and the -producer, so the fit is always of the model that made the data. Each is registered in -`_viz_cli.DATASETS` (directory, simulator stem, sentinel file); producers call +producer. The cluster producer applies its diagnostic offset only to the fit model. Each +dataset is registered in `_viz_cli.DATASETS` (directory, simulator stem, sentinel file); producers call `ensure_dataset("")`, which simulates only when the sentinel is missing. ## Adding a domain diff --git a/GALLERY.md b/GALLERY.md index 38d5c5b..591789a 100644 --- a/GALLERY.md +++ b/GALLERY.md @@ -2,14 +2,14 @@ -Rendered with PyAutoLens `2026.10.23.1` · 85 figures. +Rendered with PyAutoLens `2026.8.17.1` · 86 figures. -Every figure below is what the PyAutoLens visualizers (`VisualizerImaging`, `VisualizerInterferometer`, `VisualizerPoint`, `VisualizerWeak`) write to a model-fit's `image/` folder, rendered on this repo's datasets with the true model. See [README.md](README.md) for how to improve one. +Every figure below is what the PyAutoLens visualizers (`VisualizerImaging`, `VisualizerInterferometer`, `VisualizerPoint`, `VisualizerWeak`) write to a model-fit's `image/` folder, rendered on this repo's datasets from the simulation models. For the Simple cluster, the first point source is offset by 0.003 arcsec in y. See [README.md](README.md) for how to improve one. ## Contents - [cluster](#cluster) - - [visualization](#cluster--visualization) (17 figures) + - [visualization](#cluster--visualization) (18 figures) - [top level](#cluster--visualization--top-level) - [point_0/](#cluster--visualization--point_0) - [point_1/](#cluster--visualization--point_1) @@ -67,10 +67,6 @@ Every figure below is what the PyAutoLens visualizers (`VisualizerImaging`, `Vis ![fit_image_with_points](scripts/cluster/images/visualization/fit_image_with_points.png) -##### fit_per_image - -![fit_per_image](scripts/cluster/images/visualization/fit_per_image.png) - ##### image_with_points ![image_with_points](scripts/cluster/images/visualization/image_with_points.png) @@ -85,6 +81,10 @@ Every figure below is what the PyAutoLens visualizers (`VisualizerImaging`, `Vis ![fit](scripts/cluster/images/visualization/point_0/fit.png) +##### fit_image_plane + +![fit_image_plane](scripts/cluster/images/visualization/point_0/fit_image_plane.png) + ##### fit_image_with_points ![fit_image_with_points](scripts/cluster/images/visualization/point_0/fit_image_with_points.png) @@ -111,6 +111,10 @@ Every figure below is what the PyAutoLens visualizers (`VisualizerImaging`, `Vis ![fit](scripts/cluster/images/visualization/point_1/fit.png) +##### fit_image_plane + +![fit_image_plane](scripts/cluster/images/visualization/point_1/fit_image_plane.png) + ##### fit_image_with_points ![fit_image_with_points](scripts/cluster/images/visualization/point_1/fit_image_with_points.png) diff --git a/README.md b/README.md index 8d76ddc..3e55fc9 100644 --- a/README.md +++ b/README.md @@ -34,16 +34,18 @@ mirroring `autolens_workspace` (a variant gets its own folder): | `point_source_source_chi_squared` | `visualization.py` | `dataset.png` + `fit.png` | | `multi_galaxy` | `visualization.py` | `dataset.png` + `fit.png` | | `group` | `visualization.py` | `dataset.png` + `fit.png` | -| `cluster` | `visualization.py` | `dataset.png` + `fit.png` + `point_solver.png` per point-source plane | +| `cluster` | `visualization.py` | Combined cluster figures and per-source figures, including `fit.png` (source-plane family fit), `fit_image_plane.png` and `point_solver.png` | | `multi_dataset` | `visualization.py` | `dataset.png` + `fit.png` per band | | `weak` | `visualization.py` | `dataset.png` + `fit.png` | Each figure is exactly what the visualizers (`VisualizerImaging`, `VisualizerInterferometer`, -`VisualizerPoint`, `VisualizerWeak`) write to a fit's `image/` folder, rendered with the -simulator's true model, with every toggle in -[`config/visualize/plots.yaml`](config/visualize/plots.yaml) switched on. Imaging and -interferometer render every figure; the other types track just the dataset and fit figures for -now (several reuse galaxy-scale plots — bespoke point, cluster and weak figures come next). +`VisualizerPoint`, `VisualizerWeak`) write to a fit's `image/` folder. The producers use the +simulation models and enable the figure settings in +[`config/visualize/plots.yaml`](config/visualize/plots.yaml). Imaging and +interferometer render every figure. Other types track a subset, as shown above. The Simple +cluster model offsets the `point_0` source y coordinate by 0.003 arcsec to demonstrate how a +small model error affects the individual images. Both family figures use this same model and +the tracked simulated positions. ## Render locally diff --git a/config/visualize/plots.yaml b/config/visualize/plots.yaml index 6edc195..4ba3885 100644 --- a/config/visualize/plots.yaml +++ b/config/visualize/plots.yaml @@ -71,7 +71,7 @@ fit_point_dataset: # Settings for plots of fits to point fit_image_with_points: true # The observed image with observed and model positions and critical curves over it (fit_image_with_points.png)? subplot_point_solver: true # PointSolver refinement steps at the best fit (point_solver.png); off by default in the library. subplot_fit_combined: true # Multi-dataset (e.g. cluster) fits: every source's fit in one panel, curves at each source's redshift (fit.png)? - fit_per_image_combined: true # Multi-dataset (e.g. cluster) fits: fit_per_image.png for every source, ranking range shared across sources? + fit_per_image_combined: true # Multi-dataset (e.g. cluster) fits: a family fit in /fit.png for every source? fit_image_with_points_combined: true # Multi-dataset (e.g. cluster) fits: the observed image with every source's positions, model and curves (fit_image_with_points.png)? weak_dataset: # Settings for plots of weak lensing shear catalogues (e.g. PlotterWeak). diff --git a/gallery/gallery_build.py b/gallery/gallery_build.py index 9358833..0a16006 100644 --- a/gallery/gallery_build.py +++ b/gallery/gallery_build.py @@ -183,7 +183,8 @@ def render_markdown(manifest: dict, version: str) -> str: "", "Every figure below is what the PyAutoLens visualizers (`VisualizerImaging`, " "`VisualizerInterferometer`, `VisualizerPoint`, `VisualizerWeak`) write to a " - "model-fit's `image/` folder, rendered on this repo's datasets with the true model. " + "model-fit's `image/` folder, rendered on this repo's datasets from the simulation models. " + "For the Simple cluster, the first point source is offset by 0.003 arcsec in y. " "See [README.md](README.md) for how to improve one.", "", "## Contents", diff --git a/gallery/viz_manifest.yaml b/gallery/viz_manifest.yaml index 94a1280..d43c6d4 100644 --- a/gallery/viz_manifest.yaml +++ b/gallery/viz_manifest.yaml @@ -2,116 +2,122 @@ # the PyAutoEyes dashboard. Do not edit by hand: rerun # `bash gallery/gallery_run.sh --all` (or `python gallery/gallery_build.py`). schema: 1 -generated: '2026-10-23' +generated: '2026-11-24' rendered_with: - autolens: 2026.10.23.1 - autogalaxy: 2026.10.23.1 - autoarray: 2026.10.23.1 - autofit: 2026.10.23.1 -figure_count: 85 + autolens: 2026.8.17.1 + autogalaxy: 2026.8.17.1 + autoarray: 2026.8.17.1 + autofit: 2026.8.17.1 +figure_count: 86 figures: - file: scripts/cluster/images/visualization/dataset.png producer: scripts/cluster/visualization.py domain: cluster source: '' - bytes: 43861 - sha256: fcc23cc31b40f2c67567a48c16125790e1ae62e15c9b28a77d9a2c3b95a25b21 + bytes: 54683 + sha256: fe424dfe87bad34ba8989cdd3eee4b2bf640dbe2c100984f5d109b7f6630a9be - file: scripts/cluster/images/visualization/fit.png producer: scripts/cluster/visualization.py domain: cluster source: '' - bytes: 91340 - sha256: a4732cd82dff6617541156336c45f88966562f6c5074cf78788f94b3e371eb10 + bytes: 121680 + sha256: 27c23d3a0903e9d64517abe3701d81f09942a3c01fec28a392ab8ceac9f1f07a - file: scripts/cluster/images/visualization/fit_image_with_points.png producer: scripts/cluster/visualization.py domain: cluster source: '' - bytes: 1604197 - sha256: 612ade07a0d95bf3db87bdf63c8c09bfb0fd1f2a20c9ec392a231ee4f6886eed -- file: scripts/cluster/images/visualization/fit_per_image.png - producer: scripts/cluster/visualization.py - domain: cluster - source: '' - bytes: 310322 - sha256: ee89f8a8310901093b14bd60300c21c741341a65f0644aeafd74bb4b7c66eb12 + bytes: 278606 + sha256: 9fead5ed4bf46d1f28e3d3acf398e6deb2dd6bb0599ad64406240a2ff612838e - file: scripts/cluster/images/visualization/image_with_points.png producer: scripts/cluster/visualization.py domain: cluster source: '' - bytes: 1605253 - sha256: df8a3c174b6633b3f3059ae8cedff4ec27043ebf7b3559dc0efdd68095f9ca80 + bytes: 223180 + sha256: 46b5115c2978501369575fbfd2c8739b88ce9d1b283eb9d7a6fbf0874d76ca6b - file: scripts/cluster/images/visualization/point_0/dataset.png producer: scripts/cluster/visualization.py domain: cluster source: point_0 - bytes: 38917 - sha256: e466350f5d0cf211e8565f31331ebf1543da073f7916917b9b4401c2a589b650 + bytes: 45202 + sha256: dba5cd0954f04ccce6f9d62dbe880cf0773b286dd65bb78bacf0f8590c884268 - file: scripts/cluster/images/visualization/point_0/fit.png producer: scripts/cluster/visualization.py domain: cluster source: point_0 - bytes: 55395 - sha256: 5aa60af40fa7cc03947610df7af5340e12188c5df919a841fb3febffdac98bb3 + bytes: 552219 + sha256: 994b63a18449cd845ec1f03420f2ca40adf4e0ea8bc0acd5e32c0ff5b6093df7 +- file: scripts/cluster/images/visualization/point_0/fit_image_plane.png + producer: scripts/cluster/visualization.py + domain: cluster + source: point_0 + bytes: 559248 + sha256: 0eee7a84e789cbed7ef39fa521e407fb811e9f7e1d6237679a13c9651755be54 - file: scripts/cluster/images/visualization/point_0/fit_image_with_points.png producer: scripts/cluster/visualization.py domain: cluster source: point_0 - bytes: 1616534 - sha256: 84efa16a5a8a026f7da42ac4a05b55ae2786e21b8fbd583f5a07e08166dfe46e + bytes: 233475 + sha256: 2d9045086db60c694d14f9a0e2f2cb55ed1eeb19f87dec26ba0895533688a795 - file: scripts/cluster/images/visualization/point_0/fit_per_image.png producer: scripts/cluster/visualization.py domain: cluster source: point_0 - bytes: 159605 - sha256: 558a72bfa017ac4eca3de9ce2873ae0dd1433d1f57e652e71b22d71e2d14712a + bytes: 159912 + sha256: c3c49a9c3923e0483fa32404f1798c0385154abd0c2515f9ca75e3b545b87d7a - file: scripts/cluster/images/visualization/point_0/image_with_points.png producer: scripts/cluster/visualization.py domain: cluster source: point_0 - bytes: 1612913 - sha256: 156a566c065c93e8fbbb138292703ed3df2575d02d6b15227253715d5d68b6ee + bytes: 212299 + sha256: 40e6350c6de9b9ab818732f4a266fa024cdbf23b626d4577cf551ad907efc9dd - file: scripts/cluster/images/visualization/point_0/point_solver.png producer: scripts/cluster/visualization.py domain: cluster source: point_0 - bytes: 1675101 - sha256: a8f3dfc5d96b6d187854a612c44759fb42917bc20b1fcfc92367066343aa64e8 + bytes: 1659465 + sha256: 84c881944ed07f2f1d07092e0f72b5ed48f658f6878f11a2b92e2309005fdb3f - file: scripts/cluster/images/visualization/point_1/dataset.png producer: scripts/cluster/visualization.py domain: cluster source: point_1 - bytes: 34687 - sha256: 9b32f374ccec809763526e5998bf32d1c4153c804dd618b1e785c514d894e7b7 + bytes: 36745 + sha256: 961ed4b35fc9745d43cc6a27e1950fe2e2a65557ec3af65a3922dd396ad5280c - file: scripts/cluster/images/visualization/point_1/fit.png producer: scripts/cluster/visualization.py domain: cluster source: point_1 - bytes: 65872 - sha256: be8958670374c561aeb93fe03efc6c3d99582b6f3bfb725cbf8f939650d7eb56 + bytes: 531529 + sha256: 9fcfdcf36906198c85022053cbc6c34adf3e2031ce89976f80db268e15a631b4 +- file: scripts/cluster/images/visualization/point_1/fit_image_plane.png + producer: scripts/cluster/visualization.py + domain: cluster + source: point_1 + bytes: 546290 + sha256: 1cec14041cfba78a3a34529648fb565ac586da11d6a1573ac95fc438926ab28e - file: scripts/cluster/images/visualization/point_1/fit_image_with_points.png producer: scripts/cluster/visualization.py domain: cluster source: point_1 - bytes: 1613392 - sha256: 3f3c219eb75e57dd403fb8fc87ad27b3988847a07d08d7b70a2ab2daf40430dc + bytes: 240067 + sha256: 62982b52540b1273bb2009332b198378b77c48d6d0afbbce261b100bf3f66595 - file: scripts/cluster/images/visualization/point_1/fit_per_image.png producer: scripts/cluster/visualization.py domain: cluster source: point_1 - bytes: 162992 - sha256: 89dd5af2f49d299ed8dfbb77ed80ee80caf8bea27cc386d34fb827620dd8d4ed + bytes: 155680 + sha256: d851e5dd019055eee25dd43d975edb258bfaa85d45da064809084134786eb8d1 - file: scripts/cluster/images/visualization/point_1/image_with_points.png producer: scripts/cluster/visualization.py domain: cluster source: point_1 - bytes: 1612661 - sha256: 9d8a6b1ab9ef7dc0359dc81f9a4f48a16b5960b9969dc1c100a8d69a962ed50c + bytes: 198904 + sha256: 4cd7e3eab5a5b29ce5eaa5741b79172f980f41656a711fb7806e42013aaa5231 - file: scripts/cluster/images/visualization/point_1/point_solver.png producer: scripts/cluster/visualization.py domain: cluster source: point_1 - bytes: 494006 - sha256: 08abbef85127db46eea8c0b76a027d7f3386759431d7bc6d42bade46162fe48e + bytes: 499370 + sha256: 482ad6ee947511074f0573140c502557c615964c4b6651b8c27d9f8a1f2edc76 - file: scripts/group/images/visualization/dataset.png producer: scripts/group/visualization.py domain: group @@ -440,20 +446,20 @@ figures: producer: scripts/point_source_image_chi_squared/visualization.py domain: point_source_image_chi_squared source: '' - bytes: 37123 - sha256: 33d3328e6a4fef7d4eeb1c5a478a7a0a2a2b827a53afa36221df544c54d07f9c + bytes: 43348 + sha256: 676c33822e0233077820e5604f6a82a8827a137023926eff8d24644b53176cc7 - file: scripts/point_source_image_chi_squared/images/visualization/fit.png producer: scripts/point_source_image_chi_squared/visualization.py domain: point_source_image_chi_squared source: '' - bytes: 66334 - sha256: 3cc1896545dfee8118faa6238ee2711ad1db899d21e6a30dfecaa73695e9a888 + bytes: 71627 + sha256: 9815a450d637018e4ddca9aaa46e615c448af4a57132c69b74f7e99b6fda107b - file: scripts/point_source_image_chi_squared/images/visualization/fit_image_with_points.png producer: scripts/point_source_image_chi_squared/visualization.py domain: point_source_image_chi_squared source: '' - bytes: 96415 - sha256: b7a87cb9d64442381d50368a5d1c72ebf1537deef71faebd6a667af69a7a7d7d + bytes: 89904 + sha256: 5ac2a90bb263385e76421099e2be9cb8aa8c04535d5a5d92c73f8cf059ad43e9 - file: scripts/point_source_image_chi_squared/images/visualization/fit_per_image.png producer: scripts/point_source_image_chi_squared/visualization.py domain: point_source_image_chi_squared @@ -464,38 +470,38 @@ figures: producer: scripts/point_source_image_chi_squared/visualization.py domain: point_source_image_chi_squared source: '' - bytes: 63371 - sha256: 5383e6a39be270c889ac6d43f6702a29f95e3ba34a4174833274e202a7db1739 + bytes: 63242 + sha256: b8ff1be9bc949163ef0730fd3d189635c332899a3e8defcd7cf9bf6dd1280478 - file: scripts/point_source_image_chi_squared/images/visualization/point_solver.png producer: scripts/point_source_image_chi_squared/visualization.py domain: point_source_image_chi_squared source: '' - bytes: 806592 - sha256: 9c54f259e73665b15e382f544c812d09446478e86bfd6a4566ec83dbc9b7b16b + bytes: 1120186 + sha256: edd34ecda323f3affe958ccf1382d50c8e6752768c4953844ac09daa2b130cd5 - file: scripts/point_source_image_chi_squared/images/visualization/teaching/point_solver.png producer: scripts/point_source_image_chi_squared/visualization.py domain: point_source_image_chi_squared source: teaching - bytes: 475620 - sha256: 758a10c444a779c3e2452e964b4468467c718e58c28dea9f7ac39b493004feb9 + bytes: 439864 + sha256: ce0d969379384fe0741ec8ab840441fcb272c28d8ee44361f22a9f55785cdcdd - file: scripts/point_source_source_chi_squared/images/visualization/dataset.png producer: scripts/point_source_source_chi_squared/visualization.py domain: point_source_source_chi_squared source: '' - bytes: 37123 - sha256: 33d3328e6a4fef7d4eeb1c5a478a7a0a2a2b827a53afa36221df544c54d07f9c + bytes: 43348 + sha256: 676c33822e0233077820e5604f6a82a8827a137023926eff8d24644b53176cc7 - file: scripts/point_source_source_chi_squared/images/visualization/fit.png producer: scripts/point_source_source_chi_squared/visualization.py domain: point_source_source_chi_squared source: '' - bytes: 61771 - sha256: 92d1544c12a0cf467126d1d9efdcb971bb9efc4dbf0844273ae872d8165ffc1a + bytes: 67312 + sha256: 8543a1c57f39281b2fd7861a81acf151e2276ed7614f67993bdfe6fa7e4c7c1c - file: scripts/point_source_source_chi_squared/images/visualization/fit_image_with_points.png producer: scripts/point_source_source_chi_squared/visualization.py domain: point_source_source_chi_squared source: '' - bytes: 96169 - sha256: 3845d4ca54baa012289562476cfe81cb69aae41767fef67ba10e0a51286996c8 + bytes: 89878 + sha256: 5763e2eee736623640285ec697076876f6ffaac0e2fc8cfd5dbaeb582013c1e6 - file: scripts/point_source_source_chi_squared/images/visualization/fit_per_image.png producer: scripts/point_source_source_chi_squared/visualization.py domain: point_source_source_chi_squared @@ -506,8 +512,8 @@ figures: producer: scripts/point_source_source_chi_squared/visualization.py domain: point_source_source_chi_squared source: '' - bytes: 63371 - sha256: 5383e6a39be270c889ac6d43f6702a29f95e3ba34a4174833274e202a7db1739 + bytes: 63242 + sha256: b8ff1be9bc949163ef0730fd3d189635c332899a3e8defcd7cf9bf6dd1280478 - file: scripts/weak/images/visualization/dataset.png producer: scripts/weak/visualization.py domain: weak diff --git a/scripts/cluster/images/visualization/dataset.png b/scripts/cluster/images/visualization/dataset.png index 497ae9b..04c6066 100644 Binary files a/scripts/cluster/images/visualization/dataset.png and b/scripts/cluster/images/visualization/dataset.png differ diff --git a/scripts/cluster/images/visualization/fit.png b/scripts/cluster/images/visualization/fit.png index 27fc3ab..a9a3ef8 100644 Binary files a/scripts/cluster/images/visualization/fit.png and b/scripts/cluster/images/visualization/fit.png differ diff --git a/scripts/cluster/images/visualization/fit_image_with_points.png b/scripts/cluster/images/visualization/fit_image_with_points.png index 9e38372..07168ca 100644 Binary files a/scripts/cluster/images/visualization/fit_image_with_points.png and b/scripts/cluster/images/visualization/fit_image_with_points.png differ diff --git a/scripts/cluster/images/visualization/fit_per_image.png b/scripts/cluster/images/visualization/fit_per_image.png deleted file mode 100644 index 69c1d55..0000000 Binary files a/scripts/cluster/images/visualization/fit_per_image.png and /dev/null differ diff --git a/scripts/cluster/images/visualization/image_with_points.png b/scripts/cluster/images/visualization/image_with_points.png index 1106e22..11b87ce 100644 Binary files a/scripts/cluster/images/visualization/image_with_points.png and b/scripts/cluster/images/visualization/image_with_points.png differ diff --git a/scripts/cluster/images/visualization/point_0/dataset.png b/scripts/cluster/images/visualization/point_0/dataset.png index df0d0d2..a642f0f 100644 Binary files a/scripts/cluster/images/visualization/point_0/dataset.png and b/scripts/cluster/images/visualization/point_0/dataset.png differ diff --git a/scripts/cluster/images/visualization/point_0/fit.png b/scripts/cluster/images/visualization/point_0/fit.png index 1a49c5c..5e0d40e 100644 Binary files a/scripts/cluster/images/visualization/point_0/fit.png and b/scripts/cluster/images/visualization/point_0/fit.png differ diff --git a/scripts/cluster/images/visualization/point_0/fit_image_plane.png b/scripts/cluster/images/visualization/point_0/fit_image_plane.png new file mode 100644 index 0000000..c504fb5 Binary files /dev/null and b/scripts/cluster/images/visualization/point_0/fit_image_plane.png differ diff --git a/scripts/cluster/images/visualization/point_0/fit_image_with_points.png b/scripts/cluster/images/visualization/point_0/fit_image_with_points.png index 449fcec..f9df5c8 100644 Binary files a/scripts/cluster/images/visualization/point_0/fit_image_with_points.png and b/scripts/cluster/images/visualization/point_0/fit_image_with_points.png differ diff --git a/scripts/cluster/images/visualization/point_0/fit_per_image.png b/scripts/cluster/images/visualization/point_0/fit_per_image.png index 95abebf..35d84fd 100644 Binary files a/scripts/cluster/images/visualization/point_0/fit_per_image.png and b/scripts/cluster/images/visualization/point_0/fit_per_image.png differ diff --git a/scripts/cluster/images/visualization/point_0/image_with_points.png b/scripts/cluster/images/visualization/point_0/image_with_points.png index bac2144..6fbf374 100644 Binary files a/scripts/cluster/images/visualization/point_0/image_with_points.png and b/scripts/cluster/images/visualization/point_0/image_with_points.png differ diff --git a/scripts/cluster/images/visualization/point_0/point_solver.png b/scripts/cluster/images/visualization/point_0/point_solver.png index 2ff4133..38562fc 100644 Binary files a/scripts/cluster/images/visualization/point_0/point_solver.png and b/scripts/cluster/images/visualization/point_0/point_solver.png differ diff --git a/scripts/cluster/images/visualization/point_1/dataset.png b/scripts/cluster/images/visualization/point_1/dataset.png index 3dcea1f..569498a 100644 Binary files a/scripts/cluster/images/visualization/point_1/dataset.png and b/scripts/cluster/images/visualization/point_1/dataset.png differ diff --git a/scripts/cluster/images/visualization/point_1/fit.png b/scripts/cluster/images/visualization/point_1/fit.png index b212ac7..526c1de 100644 Binary files a/scripts/cluster/images/visualization/point_1/fit.png and b/scripts/cluster/images/visualization/point_1/fit.png differ diff --git a/scripts/cluster/images/visualization/point_1/fit_image_plane.png b/scripts/cluster/images/visualization/point_1/fit_image_plane.png new file mode 100644 index 0000000..37e08c1 Binary files /dev/null and b/scripts/cluster/images/visualization/point_1/fit_image_plane.png differ diff --git a/scripts/cluster/images/visualization/point_1/fit_image_with_points.png b/scripts/cluster/images/visualization/point_1/fit_image_with_points.png index 9d1f970..bf915d9 100644 Binary files a/scripts/cluster/images/visualization/point_1/fit_image_with_points.png and b/scripts/cluster/images/visualization/point_1/fit_image_with_points.png differ diff --git a/scripts/cluster/images/visualization/point_1/fit_per_image.png b/scripts/cluster/images/visualization/point_1/fit_per_image.png index 793459c..6be4d5d 100644 Binary files a/scripts/cluster/images/visualization/point_1/fit_per_image.png and b/scripts/cluster/images/visualization/point_1/fit_per_image.png differ diff --git a/scripts/cluster/images/visualization/point_1/image_with_points.png b/scripts/cluster/images/visualization/point_1/image_with_points.png index d3cef77..cc26db7 100644 Binary files a/scripts/cluster/images/visualization/point_1/image_with_points.png and b/scripts/cluster/images/visualization/point_1/image_with_points.png differ diff --git a/scripts/cluster/images/visualization/point_1/point_solver.png b/scripts/cluster/images/visualization/point_1/point_solver.png index 365360f..39dc0f8 100644 Binary files a/scripts/cluster/images/visualization/point_1/point_solver.png and b/scripts/cluster/images/visualization/point_1/point_solver.png differ diff --git a/scripts/cluster/visualization.py b/scripts/cluster/visualization.py index 517786c..ad5e6da 100644 --- a/scripts/cluster/visualization.py +++ b/scripts/cluster/visualization.py @@ -16,24 +16,27 @@ image_with_points.png <- every source's positions over the cluster image fit.png <- VisualizerPoint.visualize_combined: "Fit Positions" of every source, each source's critical curves at its own z - fit_per_image.png <- one row per source: residual ranking (range shared by - both sources) / image-plane zoom / source plane fit_image_with_points.png <- every source's positions and curves over the image point_0/ point_1/ <- each dataset's own figures (visualize_before_fit + - visualize): dataset.png, image_with_points.png, fit.png, + visualize): dataset.png, image_with_points.png, fit_per_image.png, fit_image_with_points.png and point_solver.png (the model's real multi-plane PointSolver refining onto this source's images) + fit.png <- source-plane family fit from visualize_combined + fit_image_plane.png <- image-plane family fit from visualize_combined The per-dataset ``visualize`` also writes the tracer and galaxy figures, which this repo does not track: they (and every other untracked file) are deleted, and ``dataset_point.png`` is -renamed ``dataset.png``. +renamed ``dataset.png``. The family index keeps each source's marker and colour consistent +with the combined cluster overview. Dataset: ``dataset/cluster/simple`` (``point_0``: 5 images, ``point_1``: 2 images, 5 mas noise, and ``data.fits``: the cluster image, visualization only), from -``scripts/misc/simulators/cluster.py``. The model is that simulator's TRUE model -(``true_models/cluster.py``), fitted with the source-plane chi-squared -(``FitPositionsSource``) the workspace cluster example uses, with free-centre point sources. +``scripts/misc/simulators/cluster.py``. The model uses the simulator's lens and source galaxies +(``true_models/cluster.py``) with the point_0 source y coordinate offset by 0.003 arcsec to show +how the family figure diagnoses a small model error. The source-plane chi-squared +(``FitPositionsSource``) matches the workspace cluster example. The image-plane family figures +use ``FitPositionsImagePairRepeat``. Run from the repo root:: @@ -77,15 +80,16 @@ def _repo_root() -> Path: dataset_path = ensure_dataset("cluster", workspace_root=REPO_ROOT) """ -__True Model__ +__Model__ -The simulator's galaxies, every parameter fixed: the prior-median instance IS the true model. -Lens galaxies, scaling members and halo go in ``galaxies`` alongside the two sources. +Lens galaxies, scaling members and halo go in ``galaxies`` alongside the two sources. Offset the +first point source to demonstrate how a small model error can affect its images differently. """ +sources = tm.sources() +y, x = sources[0].point_0.centre +sources[0].point_0.centre = (y + 0.003, x) model = af.Collection( - galaxies=af.Collection( - *tm.main_lenses(), *tm.scaling_galaxies(), tm.host_halo(), *tm.sources() - ), + galaxies=af.Collection(*tm.main_lenses(), *tm.scaling_galaxies(), tm.host_halo(), *sources), ) instance = model.instance_from_prior_medians() @@ -138,13 +142,16 @@ def _repo_root() -> Path: paths = SimpleNamespace(image_path=point_path, output_path=scratch) t0 = time.perf_counter() - VisualizerPoint.visualize_before_fit(analysis=analysis, paths=paths, model=model) + VisualizerPoint.visualize_before_fit( + analysis=analysis, paths=paths, model=model, family_index=i + ) VisualizerPoint.visualize( analysis=analysis, paths=paths, instance=instance, during_analysis=False, quick_update=False, + family_index=i, ) keep_dataset_and_fit( point_path, @@ -177,10 +184,41 @@ def _repo_root() -> Path: keep_dataset_and_fit( image_path, dataset_png="dataset_point.png", - extra_pngs=("fit_per_image.png", "image_with_points.png", "fit_image_with_points.png"), + extra_pngs=("image_with_points.png", "fit_image_with_points.png"), keep_dirs=tuple(analysis.dataset.name for analysis in analyses), ) -print(f"visualize [all sources]: {time.perf_counter() - t0:.1f}s") +print(f"visualize [all sources, source plane]: {time.perf_counter() - t0:.1f}s") + +""" +__Image-Plane Family Fits__ + +Run the same full combined visualizer with the image-plane likelihood. Keep its family figures +alongside the source-plane ones and leave the rest of the second run under the scratch output. +""" +t0 = time.perf_counter() +image_plane_analyses = [ + al.AnalysisPoint( + dataset=analysis.dataset, + solver=solver, + image=image, + fit_positions_cls=al.FitPositionsImagePairRepeat, + use_jax=False, + ) + for analysis in analyses +] +image_plane_path = scratch_root / "image_plane" +image_plane_path.mkdir() +VisualizerPoint.visualize_combined( + analyses=image_plane_analyses, + paths=SimpleNamespace(image_path=image_plane_path, output_path=image_plane_path), + instance=[instance] * len(image_plane_analyses), + during_analysis=False, + quick_update=False, +) +for analysis in image_plane_analyses: + name = analysis.dataset.name + (image_plane_path / name / "fit.png").replace(image_path / name / "fit_image_plane.png") +print(f"visualize [all sources, image plane]: {time.perf_counter() - t0:.1f}s") n_png = len(list(image_path.rglob("*.png"))) print(f"Wrote {n_png} PNGs under {image_path.relative_to(REPO_ROOT)}") diff --git a/scripts/point_source_image_chi_squared/images/visualization/dataset.png b/scripts/point_source_image_chi_squared/images/visualization/dataset.png index 443f56e..c772d4a 100644 Binary files a/scripts/point_source_image_chi_squared/images/visualization/dataset.png and b/scripts/point_source_image_chi_squared/images/visualization/dataset.png differ diff --git a/scripts/point_source_image_chi_squared/images/visualization/fit.png b/scripts/point_source_image_chi_squared/images/visualization/fit.png index f87c496..9256b21 100644 Binary files a/scripts/point_source_image_chi_squared/images/visualization/fit.png and b/scripts/point_source_image_chi_squared/images/visualization/fit.png differ diff --git a/scripts/point_source_image_chi_squared/images/visualization/fit_image_with_points.png b/scripts/point_source_image_chi_squared/images/visualization/fit_image_with_points.png index 3356a73..b10f18b 100644 Binary files a/scripts/point_source_image_chi_squared/images/visualization/fit_image_with_points.png and b/scripts/point_source_image_chi_squared/images/visualization/fit_image_with_points.png differ diff --git a/scripts/point_source_image_chi_squared/images/visualization/image_with_points.png b/scripts/point_source_image_chi_squared/images/visualization/image_with_points.png index 246a17d..df03ef0 100644 Binary files a/scripts/point_source_image_chi_squared/images/visualization/image_with_points.png and b/scripts/point_source_image_chi_squared/images/visualization/image_with_points.png differ diff --git a/scripts/point_source_image_chi_squared/images/visualization/point_solver.png b/scripts/point_source_image_chi_squared/images/visualization/point_solver.png index 3696491..2521cf3 100644 Binary files a/scripts/point_source_image_chi_squared/images/visualization/point_solver.png and b/scripts/point_source_image_chi_squared/images/visualization/point_solver.png differ diff --git a/scripts/point_source_image_chi_squared/images/visualization/teaching/point_solver.gif b/scripts/point_source_image_chi_squared/images/visualization/teaching/point_solver.gif index 8a01f54..2b68881 100644 Binary files a/scripts/point_source_image_chi_squared/images/visualization/teaching/point_solver.gif and b/scripts/point_source_image_chi_squared/images/visualization/teaching/point_solver.gif differ diff --git a/scripts/point_source_image_chi_squared/images/visualization/teaching/point_solver.png b/scripts/point_source_image_chi_squared/images/visualization/teaching/point_solver.png index 57dc44c..b0e75c7 100644 Binary files a/scripts/point_source_image_chi_squared/images/visualization/teaching/point_solver.png and b/scripts/point_source_image_chi_squared/images/visualization/teaching/point_solver.png differ diff --git a/scripts/point_source_source_chi_squared/images/visualization/dataset.png b/scripts/point_source_source_chi_squared/images/visualization/dataset.png index 443f56e..c772d4a 100644 Binary files a/scripts/point_source_source_chi_squared/images/visualization/dataset.png and b/scripts/point_source_source_chi_squared/images/visualization/dataset.png differ diff --git a/scripts/point_source_source_chi_squared/images/visualization/fit.png b/scripts/point_source_source_chi_squared/images/visualization/fit.png index 2cc2018..a1b4684 100644 Binary files a/scripts/point_source_source_chi_squared/images/visualization/fit.png and b/scripts/point_source_source_chi_squared/images/visualization/fit.png differ diff --git a/scripts/point_source_source_chi_squared/images/visualization/fit_image_with_points.png b/scripts/point_source_source_chi_squared/images/visualization/fit_image_with_points.png index 15bea99..3a0ec31 100644 Binary files a/scripts/point_source_source_chi_squared/images/visualization/fit_image_with_points.png and b/scripts/point_source_source_chi_squared/images/visualization/fit_image_with_points.png differ diff --git a/scripts/point_source_source_chi_squared/images/visualization/image_with_points.png b/scripts/point_source_source_chi_squared/images/visualization/image_with_points.png index 246a17d..df03ef0 100644 Binary files a/scripts/point_source_source_chi_squared/images/visualization/image_with_points.png and b/scripts/point_source_source_chi_squared/images/visualization/image_with_points.png differ