Skip to content

Commit

Permalink
Transition to int32 for Masks
Browse files Browse the repository at this point in the history
The transition to int32 for Masks triggered a name change for masks.
Update to the new api.
  • Loading branch information
natelust committed Jul 6, 2017
1 parent b26cf08 commit 62730ba
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
14 changes: 7 additions & 7 deletions python/lsst/meas/algorithms/secondMomentStarSelector.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#
#
# LSST Data Management System
#
# Copyright 2008-2017 AURA/LSST.
#
#
# This product includes software developed by the
# LSST Project (http://www.lsst.org/).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
# see <https://www.lsstcorp.org/LegalNotices/>.
#
from builtins import range
Expand Down Expand Up @@ -421,7 +421,7 @@ def getClumps(self, sigma=1.0, display=False):
#
# Now measure that image, looking for the highest peak. Start by building an Exposure
#
msk = afwImage.MaskU(largeImg.getDimensions())
msk = afwImage.Mask(largeImg.getDimensions())
msk.set(0)
var = afwImage.ImageF(largeImg.getDimensions())
var.set(1)
Expand Down
14 changes: 7 additions & 7 deletions python/lsst/meas/algorithms/subtractBackground.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#
#
# LSST Data Management System
#
# Copyright 2008-2017 AURA/LSST.
#
#
# This product includes software developed by the
# LSST Project (http://www.lsst.org/).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
# see <https://www.lsstcorp.org/LegalNotices/>.
#
__all__ = ("SubtractBackgroundConfig", "SubtractBackgroundTask")
Expand Down Expand Up @@ -88,7 +88,7 @@ class SubtractBackgroundConfig(pexConfig.Config):
ignoredPixelMask = pexConfig.ListField(
doc="Names of mask planes to ignore while estimating the background",
dtype=str, default=["BAD", "EDGE", "DETECTED", "DETECTED_NEGATIVE", "NO_DATA", ],
itemCheck=lambda x: x in afwImage.MaskU().getMaskPlaneDict().keys(),
itemCheck=lambda x: x in afwImage.Mask().getMaskPlaneDict().keys(),
)
isNanSafe = pexConfig.Field(
doc="Ignore NaNs when estimating the background",
Expand Down
14 changes: 7 additions & 7 deletions python/lsst/meas/algorithms/testUtils.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#
#
# LSST Data Management System
#
# Copyright 2008-2017 AURA/LSST.
#
#
# This product includes software developed by the
# LSST Project (http://www.lsst.org/).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
# see <https://www.lsstcorp.org/LegalNotices/>.
#
#!/usr/bin/env python
Expand Down Expand Up @@ -68,7 +68,7 @@ def plantSources(bbox, kwid, sky, coordList, addPoissonNoise=True):
imgArr[:] = numpy.random.poisson(imgArr)

# bundle into a maskedimage and an exposure
mask = afwImage.MaskU(bbox)
mask = afwImage.Mask(bbox)
var = img.convertFloat()
img -= sky
mimg = afwImage.MaskedImageF(img.convertFloat(), mask, var)
Expand Down
4 changes: 2 additions & 2 deletions tests/testPsfSelectTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,14 @@ def plantSources(x0, y0, nx, ny, sky, nObj, wid, detector, useRandom=False):
noise0.set(i, j, np.random.poisson(img0.get(i, j)))

edgeWidth = int(0.5*edgeBuffer)
mask = afwImage.MaskU(afwGeom.ExtentI(nx, ny))
mask = afwImage.Mask(afwGeom.ExtentI(nx, ny))
left = afwGeom.Box2I(afwGeom.Point2I(0, 0), afwGeom.ExtentI(edgeWidth, ny))
right = afwGeom.Box2I(afwGeom.Point2I(nx - edgeWidth, 0), afwGeom.ExtentI(edgeWidth, ny))
top = afwGeom.Box2I(afwGeom.Point2I(0, ny - edgeWidth), afwGeom.ExtentI(nx, edgeWidth))
bottom = afwGeom.Box2I(afwGeom.Point2I(0, 0), afwGeom.ExtentI(nx, edgeWidth))

for pos in [left, right, top, bottom]:
msk = afwImage.MaskU(mask, pos, deep=False)
msk = afwImage.Mask(mask, pos, deep=False)
msk.set(msk.getPlaneBitMask('EDGE'))

expos = afwImage.makeExposure(afwImage.makeMaskedImage(noise, mask, afwImage.ImageF(noise, True)))
Expand Down

0 comments on commit 62730ba

Please sign in to comment.