Skip to content

Commit

Permalink
fixed masked intensity bug
Browse files Browse the repository at this point in the history
  • Loading branch information
dvida committed Aug 9, 2024
1 parent b2e1870 commit 2ec40d3
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Utils/SkyFit2.py
Original file line number Diff line number Diff line change
Expand Up @@ -5059,7 +5059,14 @@ def computeIntensitySum(self):

# Compute the background subtracted intensity sum (do as a float to avoid artificially pumping
# up the magnitude)
pick['intensity_sum'] = np.ma.sum(crop_img.astype(float) - background_lvl).astype(int)
intensity_sum = np.ma.sum(crop_img.astype(float) - background_lvl)

# Check if the result is masked
if np.ma.is_masked(intensity_sum):
# If the result is masked (i.e. error reading pixels), set the intensity sum to 1
intensity_sum = 1
else:
intensity_sum = intensity_sum.astype(int)


# If the DFN image is used, correct intensity sum for exposure difference
Expand Down Expand Up @@ -5341,6 +5348,10 @@ def saveFTPdetectinfo(self):
# If the global shutter is used, the frame number can only be an integer
if self.config.deinterlace_order == -2:
frame_no = round(frame_no, 0)

# If the intensity sum is masked, assume it's 1
if np.ma.is_masked(pick['intensity_sum']):
pick['intensity_sum'] = 1

centroids.append([frame_no, pick['x_centroid'], pick['y_centroid'], pick['intensity_sum']])

Expand Down

0 comments on commit 2ec40d3

Please sign in to comment.