Skip to content

Commit

Permalink
fixup: make a deep copy on a need-to basis
Browse files Browse the repository at this point in the history
  • Loading branch information
arunkannawadi committed Dec 20, 2023
1 parent eee0916 commit 93e1726
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion python/lsst/meas/extensions/shapeHSM/_hsm_higher_moments.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,13 @@ def measure(self, record, exposure):
bitValue = exposure.mask.getPlaneBitMask(self.config.badMaskPlanes)
badpix = (exposure.mask[bbox].array & bitValue) != 0

# Make a deep copy only if any of the pixels are masked are bad ones.
deep = badpix.any()

# Measure all the moments together to save time
try:
hm_measurement = self._calculate_higher_order_moments(
exposure.image[bbox],
exposure.image[bbox].copy(deep=deep),
center,
M,
badpix,
Expand Down

0 comments on commit 93e1726

Please sign in to comment.