Skip to content

Commit

Permalink
Remove vestigial if False blocks from footprint tests
Browse files Browse the repository at this point in the history
  • Loading branch information
parejkoj committed Jun 14, 2019
1 parent 42f5db5 commit 9c03b13
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 70 deletions.
61 changes: 0 additions & 61 deletions tests/test_footprint1.py
Expand Up @@ -265,12 +265,6 @@ def testFootprintFromBBox1(self):
self.assertEqual(bbox.getMaxX(), x0 + w - 1)
self.assertEqual(bbox.getMaxY(), y0 + h - 1)

if False:
idImage = afwImage.ImageU(w, h)
idImage.set(0)
foot.insertIntoImage(idImage, foot.getId(), bbox)
afwDisplay.Display(frame=2).mtv(idImage, title=self._testMethodName + " image")

def testGetBBox(self):
"""Check that Footprint.getBBox() returns a copy"""
x0, y0, w, h = 9, 10, 7, 4
Expand All @@ -285,25 +279,6 @@ def testGetBBox(self):
self.assertEqual(bbox.getMinX(), x0 + dx)
self.assertEqual(foot.getBBox().getMinX(), x0)

def testFootprintFromCircle(self):
"""Create an elliptical Footprint"""
ellipse = afwGeom.Ellipse(afwGeomEllipses.Axes(6, 6, 0),
lsst.geom.Point2D(9, 15))
spanSet = afwGeom.SpanSet.fromShape(ellipse)
foot = afwDetect.Footprint(spanSet,
lsst.geom.Box2I(lsst.geom.Point2I(0, 0),
lsst.geom.Extent2I(20, 30)))

idImage = afwImage.ImageU(
lsst.geom.Extent2I(foot.getRegion().getWidth(),
foot.getRegion().getHeight()))
idImage.set(0)

foot.spans.setImage(idImage, foot.getId())

if False:
afwDisplay.Display(frame=2).mtv(idImage, title=self._testMethodName + " image")

def testFootprintFromEllipse(self):
"""Create an elliptical Footprint"""
cen = lsst.geom.Point2D(23, 25)
Expand Down Expand Up @@ -541,19 +516,6 @@ def testGrow(self):

bbox2 = foot2.getBBox()

if False and display:
idImage = afwImage.ImageU(width, height)
idImage.set(0)

i = 1
for foot in [foot1, foot2]:
foot.insertIntoImage(idImage, i)
i += 1

metricImage = afwImage.ImageF("foo.fits")
afwDisplay.Display(frame=1).mtv(metricImage, title=self._testMethodName + ": Metric image")
afwDisplay.Display(frame=0).mtv(idImage, title=self._testMethodName + " image")

# check bbox2
self.assertEqual(bbox2.getMinX(), x0 - ngrow)
self.assertEqual(bbox2.getWidth(), width + 2*ngrow)
Expand Down Expand Up @@ -644,9 +606,6 @@ def testSetFromFootprint(self):
for obj in self.objects:
obj.insert(im)

if False and display:
afwDisplay.Display(frame=0).mtv(mi, title=self._testMethodName + " image")

ds = afwDetect.FootprintSet(mi, afwDetect.Threshold(15))

objects = ds.getFootprints()
Expand Down Expand Up @@ -928,17 +887,6 @@ def testMergeFootprints(self):
# merged == a1 | a2.
self.assertTrue(np.all(m == np.maximum(a1, a2)))

if False:
import matplotlib
matplotlib.use('Agg')
import pylab as plt
plt.clf()
for i, im1 in enumerate(ims):
plt.subplot(4, 1, i + 1)
plt.imshow(im1.getArray(), interpolation='nearest', origin='lower')
plt.axis([0, 100, 0, 20])
plt.savefig('merge2.png')

def testPeakSort(self):
spanSet = afwGeom.SpanSet(lsst.geom.Box2I(lsst.geom.Point2I(0, 0),
lsst.geom.Point2I(10, 10)))
Expand Down Expand Up @@ -1067,9 +1015,6 @@ def setUp(self):
for obj in self.objects:
obj.insert(im)

if False and display:
afwDisplay.Display(frame=0).mtv(im, title=self._testMethodName + " image")

def tearDown(self):
del self.ms

Expand Down Expand Up @@ -1142,9 +1087,6 @@ def testFootprintsImageId(self):
for i, foot in enumerate(objects):
foot.spans.setImage(idImage, i + 1)

if False:
afwDisplay.Display(frame=2).mtv(idImage, title=self._testMethodName + " image")

for i in range(len(objects)):
for sp in objects[i].getSpans():
for x in range(sp.getX0(), sp.getX1() + 1):
Expand Down Expand Up @@ -1273,9 +1215,6 @@ def setUp(self):
# connects the two objects with value==20 together if NaN is detected
im[9, 6, afwImage.LOCAL] = self.NaN

if False and display:
afwDisplay.Display(frame=0).mtv(im, title=self._testMethodName + " image")

def tearDown(self):
del self.ms

Expand Down
9 changes: 0 additions & 9 deletions tests/test_footprint2.py
Expand Up @@ -97,9 +97,6 @@ def setUp(self):
for obj in self.objects:
obj.insert(self.im)

if False and display:
afwDisplay.Display(frame=0).mtv(self.im, title=self._testMethodName + " image")

def tearDown(self):
del self.im

Expand Down Expand Up @@ -140,9 +137,6 @@ def testFootprintsImageId(self):
for i, foot in enumerate(objects):
foot.spans.setImage(idImage, i + 1)

if False:
afwDisplay.Display(frame=2).mtv(idImage, title=self._testMethodName + " image")

for i in range(len(objects)):
for sp in objects[i].getSpans():
for x in range(sp.getX0(), sp.getX1() + 1):
Expand Down Expand Up @@ -414,9 +408,6 @@ def doSetUp(self, dwidth=0, dheight=0, x0=0, y0=0):
for x, y, I in obj:
self.im.getImage()[x, y, afwImage.LOCAL] = I

if False and display:
afwDisplay.Display(frame=0).mtv(self.im, title=self._testMethodName + " image")

def setUp(self):
self.im, self.fs = None, None

Expand Down

0 comments on commit 9c03b13

Please sign in to comment.