Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ PyAutoGalaxy: Open-Source Multi Wavelength Galaxy Structure & Morphology
.. image:: https://joss.theoj.org/papers/10.21105/joss.04475/status.svg
:target: https://doi.org/10.21105/joss.04475

.. image:: https://www.repostatus.org/badges/latest/active.svg
:target: https://www.repostatus.org/#active
:alt: Project Status: Active

.. image:: https://img.shields.io/pypi/pyversions/autogalaxy
:target: https://pypi.org/project/autogalaxy/
:alt: Python Versions

.. image:: https://img.shields.io/pypi/v/autogalaxy.svg
:target: https://pypi.org/project/autogalaxy/
:alt: PyPI Version

`Installation Guide <https://pyautogalaxy.readthedocs.io/en/latest/installation/overview.html>`_ |
`readthedocs <https://pyautogalaxy.readthedocs.io/en/latest/index.html>`_ |
`Introduction on Binder <https://mybinder.org/v2/gh/Jammy2211/autogalaxy_workspace/release?filepath=start_here.ipynb>`_ |
Expand Down
10 changes: 3 additions & 7 deletions autogalaxy/analysis/plotter_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from autogalaxy.galaxy.plot.galaxies_plotters import GalaxiesPlotter
from autogalaxy.galaxy.plot.adapt_plotters import AdaptPlotter

from autogalaxy.plot.include.two_d import Include2D
from autogalaxy.plot.mat_plot.one_d import MatPlot1D
from autogalaxy.plot.mat_plot.two_d import MatPlot2D

Expand Down Expand Up @@ -70,8 +69,6 @@ def __init__(self, image_path: Union[Path, str], title_prefix: str = None):
self.image_path = Path(image_path)
self.title_prefix = title_prefix

self.include_2d = Include2D()

os.makedirs(image_path, exist_ok=True)

@property
Expand Down Expand Up @@ -146,7 +143,6 @@ def should_plot(name):
galaxies=galaxies,
grid=grid,
mat_plot_2d=mat_plot_2d,
include_2d=self.include_2d,
)

if should_plot("subplot_galaxy_images"):
Expand All @@ -158,7 +154,6 @@ def should_plot(name):
galaxies=galaxies,
grid=grid,
mat_plot_2d=mat_plot_2d,
include_2d=self.include_2d,
)

if should_plot("subplot_galaxies"):
Expand Down Expand Up @@ -224,7 +219,8 @@ def should_plot(name):
mat_plot_2d = self.mat_plot_2d_from()

inversion_plotter = aplt.InversionPlotter(
inversion=inversion, mat_plot_2d=mat_plot_2d, include_2d=self.include_2d
inversion=inversion,
mat_plot_2d=mat_plot_2d,
)

if should_plot("subplot_inversion"):
Expand Down Expand Up @@ -291,7 +287,7 @@ def should_plot(name):
mat_plot_2d = self.mat_plot_2d_from()

adapt_plotter = AdaptPlotter(
mat_plot_2d=mat_plot_2d, include_2d=self.include_2d
mat_plot_2d=mat_plot_2d,
)

if should_plot("subplot_adapt_images"):
Expand Down
11 changes: 0 additions & 11 deletions autogalaxy/config/visualize/include.yaml

This file was deleted.

6 changes: 4 additions & 2 deletions autogalaxy/ellipse/model/plotter_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def should_plot(name):
mat_plot_2d = self.mat_plot_2d_from()

dataset_plotter = aplt.ImagingPlotter(
dataset=dataset, mat_plot_2d=mat_plot_2d, include_2d=self.include_2d
dataset=dataset,
mat_plot_2d=mat_plot_2d,
)

if should_plot("subplot_dataset"):
Expand Down Expand Up @@ -90,7 +91,8 @@ def should_plot(name):
mat_plot_2d = self.mat_plot_2d_from()

fit_plotter = FitEllipsePlotter(
fit_list=fit_list, mat_plot_2d=mat_plot_2d, include_2d=self.include_2d
fit_list=fit_list,
mat_plot_2d=mat_plot_2d,
)

try:
Expand Down
14 changes: 1 addition & 13 deletions autogalaxy/ellipse/plot/fit_ellipse_plotters.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
from autogalaxy.plot.abstract_plotters import Plotter
from autogalaxy.plot.mat_plot.one_d import MatPlot1D
from autogalaxy.plot.visuals.one_d import Visuals1D
from autogalaxy.plot.include.one_d import Include1D
from autogalaxy.plot.mat_plot.two_d import MatPlot2D
from autogalaxy.plot.visuals.two_d import Visuals2D
from autogalaxy.plot.include.two_d import Include2D


class FitEllipsePlotter(Plotter):
Expand All @@ -20,28 +18,18 @@ def __init__(
fit_list: List[FitEllipse],
mat_plot_1d: MatPlot1D = None,
visuals_1d: Visuals1D = None,
include_1d: Include1D = None,
mat_plot_2d: MatPlot2D = None,
visuals_2d: Visuals2D = None,
include_2d: Include2D = None,
):
super().__init__(
mat_plot_1d=mat_plot_1d,
visuals_1d=visuals_1d,
include_1d=include_1d,
mat_plot_2d=mat_plot_2d,
visuals_2d=visuals_2d,
include_2d=include_2d,
)

self.fit_list = fit_list

def get_visuals_1d(self) -> Visuals1D:
return self.visuals_1d

def get_visuals_2d(self):
return self.get_2d.via_mask_from(mask=self.fit_list[0].dataset.mask)

def figures_2d(
self,
data: bool = False,
Expand Down Expand Up @@ -87,7 +75,7 @@ def figures_2d(

ellipse_list.append(aa.Grid2DIrregular.from_yx_1d(y=y, x=x))

visuals_2d = self.get_visuals_2d() + Visuals2D(
visuals_2d = self.visuals_2d + Visuals2D(
positions=ellipse_list, lines=ellipse_list
)

Expand Down
22 changes: 0 additions & 22 deletions autogalaxy/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,25 +282,3 @@ def make_analysis_ellipse_7x7():
dataset=make_masked_imaging_7x7(),
)
return analysis


def make_include_1d_all():
return aplt.Include1D(half_light_radius=True)


def make_include_2d_all():
return aplt.Include2D(
origin=True,
mask=True,
border=True,
positions=True,
light_profile_centres=True,
mass_profile_centres=True,
tangential_critical_curves=False,
radial_critical_curves=False,
tangential_caustics=False,
radial_caustics=False,
multiple_images=False,
mapper_source_plane_mesh_grid=True,
mapper_image_plane_mesh_grid=True,
)
13 changes: 3 additions & 10 deletions autogalaxy/galaxy/plot/adapt_plotters.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,15 @@
from autogalaxy.plot.abstract_plotters import Plotter
from autogalaxy.plot.mat_plot.two_d import MatPlot2D
from autogalaxy.plot.visuals.two_d import Visuals2D
from autogalaxy.plot.include.two_d import Include2D


class AdaptPlotter(Plotter):
def __init__(
self,
mat_plot_2d: MatPlot2D = None,
visuals_2d: Visuals2D = None,
include_2d: Include2D = None,
):
super().__init__(
mat_plot_2d=mat_plot_2d, include_2d=include_2d, visuals_2d=visuals_2d
)

def get_visuals_2d(self) -> Visuals2D:
return self.visuals_2d
super().__init__(mat_plot_2d=mat_plot_2d, visuals_2d=visuals_2d)

def figure_model_image(self, model_image: aa.Array2D):
"""
Expand All @@ -36,7 +29,7 @@ def figure_model_image(self, model_image: aa.Array2D):

self.mat_plot_2d.plot_array(
array=model_image,
visuals_2d=self.get_visuals_2d(),
visuals_2d=self.visuals_2d,
auto_labels=aplt.AutoLabels(
title="adapt image", filename="adapt_model_image"
),
Expand All @@ -53,7 +46,7 @@ def figure_galaxy_image(self, galaxy_image: aa.Array2D):
"""
self.mat_plot_2d.plot_array(
array=galaxy_image,
visuals_2d=self.get_visuals_2d(),
visuals_2d=self.visuals_2d,
auto_labels=aplt.AutoLabels(
title="galaxy Image", filename="adapt_galaxy_image"
),
Expand Down
34 changes: 5 additions & 29 deletions autogalaxy/galaxy/plot/galaxies_plotters.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
from autogalaxy.plot.mat_plot.two_d import MatPlot2D
from autogalaxy.plot.visuals.one_d import Visuals1D
from autogalaxy.plot.visuals.two_d import Visuals2D
from autogalaxy.plot.include.one_d import Include1D
from autogalaxy.plot.include.two_d import Include2D
from autogalaxy.plot.mass_plotter import MassPlotter
from autogalaxy.galaxy.galaxy import Galaxy
from autogalaxy.galaxy.galaxies import Galaxies
Expand All @@ -25,10 +23,8 @@ def __init__(
grid: aa.type.Grid1D2DLike,
mat_plot_1d: MatPlot1D = None,
visuals_1d: Visuals1D = None,
include_1d: Include1D = None,
mat_plot_2d: MatPlot2D = None,
visuals_2d: Visuals2D = None,
include_2d: Include2D = None,
):
"""
Plots the attributes of a list of galaxies using the matplotlib methods `plot()` and `imshow()` and many
Expand All @@ -40,8 +36,7 @@ def __init__(
customize the figure's appearance.

Overlaid on the figure are visuals, contained in the `Visuals1D` and `Visuals2D` objects. Attributes may be
extracted from the `MassProfile` and plotted via the visuals object, if the corresponding entry is `True` in
the `Include1D` or `Include2D` object or the `config/visualize/include.ini` file.
extracted from the `MassProfile` and plotted via the visuals object.

Parameters
----------
Expand All @@ -53,14 +48,10 @@ def __init__(
Contains objects which wrap the matplotlib function calls that make 1D plots.
visuals_1d
Contains 1D visuals that can be overlaid on 1D plots.
include_1d
Specifies which attributes of the `MassProfile` are extracted and plotted as visuals for 1D plots.
mat_plot_2d
Contains objects which wrap the matplotlib function calls that make 2D plots.
visuals_2d
Contains 2D visuals that can be overlaid on 2D plots.
include_2d
Specifies which attributes of the `MassProfile` are extracted and plotted as visuals for 2D plots.
"""

self.galaxies = Galaxies(galaxies=galaxies)
Expand All @@ -76,10 +67,8 @@ def __init__(

super().__init__(
mat_plot_2d=mat_plot_2d,
include_2d=include_2d,
visuals_2d=visuals_2d,
mat_plot_1d=mat_plot_1d,
include_1d=include_1d,
visuals_1d=visuals_1d,
)

Expand All @@ -88,22 +77,10 @@ def __init__(
self._mass_plotter = MassPlotter(
mass_obj=self.galaxies,
grid=self.grid,
get_visuals_2d=self.get_visuals_2d,
mat_plot_2d=self.mat_plot_2d,
include_2d=self.include_2d,
visuals_2d=self.visuals_2d,
)

def get_visuals_2d(self) -> Visuals2D:
return self.get_2d.via_light_mass_obj_from(
light_mass_obj=self.galaxies, grid=self.grid
)

def get_visuals_2d_of_galaxy(self, galaxy_index: int) -> aplt.Visuals2D:
return self.get_2d.via_galaxies_from(
galaxies=self.galaxies, grid=self.grid, galaxy_index=galaxy_index
)

def galaxy_plotter_from(self, galaxy_index: int) -> GalaxyPlotter:
"""
Returns an `GalaxyPlotter` corresponding to a `Galaxy` in the `Tracer`.
Expand All @@ -118,8 +95,7 @@ def galaxy_plotter_from(self, galaxy_index: int) -> GalaxyPlotter:
galaxy=self.galaxies[galaxy_index],
grid=self.grid,
mat_plot_2d=self.mat_plot_2d,
visuals_2d=self.get_visuals_2d_of_galaxy(galaxy_index=galaxy_index),
include_2d=self.include_2d,
visuals_2d=self._mass_plotter.visuals_2d_with_critical_curves,
)

def figures_2d(
Expand Down Expand Up @@ -172,7 +148,7 @@ def figures_2d(
if image:
self.mat_plot_2d.plot_array(
array=self.galaxies.image_2d_from(grid=self.grid),
visuals_2d=self.get_visuals_2d(),
visuals_2d=self.visuals_2d,
auto_labels=aplt.AutoLabels(
title=f"Image{title_suffix}", filename=f"image_2d{filename_suffix}"
),
Expand All @@ -188,7 +164,7 @@ def figures_2d(
array=self.galaxies.plane_image_2d_from(
grid=self.grid, zoom_to_brightest=zoom_to_brightest
),
visuals_2d=self.get_visuals_2d(),
visuals_2d=self.visuals_2d,
auto_labels=aplt.AutoLabels(
title=title,
filename=f"plane_image{filename_suffix}",
Expand All @@ -203,7 +179,7 @@ def figures_2d(

self.mat_plot_2d.plot_grid(
grid=self.grid,
visuals_2d=self.get_visuals_2d(),
visuals_2d=self.visuals_2d,
auto_labels=aplt.AutoLabels(
title=title,
filename=f"plane_grid{filename_suffix}",
Expand Down
Loading
Loading