LSST Applications g07dc498a13+cb17356775,g1409bbee79+cb17356775,g1a7e361dbc+cb17356775,g1fd858c14a+d1a2a640a9,g33399d78f5+fe6948661d,g35bb328faa+e55fef2c71,g3bd4b5ce2c+cac9e18807,g3c79e8cd92+2359a18b76,g43bc871e57+a58ba40925,g53246c7159+e55fef2c71,g60b5630c4e+8133a3545f,g78460c75b0+8427c4cc8f,g78619a8342+55305cb8f0,g786e29fd12+307f82e6af,g8534526c7b+8e1c6b434f,g89139ef638+cb17356775,g8b49a6ea8e+8133a3545f,g8ffcb69f3d+818ab6c36e,g9125e01d80+e55fef2c71,g97b8272a79+98425f45f6,g989de1cb63+cb17356775,g9f33ca652e+4245ceb508,gaaedd4e678+cb17356775,gabe3b4be73+9c0c3c7524,gb1101e3267+3e5ef1d639,gb58c049af0+28045f66fd,gc1fe0db326+8133a3545f,gca43fec769+e55fef2c71,gcf25f946ba+fe6948661d,gd397e13551+64039f84ea,gd6cbbdb0b4+f6e5445f66,gde0f65d7ad+7eb368c542,ge278dab8ac+b4c2c8faf7,geab183fbe5+8133a3545f,gecb8035dfe+1f480bec5e,gefa07fa684+e7bc33f3ea,gf58bf46354+e55fef2c71,gfe7187db8c+e55afb4430,w.2025.03
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 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