From b12a4d1ab6df8f6dab28d7eec867a53254a55a5d Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Mon, 2 Nov 2026 15:36:03 +0000 Subject: [PATCH] feat: export source-plane magnification maps through aplt Re-exports plot_magnification_source_plane and plot_magnification_source_plane_grid; tests with a fit's mapper and a two-plane tracer. Arc phase 8b (PyAutoArray#673). Co-Authored-By: Claude Opus 5.5 --- autolens/plot/__init__.py | 2 ++ test_autolens/lens/plot/test_tracer_plots.py | 31 ++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/autolens/plot/__init__.py b/autolens/plot/__init__.py index 2641f28ce..deffefda2 100644 --- a/autolens/plot/__init__.py +++ b/autolens/plot/__init__.py @@ -33,6 +33,8 @@ subplot_galaxies, subplot_galaxy_images, plot_magnification_2d, + plot_magnification_source_plane, + plot_magnification_source_plane_grid, subplot_adapt_images, subplot_fit_imaging_of_galaxy, subplot_fit_dirty_images, diff --git a/test_autolens/lens/plot/test_tracer_plots.py b/test_autolens/lens/plot/test_tracer_plots.py index 4b352e1a9..9776d8d03 100644 --- a/test_autolens/lens/plot/test_tracer_plots.py +++ b/test_autolens/lens/plot/test_tracer_plots.py @@ -114,3 +114,34 @@ def test__plot_magnification_2d__three_plane_tracer__contours_drawn(): assert any(hasattr(collection, "levels") for collection in ax.collections) plt.close("all") + + +def test__plot_magnification_source_plane__mesh_of_a_fit__output_file_created( + fit_imaging_x2_plane_inversion_7x7, plot_path, plot_patch +): + import autoarray as aa + + fit = fit_imaging_x2_plane_inversion_7x7 + + aplt.plot_magnification_source_plane( + mapper=fit.inversion.cls_list_from(cls=aa.Mapper)[0], + mass_obj=fit.tracer, + grid=fit.dataset.grid, + output_path=plot_path, + output_format="png", + ) + assert str(plot_path / "magnification_source_plane.png") in plot_patch.paths + + +def test__plot_magnification_source_plane_grid__two_plane_tracer__output_file_created( + tracer_x2_plane_7x7, grid_2d_7x7, plot_path, plot_patch +): + aplt.plot_magnification_source_plane_grid( + mass_obj=tracer_x2_plane_7x7, + grid=grid_2d_7x7, + source_shape_native=(10, 10), + sub_size=2, + output_path=plot_path, + output_format="png", + ) + assert str(plot_path / "magnification_source_plane_grid.png") in plot_patch.paths