From 9d84dd34af2bd3650217231a00eb30ded29b9a9d Mon Sep 17 00:00:00 2001 From: ivenzor Date: Mon, 4 Nov 2024 23:52:38 -0600 Subject: [PATCH 1/2] Explicitly handle cases where data_cutout is None to prevent EXOTIC from crashing due to """ TypeError: unsupported operand type(s) for -: 'NoneType' and 'float'. """ --- exotic/exotic.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/exotic/exotic.py b/exotic/exotic.py index 8dc4d9b3..70fa219c 100644 --- a/exotic/exotic.py +++ b/exotic/exotic.py @@ -1245,16 +1245,28 @@ def fcn2min(pars): # Method calculates the flux of the star (uses the skybg_phot method to do background sub) def aperPhot(data, starIndex, xc, yc, r=5, dr=5): - if dr > 0 and not np.isnan(xc) and not np.isnan(yc): + # Check for invalid coordinates + if np.isnan(xc) or np.isnan(yc): + return 0, 0 + + # Calculate background if dr > 0 + if dr > 0: bgflux, sigmabg, Nbg = skybg_phot(data, starIndex, xc, yc, r + 2, dr) else: bgflux, sigmabg, Nbg = 0, 0, 0 - + + # Create aperture and mask aperture = CircularAperture(positions=[(xc, yc)], r=r) mask = aperture.to_mask(method='exact')[0] data_cutout = mask.cutout(data) + + # Check if aperture is valid + if data_cutout is None: + # Aperture is partially or fully outside the image + return 0, bgflux # Return zero flux but valid background + + # Calculate and return aperture sum aperture_sum = (mask.data * (data_cutout - bgflux)).sum() - return aperture_sum, bgflux From a40610417fb93da0c39e2ce87e192fc1a891c988 Mon Sep 17 00:00:00 2001 From: John Engelke <52300928+jpl-jengelke@users.noreply.github.com> Date: Tue, 5 Nov 2024 09:34:46 -0800 Subject: [PATCH 2/2] Issue #1322: Rev version for latest Hotfix release --- exotic/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exotic/version.py b/exotic/version.py index 73879cc1..c2a714dd 100644 --- a/exotic/version.py +++ b/exotic/version.py @@ -1 +1 @@ -__version__ = '4.2.2' +__version__ = '4.2.3'