Skip to content

Commit

Permalink
write proto to setup mask for interpolated pixels
Browse files Browse the repository at this point in the history
  • Loading branch information
PFLeget committed May 28, 2024
1 parent ef0acd3 commit 2827028
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions python/lsst/meas/algorithms/gp_interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ def jax_rbf_h(x1, x2, sigma, correlation_length):
K = (sigma**2) * jnp.exp(-0.5 * l1 / (correlation_length**2))
return K

def updateMaskFromArray(mask, bad_pixel, interpBit):

Check failure on line 81 in python/lsst/meas/algorithms/gp_interpolation.py

View workflow job for this annotation

GitHub Actions / call-workflow / lint

E302

expected 2 blank lines, found 1
x0 = mask.getX0()

Check failure on line 82 in python/lsst/meas/algorithms/gp_interpolation.py

View workflow job for this annotation

GitHub Actions / call-workflow / lint

E117

over-indented
y0 = mask.getY0()
for row in bad_pixel:
x = int(row[0] - x0)
y = int(row[1] - y0)
mask.array[x, y] |= interpBit

class GaussianProcessJax:

Check failure on line 89 in python/lsst/meas/algorithms/gp_interpolation.py

View workflow job for this annotation

GitHub Actions / call-workflow / lint

E302

expected 2 blank lines, found 1
def __init__(self, std=1.0, correlation_length=1.0, white_noise=0.0, mean=0.0):
Expand Down Expand Up @@ -239,6 +246,8 @@ def __init__(
self.defects = defects
self.correlation_length = fwhm

self.interpBit = self.maskedImage.mask.getPlaneBitMask("INTRP")

def interpolate_over_defects(self):
"""
Interpolates over defects using the spanset method.
Expand Down Expand Up @@ -345,6 +354,7 @@ def interpolate_sub_masked_image(self, sub_masked_image):

# update_value
ctUtils.updateImageFromArray(sub_masked_image.image, bad_pixel)
updateMaskFromArray(sub_masked_image.mask, bad_pixel, self.interpBit)
return sub_masked_image

def interpolateOverDefectsGP(image, fwhm, badList, method="treegp", bin_spacing=15, threshold_subdivide=20000):
Expand Down

0 comments on commit 2827028

Please sign in to comment.