LSST Applications g04e9c324dd+8c5ae1fdc5,g134cb467dc+1b3060144d,g18429d2f64+f642bf4753,g199a45376c+0ba108daf9,g1fd858c14a+2dcf163641,g262e1987ae+7b8c96d2ca,g29ae962dfc+3bd6ecb08a,g2cef7863aa+aef1011c0b,g35bb328faa+8c5ae1fdc5,g3fd5ace14f+53e1a9e7c5,g4595892280+fef73a337f,g47891489e3+2efcf17695,g4d44eb3520+642b70b07e,g53246c7159+8c5ae1fdc5,g67b6fd64d1+2efcf17695,g67fd3c3899+b70e05ef52,g74acd417e5+317eb4c7d4,g786e29fd12+668abc6043,g87389fa792+8856018cbb,g89139ef638+2efcf17695,g8d7436a09f+3be3c13596,g8ea07a8fe4+9f5ccc88ac,g90f42f885a+a4e7b16d9b,g97be763408+ad77d7208f,g9dd6db0277+b70e05ef52,ga681d05dcb+a3f46e7fff,gabf8522325+735880ea63,gac2eed3f23+2efcf17695,gb89ab40317+2efcf17695,gbf99507273+8c5ae1fdc5,gd8ff7fe66e+b70e05ef52,gdab6d2f7ff+317eb4c7d4,gdc713202bf+b70e05ef52,gdfd2d52018+b10e285e0f,ge365c994fd+310e8507c4,ge410e46f29+2efcf17695,geaed405ab2+562b3308c0,gffca2db377+8c5ae1fdc5,w.2025.35
LSST Data Management Base Package
Loading...
Searching...
No Matches
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 469 of file testUtils.py.

469def assertAmplifiersEqual(self, amp1, amp2):
470 self.assertEqual(amp1.getName(), amp2.getName())
471 self.assertEqual(amp1.getBBox(), amp2.getBBox())
472 self.assertFloatsEqual(amp1.getGain(), amp2.getGain(), ignoreNaNs=True)
473 self.assertFloatsEqual(amp1.getReadNoise(), amp2.getReadNoise(), ignoreNaNs=True)
474 self.assertFloatsEqual(amp1.getSaturation(), amp2.getSaturation(), ignoreNaNs=True)
475 self.assertEqual(amp1.getReadoutCorner(), amp2.getReadoutCorner())
476 self.assertFloatsEqual(amp1.getSuspectLevel(), amp2.getSuspectLevel(), ignoreNaNs=True)
477 self.assertEqual(amp1.getLinearityCoeffs().shape, amp2.getLinearityCoeffs().shape)
478 self.assertFloatsEqual(amp1.getLinearityCoeffs(), amp2.getLinearityCoeffs(), ignoreNaNs=True)
479 self.assertEqual(amp1.getLinearityType(), amp2.getLinearityType())
480 self.assertFloatsEqual(amp1.getLinearityThreshold(), amp2.getLinearityThreshold(), ignoreNaNs=True)
481 self.assertFloatsEqual(amp1.getLinearityMaximum(), amp2.getLinearityMaximum(), ignoreNaNs=True)
482 self.assertEqual(amp1.getLinearityUnits(), amp2.getLinearityUnits())
483 self.assertEqual(amp1.getRawBBox(), amp2.getRawBBox())
484 self.assertEqual(amp1.getRawDataBBox(), amp2.getRawDataBBox())
485 self.assertEqual(amp1.getRawFlipX(), amp2.getRawFlipX())
486 self.assertEqual(amp1.getRawFlipY(), amp2.getRawFlipY())
487 self.assertEqual(amp1.getRawHorizontalOverscanBBox(), amp2.getRawHorizontalOverscanBBox())
488 self.assertEqual(amp1.getRawVerticalOverscanBBox(), amp2.getRawVerticalOverscanBBox())
489 self.assertEqual(amp1.getRawPrescanBBox(), amp2.getRawPrescanBBox())
490
491
492@inTestCase

◆ assertCamerasEqual()

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

Definition at line 527 of file testUtils.py.

527def assertCamerasEqual(self, camera1, camera2, **kwds):
528 """Compare two Cameras.
529 """
530 self.assertDetectorCollectionsEqual(camera1, camera2, **kwds)
531 self.assertTransformMapsEqual(camera1.getTransformMap(), camera2.getTransformMap())
532 self.assertEqual(camera1.getName(), camera2.getName())
533 self.assertEqual(camera1.getPupilFactoryName(), camera2.getPupilFactoryName())
534 self.assertEqual(camera1.getFocalPlaneParity(), camera2.getFocalPlaneParity())

◆ assertDetectorCollectionsEqual()

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

Definition at line 518 of file testUtils.py.

518def assertDetectorCollectionsEqual(self, collection1, collection2, **kwds):
519 """Compare two DetectorCollections.
520 """
521 self.assertCountEqual(list(collection1.getNameIter()), list(collection2.getNameIter()))
522 for k in collection1.getNameIter():
523 self.assertDetectorsEqual(collection1[k], collection2[k], **kwds)
524
525
526@inTestCase

◆ assertDetectorsEqual()

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

Definition at line 493 of file testUtils.py.

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

◆ assertTransformMapsEqual()

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

Definition at line 455 of file testUtils.py.

455def assertTransformMapsEqual(self, map1, map2, **kwds):
456 """Compare two TransformMaps.
457 """
458 self.assertEqual(list(map1), list(map2)) # compares the sets of CameraSys
459 for sysFrom in map1:
460 for sysTo in map1:
461 with self.subTest(sysFrom=sysFrom, sysTo=sysTo):
462 transform1 = map1.getTransform(sysFrom, sysTo)
463 transform2 = map2.getTransform(sysFrom, sysTo)
464 self.compare2DFunctions(transform1.applyForward, transform2.applyForward, **kwds)
465 self.compare2DFunctions(transform1.applyInverse, transform2.applyInverse, **kwds)
466
467
468@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 428 of file testUtils.py.

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