Skip to content

Commit

Permalink
Merge pull request #381 from lsst/tickets/DM-45144
Browse files Browse the repository at this point in the history
DM-45144: Fix support for weight arrays in AccumulatorMeanStack.add_masked_image()
  • Loading branch information
erykoff authored Jul 19, 2024
2 parents 7805677 + 0027f26 commit 034a557
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions python/lsst/meas/algorithms/accumulator_mean_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
__all__ = ['AccumulatorMeanStack']


class AccumulatorMeanStack(object):
class AccumulatorMeanStack:
"""Stack masked images.
Parameters
Expand Down Expand Up @@ -99,9 +99,8 @@ def add_masked_image(self, masked_image, weight=1.0):
----------
masked_image : `lsst.afw.image.MaskedImage`
Masked image to add to the stack.
weight : `float` or `np.ndarray`, optional
Weight to apply for weighted mean. If an array,
must be same size and shape as input masked_image.
weight : `float`, optional
Weight to apply for weighted mean.
"""
good_pixels = np.where(((masked_image.mask.array & self.bit_mask_value) == 0)
& np.isfinite(masked_image.mask.array))
Expand Down Expand Up @@ -187,9 +186,8 @@ def add_image(self, image, weight=1.0):
----------
image : `lsst.afw.image.Image`
Image to add to the stack.
weight : `float` or `np.ndarray`, optional
Weight to apply for weighted mean. If an array,
must be same size and shape as input image.
weight : `float`, optional
Weight to apply for weighted mean.
"""
self.sum_weight[:, :] += weight
self.sum_wdata[:, :] += weight*image.array[:]
Expand Down

0 comments on commit 034a557

Please sign in to comment.