LSST Applications g0265f82a02+093ff98f47,g02d81e74bb+10352d6f39,g1f3e9fa97e+40b0fc677d,g2079a07aa2+14824f138e,g2bbee38e9b+093ff98f47,g337abbeb29+093ff98f47,g3ddfee87b4+064c02c7ee,g487adcacf7+7e842ebf4b,g50ff169b8f+5929b3527e,g52b1c1532d+a6fc98d2e7,g568d43a26c+1d7ac31cb0,g591dd9f2cf+fb1f69e2ea,g858d7b2824+10352d6f39,g8a8a8dda67+a6fc98d2e7,g8cdfe0ae6a+66d966b544,g99cad8db69+7ce8a7c20a,g9ddcbc5298+d4bad12328,ga1e77700b3+246acaaf9c,ga2e4dd1c03+064c02c7ee,ga8c6da7877+04f6ba86dc,gae46bcf261+093ff98f47,gb0e22166c9+3863383f4c,gba4ed39666+9664299f35,gbb8dafda3b+db40f59a7d,gbeb006f7da+e6a448e96d,gbf5cecdb8a+10352d6f39,gc0f3af6251+10a3fd39cd,gc120e1dc64+5839e50a77,gc28159a63d+093ff98f47,gcf0d15dbbd+064c02c7ee,gd2a12a3803+0c2c227a2b,gdaeeff99f8+a38ce5ea23,ge79ae78c31+093ff98f47,gee10cc3b42+a6fc98d2e7,gf1cff7945b+10352d6f39,w.2024.15
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