Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release EXOTIC 4.2.3 Hotfix: Fix TypeError for noisy or drifting background imaging #1343

Merged
merged 4 commits into from
Nov 5, 2024
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
18 changes: 15 additions & 3 deletions exotic/exotic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion exotic/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '4.2.2'
__version__ = '4.2.3'