|
6 | 6 | import autoarray as aa |
7 | 7 | import autogalaxy as ag |
8 | 8 |
|
9 | | -from autoarray.plot.array import plot_array, _zoom_array_2d |
| 9 | +from autogalaxy.plot.plot_utils import plot_array |
| 10 | +from autoarray.plot.array import _zoom_array_2d |
10 | 11 | from autoarray.plot.utils import save_figure, hide_unused_axes, conf_subplot_figsize |
11 | 12 | from autoarray.plot.utils import numpy_lines as _to_lines |
12 | 13 | from autoarray.inversion.mappers.abstract import Mapper |
@@ -42,11 +43,11 @@ def _compute_critical_curve_lines(tracer, grid): |
42 | 43 | _rad_ca_lines = _to_lines(list(rad_ca) if rad_ca is not None else []) or [] |
43 | 44 | image_plane_lines = (_tan_cc_lines + _rad_cc_lines) or None |
44 | 45 | image_plane_line_colors = ( |
45 | | - ["black"] * len(_tan_cc_lines) + ["white"] * len(_rad_cc_lines) |
| 46 | + ["white"] * len(_tan_cc_lines) + ["yellow"] * len(_rad_cc_lines) |
46 | 47 | ) |
47 | 48 | source_plane_lines = (_tan_ca_lines + _rad_ca_lines) or None |
48 | 49 | source_plane_line_colors = ( |
49 | | - ["black"] * len(_tan_ca_lines) + ["white"] * len(_rad_ca_lines) |
| 50 | + ["white"] * len(_tan_ca_lines) + ["yellow"] * len(_rad_ca_lines) |
50 | 51 | ) |
51 | 52 | return image_plane_lines, image_plane_line_colors, source_plane_lines, source_plane_line_colors |
52 | 53 | except Exception: |
@@ -134,9 +135,17 @@ def _plot_source_plane(fit, ax, plane_index, zoom_to_brightest=True, |
134 | 135 | """ |
135 | 136 | tracer = fit.tracer_linear_light_profiles_to_light_profiles |
136 | 137 | if not tracer.planes[plane_index].has(cls=aa.Pixelization): |
| 138 | + if zoom_to_brightest: |
| 139 | + grid = fit.mask.derive_grid.all_false |
| 140 | + else: |
| 141 | + zoom = aa.Zoom2D(mask=fit.mask) |
| 142 | + grid = aa.Grid2D.from_extent( |
| 143 | + extent=zoom.extent_from(buffer=0), |
| 144 | + shape_native=zoom.shape_native, |
| 145 | + ) |
137 | 146 | image = plane_image_from( |
138 | 147 | galaxies=tracer.planes[plane_index], |
139 | | - grid=fit.mask.derive_grid.all_false, |
| 148 | + grid=grid, |
140 | 149 | zoom_to_brightest=zoom_to_brightest, |
141 | 150 | ) |
142 | 151 | plot_array( |
@@ -713,6 +722,7 @@ def subplot_tracer_from_fit( |
713 | 722 | else: |
714 | 723 | axes_flat[1].axis("off") |
715 | 724 |
|
| 725 | + |
716 | 726 | # Panel 2: Source Plane (No Zoom) (same as subplot_fit panel 12) |
717 | 727 | _plot_source_plane(fit, axes_flat[2], final_plane_index, zoom_to_brightest=False, |
718 | 728 | colormap=colormap, title="Source Plane (No Zoom)", |
@@ -742,17 +752,14 @@ def subplot_tracer_from_fit( |
742 | 752 |
|
743 | 753 | # Panel 6: Deflections Y |
744 | 754 | plot_array(array=deflections_y, ax=axes_flat[6], title="Deflections Y", |
745 | | - lines=image_plane_lines, line_colors=image_plane_line_colors, |
746 | 755 | colormap=colormap) |
747 | 756 |
|
748 | 757 | # Panel 7: Deflections X |
749 | 758 | plot_array(array=deflections_x, ax=axes_flat[7], title="Deflections X", |
750 | | - lines=image_plane_lines, line_colors=image_plane_line_colors, |
751 | 759 | colormap=colormap) |
752 | 760 |
|
753 | 761 | # Panel 8: Magnification |
754 | 762 | plot_array(array=magnification, ax=axes_flat[8], title="Magnification", |
755 | | - lines=image_plane_lines, line_colors=image_plane_line_colors, |
756 | 763 | colormap=colormap) |
757 | 764 |
|
758 | 765 | plt.tight_layout() |
|
0 commit comments