LSST Applications g063fba187b+cac8b7c890,g0f08755f38+6aee506743,g1653933729+a8ce1bb630,g168dd56ebc+a8ce1bb630,g1a2382251a+b4475c5878,g1dcb35cd9c+8f9bc1652e,g20f6ffc8e0+6aee506743,g217e2c1bcf+73dee94bd0,g28da252d5a+1f19c529b9,g2bbee38e9b+3f2625acfc,g2bc492864f+3f2625acfc,g3156d2b45e+6e55a43351,g32e5bea42b+1bb94961c2,g347aa1857d+3f2625acfc,g35bb328faa+a8ce1bb630,g3a166c0a6a+3f2625acfc,g3e281a1b8c+c5dd892a6c,g3e8969e208+a8ce1bb630,g414038480c+5927e1bc1e,g41af890bb2+8a9e676b2a,g7af13505b9+809c143d88,g80478fca09+6ef8b1810f,g82479be7b0+f568feb641,g858d7b2824+6aee506743,g89c8672015+f4add4ffd5,g9125e01d80+a8ce1bb630,ga5288a1d22+2903d499ea,gb58c049af0+d64f4d3760,gc28159a63d+3f2625acfc,gcab2d0539d+b12535109e,gcf0d15dbbd+46a3f46ba9,gda6a2b7d83+46a3f46ba9,gdaeeff99f8+1711a396fd,ge79ae78c31+3f2625acfc,gef2f8181fd+0a71e47438,gf0baf85859+c1f95f4921,gfa517265be+6aee506743,gfa999e8aa5+17cd334064,w.2024.51
LSST Data Management Base Package
Loading...
Searching...
No Matches
Classes | Functions
lsst.afw.cameraGeom.testUtils Namespace Reference

Classes

class  CameraWrapper
 
class  DetectorWrapper
 

Functions

 compare2DFunctions (self, func1, func2, minVal=-10, maxVal=None, nVal=5)
 
 assertTransformMapsEqual (self, map1, map2, **kwds)
 
 assertAmplifiersEqual (self, amp1, amp2)
 
 assertDetectorsEqual (self, detector1, detector2, *compareTransforms=True, **kwds)
 
 assertDetectorCollectionsEqual (self, collection1, collection2, **kwds)
 
 assertCamerasEqual (self, camera1, camera2, **kwds)
 

Function Documentation

◆ assertAmplifiersEqual()

lsst.afw.cameraGeom.testUtils.assertAmplifiersEqual ( self,
amp1,
amp2 )

Definition at line 462 of file testUtils.py.

462def assertAmplifiersEqual(self, amp1, amp2):
463 self.assertEqual(amp1.getName(), amp2.getName())
464 self.assertEqual(amp1.getBBox(), amp2.getBBox())
465 self.assertFloatsEqual(amp1.getGain(), amp2.getGain(), ignoreNaNs=True)
466 self.assertFloatsEqual(amp1.getReadNoise(), amp2.getReadNoise(), ignoreNaNs=True)
467 self.assertFloatsEqual(amp1.getSaturation(), amp2.getSaturation(), ignoreNaNs=True)
468 self.assertEqual(amp1.getReadoutCorner(), amp2.getReadoutCorner())
469 self.assertFloatsEqual(amp1.getSuspectLevel(), amp2.getSuspectLevel(), ignoreNaNs=True)
470 self.assertEqual(amp1.getLinearityCoeffs().shape, amp2.getLinearityCoeffs().shape)
471 self.assertFloatsEqual(amp1.getLinearityCoeffs(), amp2.getLinearityCoeffs(), ignoreNaNs=True)
472 self.assertEqual(amp1.getLinearityType(), amp2.getLinearityType())
473 self.assertFloatsEqual(amp1.getLinearityThreshold(), amp2.getLinearityThreshold(), ignoreNaNs=True)
474 self.assertFloatsEqual(amp1.getLinearityMaximum(), amp2.getLinearityMaximum(), ignoreNaNs=True)
475 self.assertEqual(amp1.getLinearityUnits(), amp2.getLinearityUnits())
476 self.assertEqual(amp1.getRawBBox(), amp2.getRawBBox())
477 self.assertEqual(amp1.getRawDataBBox(), amp2.getRawDataBBox())
478 self.assertEqual(amp1.getRawFlipX(), amp2.getRawFlipX())
479 self.assertEqual(amp1.getRawFlipY(), amp2.getRawFlipY())
480 self.assertEqual(amp1.getRawHorizontalOverscanBBox(), amp2.getRawHorizontalOverscanBBox())
481 self.assertEqual(amp1.getRawVerticalOverscanBBox(), amp2.getRawVerticalOverscanBBox())
482 self.assertEqual(amp1.getRawPrescanBBox(), amp2.getRawPrescanBBox())
483
484
485@inTestCase

◆ assertCamerasEqual()

lsst.afw.cameraGeom.testUtils.assertCamerasEqual ( self,
camera1,
camera2,
** kwds )
Compare two Camers.

Definition at line 520 of file testUtils.py.

520def assertCamerasEqual(self, camera1, camera2, **kwds):
521 """Compare two Camers.
522 """
523 self.assertDetectorCollectionsEqual(camera1, camera2, **kwds)
524 self.assertTransformMapsEqual(camera1.getTransformMap(), camera2.getTransformMap())
525 self.assertEqual(camera1.getName(), camera2.getName())
526 self.assertEqual(camera1.getPupilFactoryName(), camera2.getPupilFactoryName())

◆ assertDetectorCollectionsEqual()

lsst.afw.cameraGeom.testUtils.assertDetectorCollectionsEqual ( self,
collection1,
collection2,
** kwds )
Compare two DetectorCollections.

Definition at line 511 of file testUtils.py.

511def assertDetectorCollectionsEqual(self, collection1, collection2, **kwds):
512 """Compare two DetectorCollections.
513 """
514 self.assertCountEqual(list(collection1.getNameIter()), list(collection2.getNameIter()))
515 for k in collection1.getNameIter():
516 self.assertDetectorsEqual(collection1[k], collection2[k], **kwds)
517
518
519@inTestCase

◆ assertDetectorsEqual()

lsst.afw.cameraGeom.testUtils.assertDetectorsEqual ( self,
detector1,
detector2,
* compareTransforms = True,
** kwds )
Compare two Detectors.

Definition at line 486 of file testUtils.py.

486def assertDetectorsEqual(self, detector1, detector2, *, compareTransforms=True, **kwds):
487 """Compare two Detectors.
488 """
489 self.assertEqual(detector1.getName(), detector2.getName())
490 self.assertEqual(detector1.getId(), detector2.getId())
491 self.assertEqual(detector1.getSerial(), detector2.getSerial())
492 self.assertEqual(detector1.getPhysicalType(), detector2.getPhysicalType())
493 self.assertEqual(detector1.getBBox(), detector2.getBBox())
494 self.assertEqual(detector1.getPixelSize(), detector2.getPixelSize())
495 orientationIn = detector1.getOrientation()
496 orientationOut = detector2.getOrientation()
497 self.assertEqual(orientationIn.getFpPosition(), orientationOut.getFpPosition())
498 self.assertEqual(orientationIn.getReferencePoint(), orientationOut.getReferencePoint())
499 self.assertEqual(orientationIn.getYaw(), orientationOut.getYaw())
500 self.assertEqual(orientationIn.getPitch(), orientationOut.getPitch())
501 self.assertEqual(orientationIn.getRoll(), orientationOut.getRoll())
502 self.assertFloatsEqual(detector1.getCrosstalk(), detector2.getCrosstalk())
503 if compareTransforms:
504 self.assertTransformMapsEqual(detector1.getTransformMap(), detector2.getTransformMap(), **kwds)
505 self.assertEqual(len(detector1.getAmplifiers()), len(detector2.getAmplifiers()))
506 for amp1, amp2 in zip(detector1.getAmplifiers(), detector2.getAmplifiers()):
507 self.assertAmplifiersEqual(amp1, amp2)
508
509
510@inTestCase

◆ assertTransformMapsEqual()

lsst.afw.cameraGeom.testUtils.assertTransformMapsEqual ( self,
map1,
map2,
** kwds )
Compare two TransformMaps.

Definition at line 448 of file testUtils.py.

448def assertTransformMapsEqual(self, map1, map2, **kwds):
449 """Compare two TransformMaps.
450 """
451 self.assertEqual(list(map1), list(map2)) # compares the sets of CameraSys
452 for sysFrom in map1:
453 for sysTo in map1:
454 with self.subTest(sysFrom=sysFrom, sysTo=sysTo):
455 transform1 = map1.getTransform(sysFrom, sysTo)
456 transform2 = map2.getTransform(sysFrom, sysTo)
457 self.compare2DFunctions(transform1.applyForward, transform2.applyForward, **kwds)
458 self.compare2DFunctions(transform1.applyInverse, transform2.applyInverse, **kwds)
459
460
461@inTestCase

◆ compare2DFunctions()

lsst.afw.cameraGeom.testUtils.compare2DFunctions ( self,
func1,
func2,
minVal = -10,
maxVal = None,
nVal = 5 )
Compare two Point2D(list(Point2D)) functions by evaluating them over a
range of values.

Notes
-----
Assumes the functions can be called with ``list[Point2D]`` and return
``list[Point2D]``.

Definition at line 421 of file testUtils.py.

421def compare2DFunctions(self, func1, func2, minVal=-10, maxVal=None, nVal=5):
422 """Compare two Point2D(list(Point2D)) functions by evaluating them over a
423 range of values.
424
425 Notes
426 -----
427 Assumes the functions can be called with ``list[Point2D]`` and return
428 ``list[Point2D]``.
429 """
430 if maxVal is None:
431 maxVal = -minVal
432 dVal = (maxVal - minVal) / (nVal - 1)
433 points = []
434 for xInd in range(nVal):
435 x = minVal + (xInd * dVal)
436 for yInd in range(nVal):
437 y = minVal + (yInd * dVal)
438 fromPoint = lsst.geom.Point2D(x, y)
439 points.append(fromPoint)
440
441 vres1 = func1(points)
442 vres2 = func2(points)
443 for res1, res2 in zip(vres1, vres2):
444 self.assertPairsAlmostEqual(res1, res2)
445
446
447@inTestCase