From 0d802dfe6bcbbeaa97d0f7fbb67e552268e089e2 Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Mon, 2 Sep 2024 17:13:49 +0100 Subject: [PATCH] fully tested --- autogalaxy/aggregator/ellipse/fit_ellipse.py | 14 +++++++++++--- autogalaxy/aggregator/ellipse/multipoles.py | 4 ++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/autogalaxy/aggregator/ellipse/fit_ellipse.py b/autogalaxy/aggregator/ellipse/fit_ellipse.py index 71824ce9..511422eb 100644 --- a/autogalaxy/aggregator/ellipse/fit_ellipse.py +++ b/autogalaxy/aggregator/ellipse/fit_ellipse.py @@ -8,7 +8,7 @@ from autogalaxy.aggregator.imaging.imaging import _imaging_from from autogalaxy.aggregator.ellipse.ellipses import _ellipses_from -from autogalaxy.aggregator.ellipse.multipoles import _multipole_list_from +from autogalaxy.aggregator.ellipse.multipoles import _multipoles_from def _fit_ellipse_from( @@ -49,11 +49,19 @@ def _fit_ellipse_from( dataset_list = _imaging_from(fit=fit) ellipse_list_list = _ellipses_from(fit=fit, instance=instance) - multipole_list_list = _multipole_list_from(fit=fit, instance=instance) + + try: + multipole_list_list = _multipoles_from(fit=fit, instance=instance) + except AttributeError: + multipole_list_list = [[None] * len(ellipse_list_list)] * len( + ellipse_list_list[0] + ) fit_dataset_list = [] - for dataset, ellipse_list, multipole_lists in zip(dataset_list, ellipse_list_list, multipole_list_list): + for dataset, ellipse_list, multipole_lists in zip( + dataset_list, ellipse_list_list, multipole_list_list + ): for ellipse, multipole_list in zip(ellipse_list, multipole_lists): fit_dataset_list.append( FitEllipse( diff --git a/autogalaxy/aggregator/ellipse/multipoles.py b/autogalaxy/aggregator/ellipse/multipoles.py index 561847fb..ece37b7d 100644 --- a/autogalaxy/aggregator/ellipse/multipoles.py +++ b/autogalaxy/aggregator/ellipse/multipoles.py @@ -11,7 +11,7 @@ logger = logging.getLogger(__name__) -def _multipole_list_from( +def _multipoles_from( fit: af.Fit, instance: af.ModelInstance ) -> List[List[List[EllipseMultipole]]]: """ @@ -107,4 +107,4 @@ def object_via_gen_from( A manual instance that overwrites the max log likelihood instance in fit (e.g. for drawing the instance randomly from the PDF). """ - return _multipole_list_from(fit=fit, instance=instance) + return _multipoles_from(fit=fit, instance=instance)