29 __all__ = [
"CameraTests"]
34 Tests that the butler returns a useable Camera. 36 In the subclasses's setUp(): 37 * Call setUp_camera() to fill in required parameters. 43 first_detector_name=None,
47 Set up the necessary variables for camera tests. 55 number of detectors in this camera 56 first_detector_name : `str` 57 name of the first detector in this camera 58 plate_scale : `lsst.afw.geom.Angle` 59 plate scale at center of focal plane, as angle-on-sky/mm 61 fields = [
'camera_name',
63 'first_detector_name',
66 CameraData = collections.namedtuple(
"CameraData", fields)
68 n_detectors=n_detectors,
69 first_detector_name=first_detector_name,
70 plate_scale=plate_scale,
74 """Simplest camera test: can we get a Camera instance, and does iterating return Detectors?""" 75 camera = self.butler.get(
'camera', immediate=
True)
77 for detector
in camera:
78 msg =
"Failed for detector={}".
format(detector)
82 """Check that the butler returns the right type of camera.""" 83 camera = self.butler.get(
'camera', immediate=
True)
84 self.assertEqual(camera.getName(), self.
camera_data.camera_name)
85 self.assertEqual(len(camera), self.
camera_data.n_detectors)
86 self.assertEqual(next(iter(camera)).getName(), self.
camera_data.first_detector_name)
89 """Check the plate scale at center of focal plane 91 Check plate_scale using the FOCAL_PLANE to FIELD_ANGLE transform 95 self.assertIsNotNone(plate_scale)
96 camera = self.butler.get(
'camera', immediate=
True)
97 focalPlaneToFieldAngle = camera.getTransformMap().getTransform(FOCAL_PLANE, FIELD_ANGLE)
98 focalPlaneRadiusMm = 0.001
99 for offsetAngleRad
in (0.0, 0.65, 1.3):
100 cosAng = math.cos(offsetAngleRad)
101 sinAng = math.sin(offsetAngleRad)
102 fieldAngleRadians = focalPlaneToFieldAngle.applyForward(
104 fieldAngleRadius = math.hypot(*fieldAngleRadians) * lsst.afw.geom.radians
105 measuredScale1 = fieldAngleRadius / focalPlaneRadiusMm
106 self.assertAnglesAlmostEqual(measuredScale1, plate_scale)
108 focalPlanePos = focalPlaneToFieldAngle.applyInverse(
110 fieldAngleRadius.asRadians() * sinAng))
111 focalPlaneRadiusMm2 = math.hypot(*focalPlanePos)
112 measureScale2 = fieldAngleRadius / focalPlaneRadiusMm2
113 self.assertAnglesAlmostEqual(measureScale2, plate_scale)
def setUp_camera(self, camera_name=None, n_detectors=None, first_detector_name=None, plate_scale=None)
A collection of Detectors plus additional coordinate system support.
def test_plate_scale(self)
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Information about a CCD or other imaging detector.
def test_camera_butler(self)