Skip to content

Commit be84d80

Browse files
Jammy2211Jammy2211
authored andcommitted
fixes to plotting
1 parent f0569ad commit be84d80

7 files changed

Lines changed: 217 additions & 217 deletions

PLOT_REFACTOR_PLAN.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Problems:
4646
describes the workaround as a "nasty hack"
4747
- The config system switches every wrap object between `figure:` and `subplot:` sections
4848
based on whether `subplot_index is not None`, adding hidden state to every config lookup
49-
- Nested plotters (FitImagingPlotterTracerPlotter → InversionPlotter) share one
49+
- Nested plotters (FitImagingTracer → InversionPlotter) share one
5050
mat_plot object so their indices accumulate in the same global counter
5151

5252
The fix is to use matplotlib's native `plt.subplots()` and pass `ax` objects directly.
@@ -272,7 +272,7 @@ constructor accepts `output_path` and `output_filename` strings.
272272

273273
---
274274

275-
#### PR A3 · Update `ImagingPlotter`, `InversionPlotter`, `MapperPlotter`, `InterferometerPlotter`
275+
#### PR A3 · Update `Imaging`, `InversionPlotter`, `MapperPlotter`, `Interferometer`
276276

277277
Same `ax`-passing pattern. Mixed 1D/2D subplots (e.g. interferometer) use:
278278

@@ -365,13 +365,13 @@ They have no config dependency.
365365
366366
---
367367
368-
#### PR G2 · Update `LightProfilePlotter`, `MassProfilePlotter`, `GalaxyPlotter`, `GalaxiesPlotter`
368+
#### PR G2 · Update `LightProfile`, `MassProfilePlotter`, `Galaxy`, `Galaxies`
369369
370370
Each plotter computes its own overlay data from its galaxy/profile then passes it
371371
to `plot_array`:
372372
373373
```python
374-
class GalaxiesPlotter(AbstractPlotter):
374+
class Galaxies(AbstractPlotter):
375375
def figure_image(self, ax=None):
376376
owns = ax is None
377377
if owns:
@@ -390,7 +390,7 @@ Remove autogalaxy `MatPlot2D` subclass and autogalaxy `Visuals2D` subclass.
390390

391391
---
392392

393-
#### PR G3 · Update autogalaxy `FitImagingPlotter` and `FitInterferometerPlotter`
393+
#### PR G3 · Update autogalaxy `FitImaging` and `FitInterferometer`
394394

395395
```python
396396
def subplot_fit(self):
@@ -420,13 +420,13 @@ Update `autogalaxy/plot/__init__.py`.
420420

421421
---
422422

423-
#### PR L1 · Update `TracerPlotter`
423+
#### PR L1 · Update `Tracer`
424424

425425
The plotter computes critical curves / caustics itself from the tracer, then passes
426426
them as `lines` to `plot_array`:
427427

428428
```python
429-
class TracerPlotter(AbstractPlotter):
429+
class Tracer(AbstractPlotter):
430430
def figure_convergence(self, ax=None):
431431
owns = ax is None
432432
if owns:
@@ -464,7 +464,7 @@ Add `show_critical_curves: bool = True`, `show_caustics: bool = True`.
464464

465465
---
466466

467-
#### PR L2 · Update `FitImagingPlotter`
467+
#### PR L2 · Update `FitImaging`
468468

469469
Largest single plotter. The 12-panel `subplot_fit` becomes:
470470

@@ -511,7 +511,7 @@ def subplot_of_planes(self):
511511

512512
---
513513

514-
#### PR L3 · Update `FitInterferometerPlotter`, `PointDatasetPlotter`, `FitPointDatasetPlotter`
514+
#### PR L3 · Update `FitInterferometer`, `PointDatasetPlotter`, `FitPointDatasetPlotter`
515515

516516
**PointDatasetPlotter** — mixed 1D/2D, which was the "nasty hack" case:
517517

@@ -566,15 +566,15 @@ plot_array(
566566
|---|---|---|---|
567567
| A1 | autoarray | Add `plots/` module | New unit tests |
568568
| A2 | autoarray | Rewrite Array2D/Grid2DPlotter | Update existing |
569-
| A3 | autoarray | Rewrite Imaging/Inversion/Mapper/InterferometerPlotter | Update existing |
569+
| A3 | autoarray | Rewrite Imaging/Inversion/Mapper/Interferometer | Update existing |
570570
| A4 | autoarray | Delete mat_plot/, wrap/, visuals/ | Delete wrap tests |
571571
| A5 | autoarray | Config cleanup, finalise helpers | Smoke tests |
572572
| G1 | autogalaxy | Add overlay helpers | New unit tests |
573573
| G2 | autogalaxy | Rewrite Galaxy/Mass/LightProfile plotters | Update existing |
574574
| G3 | autogalaxy | Rewrite FitImaging/FitInterferometer plotters | Update existing |
575575
| G4 | autogalaxy | Delete MatPlot2D/Visuals2D extensions | Delete wrap tests |
576-
| L1 | autolens | Rewrite TracerPlotter | Update existing |
577-
| L2 | autolens | Rewrite FitImagingPlotter | Update existing |
576+
| L1 | autolens | Rewrite Tracer | Update existing |
577+
| L2 | autolens | Rewrite FitImaging | Update existing |
578578
| L3 | autolens | Rewrite FitInterferometer/Point plotters | Update existing |
579579
| L4 | autolens | Rewrite Subhalo plotters, clean abstract_plotters | Update existing |
580580

autolens/imaging/plot/fit_imaging_plots.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ def subplot_tracer_from_fit(
581581
)
582582

583583
tan_cc, rad_cc = _critical_curves_from(tracer, grid)
584-
image_plane_lines = _to_lines(list(tan_cc) + list(rad_cc))
584+
image_plane_lines = _to_lines(list(tan_cc) + (list(rad_cc) if rad_cc is not None else []))
585585

586586
traced_grids = tracer.traced_grid_2d_list_from(grid=grid)
587587
lens_galaxies = ag.Galaxies(galaxies=tracer.planes[0])

autolens/plot/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from autoarray.plot.grid import plot_grid
1010

1111
from autoarray.dataset.plot.imaging_plots import (
12-
subplot_imaging,
12+
subplot_imaging_dataset,
1313
subplot_imaging_dataset_list,
1414
)
1515
from autoarray.dataset.plot.interferometer_plots import subplot_interferometer_dirty_images

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ below shows this in action:
109109
We can use the Grid2D and Tracer to perform many lensing calculations, for example
110110
plotting the image of the lensed source.
111111
"""
112-
tracer_plotter = aplt.TracerPlotter(tracer=tracer, grid=grid)
112+
tracer_plotter = aplt.Tracer(tracer=tracer, grid=grid)
113113
tracer_plotter.figures_2d(image=True)
114114
115115
To perform lens modeling, **PyAutoLens** adopts the probabilistic programming

0 commit comments

Comments
 (0)