Coverage for tests/test_coaddPsf.py: 8%
330 statements
« prev ^ index » next coverage.py v6.5.0, created at 2022-11-19 10:17 +0000
« prev ^ index » next coverage.py v6.5.0, created at 2022-11-19 10:17 +0000
1#
2# LSST Data Management System
3#
4# Copyright 2008-2017 AURA/LSST.
5#
6# This product includes software developed by the
7# LSST Project (http://www.lsst.org/).
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the LSST License Statement and
20# the GNU General Public License along with this program. If not,
21# see <https://www.lsstcorp.org/LegalNotices/>.
22#
23import unittest
25import lsst.geom
26import lsst.afw.geom as afwGeom
27import lsst.afw.math as afwMath
28import lsst.afw.table as afwTable
29import lsst.meas.algorithms as measAlg
30import lsst.pex.exceptions as pexExceptions
31import lsst.utils.tests
34def getPsfMoments(psf, point):
35 # import os, pdb; print "PID =", os.getpid(); pdb.set_trace()
36 image = psf.computeImage(point)
37 array = image.getArray()
38 sumx2 = 0.0
39 sumy2 = 0.0
40 sumy = 0.0
41 sumx = 0.0
42 sum = 0.0
43 for x in range(image.getWidth()):
44 for y in range(image.getHeight()):
45 f = array[y][x]
46 sumx2 += x*x*f
47 sumy2 += y*y*f
48 sumx += x*f
49 sumy += y*f
50 sum += f
51 xbar = sumx/sum
52 ybar = sumy/sum
53 mxx = sumx2 - 2*xbar*sumx + xbar*xbar*sum
54 myy = sumy2 - 2*ybar*sumy + ybar*ybar*sum
55 return sum, xbar, ybar, mxx, myy, image.getX0(), image.getY0()
58def getPsfSecondMoments(psf, point):
59 sum, xbar, ybar, mxx, myy, x0, y0 = getPsfMoments(psf, point)
60 return mxx, myy
63def makeBiaxialGaussianPsf(sizex, sizey, sigma1, sigma2, theta):
64 kernel = afwMath.AnalyticKernel(sizex, sizey, afwMath.GaussianFunction2D(sigma1, sigma2, theta))
65 return measAlg.KernelPsf(kernel)
67# This is a mock method for coadding the moments of the component Psfs at a point
68# Check that the coaddpsf passed in is really using the correct components and weighting them properly
69# The components in this case are all single gaussians, and we will just add the moments
70# If useValidPolygon = True then the exposures are expected to have validPolygons defined, otherwise
71# it will set the whoe region as valid
74def getCoaddSecondMoments(coaddpsf, point, useValidPolygon=False):
75 count = coaddpsf.getComponentCount()
76 coaddWcs = coaddpsf.getCoaddWcs()
77 weight_sum = 0.0
78 m1_sum = 0.0
79 m2_sum = 0.0
80 for i in range(count):
81 wcs = coaddpsf.getWcs(i)
82 psf = coaddpsf.getPsf(i)
83 bbox = lsst.geom.Box2D(coaddpsf.getBBox(i))
84 if useValidPolygon:
85 validPolygon = coaddpsf.getValidPolygon(i)
86 else:
87 validPolygon = afwGeom.Polygon(bbox)
89 point_rel = wcs.skyToPixel(coaddWcs.pixelToSky(lsst.geom.Point2D(point)))
90 if bbox.contains(point_rel) and validPolygon.contains(point_rel):
91 weight = coaddpsf.getWeight(i)
92 m0, xbar, ybar, mxx, myy, x0, y0 = getPsfMoments(psf, point) # , extent)
93 m1_sum += mxx*weight
94 m2_sum += myy*weight
95 weight_sum += weight
96 if weight_sum == 0.0:
97 return 0, 0
98 else:
99 return m1_sum/weight_sum, m2_sum/weight_sum
102class CoaddPsfTest(lsst.utils.tests.TestCase):
104 def setUp(self):
105 scale = 5.55555555e-05*lsst.geom.degrees
106 self.cdMatrix = afwGeom.makeCdMatrix(scale=scale, flipX=True)
107 self.crpix = lsst.geom.PointD(1000, 1000)
108 self.crval = lsst.geom.SpherePoint(0.0, 0.0, lsst.geom.degrees)
109 self.wcsref = afwGeom.makeSkyWcs(crpix=self.crpix, crval=self.crval, cdMatrix=self.cdMatrix)
111 schema = afwTable.ExposureTable.makeMinimalSchema()
112 self.weightKey = schema.addField("weight", type="D", doc="Coadd weight")
113 self.mycatalog = afwTable.ExposureCatalog(schema)
115 def tearDown(self):
116 del self.crpix
117 del self.crval
118 del self.wcsref
119 del self.weightKey
120 del self.mycatalog
122 # This is a test which checks to see that all of the ExposureCatalog rows are correctly
123 # ingested by the CoaddPsf constructor, and that they can be read back in the right order
124 # and with the right values
125 # The weightname mechanism is also tested. Whatever input column name is used should be
126 # mapped to "weight"
128 def testCreate(self):
129 """Check that we can create a CoaddPsf with 9 elements."""
130 print("CreatePsfTest")
132 # also test that the weight field name is correctly observed
133 schema = afwTable.ExposureTable.makeMinimalSchema()
134 schema.addField("customweightname", type="D", doc="Coadd weight")
135 mycatalog = afwTable.ExposureCatalog(schema)
137 # Each of the 9 has its peculiar Psf, Wcs, weight, and bounding box.
138 for i in range(1, 10, 1):
139 record = mycatalog.getTable().makeRecord()
140 psf = measAlg.DoubleGaussianPsf(100, 100, i, 1.00, 0.0)
141 record.setPsf(psf)
142 crpix = lsst.geom.PointD(i*1000.0, i*1000.0)
143 wcs = afwGeom.makeSkyWcs(crpix=crpix, crval=self.crval, cdMatrix=self.cdMatrix)
145 record.setWcs(wcs)
146 record['customweightname'] = 1.0 * (i+1)
147 record['id'] = i
148 bbox = lsst.geom.Box2I(lsst.geom.Point2I(0, 0), lsst.geom.Extent2I(i*1000, i*1000))
149 record.setBBox(bbox)
150 mycatalog.append(record)
152 # create the coaddpsf
153 mypsf = measAlg.CoaddPsf(mycatalog, self.wcsref, 'customweightname')
155 # check to be sure that we got the right number of components, in the right order
156 self.assertEqual(mypsf.getComponentCount(), 9)
157 for i in range(1, 10, 1):
158 wcs = mypsf.getWcs(i-1)
159 psf = mypsf.getPsf(i-1)
160 bbox = mypsf.getBBox(i-1)
161 weight = mypsf.getWeight(i-1)
162 id = mypsf.getId(i-1)
163 self.assertEqual(i, id)
164 self.assertEqual(weight, 1.0*(i+1))
165 self.assertEqual(bbox.getBeginX(), 0)
166 self.assertEqual(bbox.getBeginY(), 0)
167 self.assertEqual(bbox.getEndX(), 1000 * i)
168 self.assertEqual(bbox.getEndY(), 1000 * i)
169 self.assertAlmostEqual(wcs.getPixelOrigin().getX(), (1000.0 * i))
170 self.assertAlmostEqual(wcs.getPixelOrigin().getY(), (1000.0 * i))
171 m0, xbar, ybar, mxx, myy, x0, y0 = getPsfMoments(psf, lsst.geom.Point2D(0, 0))
172 self.assertAlmostEqual(i*i, mxx, delta=0.01)
173 self.assertAlmostEqual(i*i, myy, delta=0.01)
175 def testFractionalPixel(self):
176 """Check that we can create a CoaddPsf with 10 elements."""
177 print("FractionalPixelTest")
178 cdMatrix = afwGeom.makeCdMatrix(
179 scale=5.55555555e-05*lsst.geom.degrees,
180 orientation=90*lsst.geom.degrees,
181 )
182 wcs = afwGeom.makeSkyWcs(crpix=self.crpix, crval=self.crval, cdMatrix=cdMatrix)
184 # make a single record with an oblong Psf
185 record = self.mycatalog.getTable().makeRecord()
186 psf = makeBiaxialGaussianPsf(100, 100, 6.0, 6.0, 0.0)
187 record.setPsf(psf)
188 record.setWcs(wcs)
189 record['weight'] = 1.0
190 record['id'] = 1
191 bbox = lsst.geom.Box2I(lsst.geom.Point2I(0, 0), lsst.geom.Extent2I(2000, 2000))
192 record.setBBox(bbox)
193 self.mycatalog.append(record)
194 mypsf = measAlg.CoaddPsf(self.mycatalog, self.wcsref)
195 psf.computeImage(lsst.geom.PointD(0.25, 0.75))
196 psf.computeImage(lsst.geom.PointD(0.25, 0.75))
197 psf.computeImage(lsst.geom.PointD(1000, 1000))
198 m0, xbar, ybar, mxx, myy, x0, y0 = getPsfMoments(psf, lsst.geom.Point2D(0.25, 0.75))
199 cm0, cxbar, cybar, cmxx, cmyy, cx0, cy0 = getPsfMoments(mypsf, lsst.geom.Point2D(0.25, 0.75))
200 self.assertAlmostEqual(x0+xbar, cx0+cxbar, delta=0.01)
201 self.assertAlmostEqual(y0+ybar, cy0+cybar, delta=0.01)
203 def testRotatePsf(self):
204 """Check that we can create a CoaddPsf with 10 elements."""
205 print("RotatePsfTest")
206 cdMatrix = afwGeom.makeCdMatrix(
207 scale=5.55555555e-05*lsst.geom.degrees,
208 orientation=90*lsst.geom.degrees,
209 flipX=True,
210 )
211 wcs = afwGeom.makeSkyWcs(crpix=self.crpix, crval=self.crval, cdMatrix=cdMatrix)
213 # make a single record with an oblong Psf
214 record = self.mycatalog.getTable().makeRecord()
215 psf = makeBiaxialGaussianPsf(100, 100, 1.0, 6.0, 0.0)
216 record.setPsf(psf)
217 record.setWcs(wcs)
218 record['weight'] = 1.0
219 record['id'] = 1
220 bbox = lsst.geom.Box2I(lsst.geom.Point2I(0, 0), lsst.geom.Extent2I(2000, 2000))
221 record.setBBox(bbox)
222 self.mycatalog.append(record)
223 mypsf = measAlg.CoaddPsf(self.mycatalog, self.wcsref)
224 m0, xbar, ybar, mxx, myy, x0, y0 = getPsfMoments(psf, lsst.geom.Point2D(0.25, 0.75))
225 cm0, cxbar, cybar, cmxx, cmyy, cx0, cy0 = getPsfMoments(mypsf, lsst.geom.Point2D(0.25, 0.75))
226 self.assertAlmostEqual(mxx, cmyy, delta=0.01)
227 self.assertAlmostEqual(myy, cmxx, delta=0.01)
229 def testDefaultSize(self):
230 """Test of both default size and specified size."""
231 print("DefaultSizeTest")
232 sigma0 = 5
233 # set the peak of the outer guassian to 0 so this is really a single gaussian.
235 psf = measAlg.DoubleGaussianPsf(60, 60, 1.5*sigma0, 1, 0.0)
237 # Now make the catalog
238 record = self.mycatalog.getTable().makeRecord()
239 psf = measAlg.DoubleGaussianPsf(100, 100, 10.0, 1.00, 1.0)
240 record.setPsf(psf)
241 wcs = afwGeom.makeSkyWcs(crpix=self.crpix, crval=self.crval, cdMatrix=self.cdMatrix)
242 record.setWcs(wcs)
243 record['weight'] = 1.0
244 record['id'] = 1
245 bbox = lsst.geom.Box2I(lsst.geom.Point2I(0, 0), lsst.geom.Extent2I(2000, 2000))
246 record.setBBox(bbox)
247 self.mycatalog.append(record)
249 mypsf = measAlg.CoaddPsf(self.mycatalog, self.wcsref) # , 'weight')
251 m1coadd, m2coadd = getCoaddSecondMoments(mypsf, lsst.geom.Point2D(0, 0))
252 m1, m2 = getPsfSecondMoments(mypsf, lsst.geom.Point2D(1000, 1000))
253 self.assertAlmostEqual(m1, m1coadd, delta=.01)
254 self.assertAlmostEqual(m2, m2coadd, delta=.01)
256 def testSimpleGaussian(self):
257 """Check that we can measure a single Gaussian's attributes."""
258 print("SimpleGaussianTest")
259 sigma0 = 5
260 # set the peak of the outer guassian to 0 so this is really a single gaussian.
262 psf = measAlg.DoubleGaussianPsf(60, 60, 1.5*sigma0, 1, 0.0)
264 sigma = [5, 6, 7, 8] # 5 pixels is the same as a sigma of 1 arcsec.
266 # lay down a simple pattern of four ccds, set in a pattern of 1000 pixels around the center
267 offsets = [(1999, 1999), (1999, 0), (0, 0), (0, 1999)]
269# Imagine a ccd in each of positions +-1000 pixels from the center
270 for i in range(4):
271 record = self.mycatalog.getTable().makeRecord()
272 psf = measAlg.DoubleGaussianPsf(100, 100, sigma[i], 1.00, 1.0)
273 record.setPsf(psf)
274 crpix = lsst.geom.PointD(offsets[i][0], offsets[i][1])
275 wcs = afwGeom.makeSkyWcs(crpix=crpix, crval=self.crval, cdMatrix=self.cdMatrix)
276 record.setWcs(wcs)
277 record['weight'] = 1.0
278 record['id'] = i
279 bbox = lsst.geom.Box2I(lsst.geom.Point2I(0, 0), lsst.geom.Extent2I(2000, 2000))
280 record.setBBox(bbox)
281 self.mycatalog.append(record)
283 mypsf = measAlg.CoaddPsf(self.mycatalog, self.wcsref) # , 'weight')
284 m1coadd, m2coadd = getCoaddSecondMoments(mypsf, lsst.geom.Point2D(1000, 1000))
286 m1, m2 = getPsfSecondMoments(mypsf, lsst.geom.Point2D(1000, 1000))
287 self.assertAlmostEqual(m1, m1coadd, delta=.01)
289 m1, m2 = getPsfSecondMoments(mypsf, lsst.geom.Point2D(1000, 1001))
290 m1coadd, m2coadd = getCoaddSecondMoments(mypsf, lsst.geom.Point2D(1000, 1001))
291 self.assertAlmostEqual(m1, m1coadd, delta=0.01)
293# This test checks to be sure that the weights are being applied correctly in doComputeImage
294# Since the 2nd moments are linear in the function value, we can simply weight the moments
295# and be sure that the resulting moments are correct
297 def testWeight(self):
298 """Check that we can measure a single Gaussian's attributes."""
299 print("WeightTest")
300 sigma0 = 5
301 # set the peak of the outer guassian to 0 so this is really a single gaussian.
303 psf = measAlg.DoubleGaussianPsf(60, 60, 1.5*sigma0, 1, 0.0)
305 sigma = [5, 6, 7, 8] # 5 pixels is the same as a sigma of 1 arcsec.
307 # lay down a simple pattern of four ccds, set in a pattern of 1000 pixels around the center
308 offsets = [(1999, 1999), (1999, 0), (0, 0), (0, 1999)]
310# Imagine a ccd in each of positions +-1000 pixels from the center
311 for i in range(4):
312 record = self.mycatalog.getTable().makeRecord()
313 psf = measAlg.DoubleGaussianPsf(100, 100, sigma[i], 1.00, 0.0)
314 record.setPsf(psf)
315 crpix = lsst.geom.PointD(offsets[i][0], offsets[i][1])
316 wcs = afwGeom.makeSkyWcs(crpix=crpix, crval=self.crval, cdMatrix=self.cdMatrix)
318 # print out the coorinates of this supposed 2000x2000 ccd in wcsref coordinates
319 record.setWcs(wcs)
320 record['weight'] = 1.0 * (i+1)
321 record['id'] = i
322 bbox = lsst.geom.Box2I(lsst.geom.Point2I(0, 0), lsst.geom.Extent2I(2000, 2000))
323 record.setBBox(bbox)
324 self.mycatalog.append(record)
326 mypsf = measAlg.CoaddPsf(self.mycatalog, self.wcsref) # , 'weight')
328 m1, m2 = getPsfSecondMoments(mypsf, lsst.geom.Point2D(1000, 1000))
329 m1coadd, m2coadd = getCoaddSecondMoments(mypsf, lsst.geom.Point2D(1000, 1000))
330 self.assertAlmostEqual(m1, m1coadd, delta=0.01)
332 m1, m2 = getPsfSecondMoments(mypsf, lsst.geom.Point2D(1000, 1001))
333 m1coadd, m2coadd = getCoaddSecondMoments(mypsf, lsst.geom.Point2D(1000, 1001))
334 self.assertAlmostEqual(m1, m1coadd, delta=0.01)
336 m1, m2 = getCoaddSecondMoments(mypsf, lsst.geom.Point2D(1001, 1000))
337 m1coadd, m2coadd = getCoaddSecondMoments(mypsf, lsst.geom.Point2D(1001, 1000))
338 self.assertAlmostEqual(m1, m1coadd, delta=0.01)
340 def testTicket2872(self):
341 """Test that CoaddPsf.getAveragePosition() is always a position at which
342 we can call computeImage().
343 """
344 scale = 0.2*lsst.geom.arcseconds
345 cdMatrix = afwGeom.makeCdMatrix(scale=scale)
346 wcs = afwGeom.makeSkyWcs(
347 crpix=lsst.geom.Point2D(50, 50),
348 crval=lsst.geom.SpherePoint(45.0, 45.0, lsst.geom.degrees),
349 cdMatrix=cdMatrix,
350 )
351 kernel = measAlg.DoubleGaussianPsf(7, 7, 2.0).getKernel()
352 psf1 = measAlg.KernelPsf(kernel, lsst.geom.Point2D(0, 50))
353 psf2 = measAlg.KernelPsf(kernel, lsst.geom.Point2D(100, 50))
354 record1 = self.mycatalog.addNew()
355 record1.setPsf(psf1)
356 record1.setWcs(wcs)
357 record1.setD(self.weightKey, 1.0)
358 record1.setBBox(lsst.geom.Box2I(lsst.geom.Point2I(-40, 0), lsst.geom.Point2I(40, 100)))
359 record2 = self.mycatalog.addNew()
360 record2.setPsf(psf2)
361 record2.setWcs(wcs)
362 record2.setD(self.weightKey, 1.0)
363 record2.setBBox(lsst.geom.Box2I(lsst.geom.Point2I(60, 0), lsst.geom.Point2I(140, 100)))
364 coaddPsf = measAlg.CoaddPsf(self.mycatalog, wcs)
365 naiveAvgPos = lsst.geom.Point2D(50, 50)
366 with self.assertRaises(pexExceptions.InvalidParameterError):
367 coaddPsf.computeKernelImage(naiveAvgPos)
368 # important test is that this doesn't throw:
369 coaddPsf.computeKernelImage(coaddPsf.getAveragePosition())
371 def testValidPolygonPsf(self):
372 """Demonstrate that we can use the validPolygon on Exposures in the CoaddPsf."""
373 # Create 9 separate records, each with its own peculiar Psf, Wcs,
374 # weight, bounding box, and valid region.
375 for i in range(1, 10):
376 record = self.mycatalog.getTable().makeRecord()
377 record.setPsf(measAlg.DoubleGaussianPsf(100, 100, i, 1.00, 0.0))
378 crpix = lsst.geom.PointD(1000-10.0*i, 1000.0-10.0*i)
379 wcs = afwGeom.makeSkyWcs(crpix=crpix, crval=self.crval, cdMatrix=self.cdMatrix)
380 record.setWcs(wcs)
381 record['weight'] = 1.0*(i + 1)
382 record['id'] = i
383 record.setBBox(lsst.geom.Box2I(lsst.geom.Point2I(0, 0), lsst.geom.Extent2I(1000, 1000)))
384 validPolygon = afwGeom.Polygon(lsst.geom.Box2D(lsst.geom.Point2D(0, 0),
385 lsst.geom.Extent2D(i*100, i*100)))
386 record.setValidPolygon(validPolygon)
387 self.mycatalog.append(record)
389 # Create the CoaddPsf and check at three different points to ensure that the validPolygon is working
390 mypsf = measAlg.CoaddPsf(self.mycatalog, self.wcsref, 'weight')
392 for position in [lsst.geom.Point2D(50, 50), lsst.geom.Point2D(500, 500), lsst.geom.Point2D(850, 850)]:
393 m1coadd, m2coadd = getCoaddSecondMoments(mypsf, position, True)
394 m1, m2 = getPsfSecondMoments(mypsf, position)
395 self.assertAlmostEqual(m1, m1coadd, delta=0.01)
396 self.assertAlmostEqual(m2, m2coadd, delta=0.01)
398 def testGoodPix(self):
399 """Demonstrate that we can goodPix information in the CoaddPsf."""
400 bboxSize = lsst.geom.Extent2I(2000, 2000)
401 schema = afwTable.ExposureTable.makeMinimalSchema()
402 schema.addField("weight", type="D", doc="Coadd weight")
403 schema.addField("goodpix", type="I", doc="Number of good pixels")
404 mycatalog = afwTable.ExposureCatalog(schema)
406 # Create several records, each with its own peculiar center and numGoodPixels.
407 # Each PSF has the same shape and size, and the position offsets are small
408 # relative to the FWHM, in order to make it easy to predict the resulting
409 # weighted mean position.
410 xwsum = 0
411 ywsum = 0
412 wsum = 0
413 for i, (xOff, yOff, numGoodPix) in enumerate((
414 (30.0, -20.0, 25),
415 (32.0, -21.0, 10),
416 (28.0, -19.0, 30),
417 )):
418 xwsum -= xOff * numGoodPix
419 ywsum -= yOff * numGoodPix
420 wsum += numGoodPix
421 record = mycatalog.getTable().makeRecord()
422 record.setPsf(measAlg.DoubleGaussianPsf(25, 25, 10, 1.00, 0.0))
423 offPix = self.crpix + lsst.geom.Extent2D(xOff, yOff)
424 wcs = afwGeom.makeSkyWcs(crpix=offPix, crval=self.crval, cdMatrix=self.cdMatrix)
425 record.setWcs(wcs)
426 record['weight'] = 1.0
427 record['id'] = i
428 record['goodpix'] = numGoodPix
429 record.setBBox(lsst.geom.Box2I(lsst.geom.Point2I(0, 0), bboxSize))
430 mycatalog.append(record)
432 mypsf = measAlg.CoaddPsf(mycatalog, self.wcsref, 'weight')
433 predPos = lsst.geom.Point2D(xwsum/wsum, ywsum/wsum)
434 self.assertPairsAlmostEqual(predPos, mypsf.getAveragePosition())
436 def testBBox(self):
437 """Check that computeBBox returns same BBox as realized Kernel Image
439 and resized raises a Not Implemented Error"""
440 sigma0 = 5
441 size = [50, 60, 70, 80]
443 for i in range(4):
444 record = self.mycatalog.getTable().makeRecord()
445 psf = measAlg.DoubleGaussianPsf(size[i], size[i], sigma0, 1.00, 0.0)
446 record.setPsf(psf)
447 wcs = afwGeom.makeSkyWcs(crpix=self.crpix, crval=self.crval, cdMatrix=self.cdMatrix)
448 record.setWcs(wcs)
449 record['weight'] = 1.0 * (i + 1)
450 record['id'] = i
451 bbox = lsst.geom.Box2I(lsst.geom.Point2I(0, 0), lsst.geom.Extent2I(2000, 2000))
452 record.setBBox(bbox)
453 self.mycatalog.append(record)
455 mypsf = measAlg.CoaddPsf(self.mycatalog, self.wcsref, 'weight')
457 self.assertEqual(mypsf.computeKernelImage().getBBox(), mypsf.computeBBox())
459 with self.assertRaises(pexExceptions.LogicError):
460 mypsf.resized(100, 100)
462 def testLargeTransform(self):
463 """Test that images with bad astrometry are identified"""
464 multiplier = 1000.0 # CD matrix multiplier for bad input
465 badId = 1 # ID of bad input
466 for ii in range(3):
467 record = self.mycatalog.addNew()
468 record.setPsf(measAlg.DoubleGaussianPsf(50, 50, 5.0, 1.00, 0.0))
469 cdMatrix = self.cdMatrix
470 if ii == badId:
471 # This image has bad astrometry:
472 cdMatrix *= multiplier
473 record['id'] = ii
474 record['weight'] = 1.0
475 record.setWcs(afwGeom.makeSkyWcs(crpix=self.crpix, crval=self.crval, cdMatrix=cdMatrix))
476 record.setBBox(lsst.geom.Box2I(lsst.geom.Point2I(0, 0), lsst.geom.Extent2I(2000, 2000)))
478 coaddPsf = measAlg.CoaddPsf(self.mycatalog, self.wcsref)
479 with self.assertRaises(pexExceptions.RangeError) as cm:
480 coaddPsf.computeKernelImage()
481 self.assertIn("id=%d" % (badId,), str(cm.exception))
484class TestMemory(lsst.utils.tests.MemoryTestCase):
485 pass
488def setup_module(module):
489 lsst.utils.tests.init()
492if __name__ == "__main__": 492 ↛ 493line 492 didn't jump to line 493, because the condition on line 492 was never true
493 lsst.utils.tests.init()
494 unittest.main()