LSST Applications g0f08755f38+9c285cab97,g1635faa6d4+13f3999e92,g1653933729+a8ce1bb630,g1a0ca8cf93+bf6eb00ceb,g28da252d5a+0829b12dee,g29321ee8c0+5700dc9eac,g2bbee38e9b+9634bc57db,g2bc492864f+9634bc57db,g2cdde0e794+c2c89b37c4,g3156d2b45e+41e33cbcdc,g347aa1857d+9634bc57db,g35bb328faa+a8ce1bb630,g3a166c0a6a+9634bc57db,g3e281a1b8c+9f2c4e2fc3,g414038480c+077ccc18e7,g41af890bb2+fde0dd39b6,g5fbc88fb19+17cd334064,g781aacb6e4+a8ce1bb630,g80478fca09+55a9465950,g82479be7b0+d730eedb7d,g858d7b2824+9c285cab97,g9125e01d80+a8ce1bb630,g9726552aa6+10f999ec6a,ga5288a1d22+2a84bb7594,gacf8899fa4+c69c5206e8,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gc28159a63d+9634bc57db,gcf0d15dbbd+4b7d09cae4,gda3e153d99+9c285cab97,gda6a2b7d83+4b7d09cae4,gdaeeff99f8+1711a396fd,ge2409df99d+5e831397f4,ge79ae78c31+9634bc57db,gf0baf85859+147a0692ba,gf3967379c6+41c94011de,gf3fb38a9a8+8f07a9901b,gfb92a5be7c+9c285cab97,w.2024.46
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