4 from .cameraGeomLib
import FOCAL_PLANE, PUPIL, PIXELS, TAN_PIXELS, ACTUAL_PIXELS, CameraSys, \
5 Detector, Orientation, CameraTransformMap
6 from .camera
import Camera
7 from .makePixelToTanPixel
import makePixelToTanPixel
9 __all__ = [
"makeCameraFromPath",
"makeCameraFromCatalogs",
"makeDetector"]
11 cameraSysList = [PUPIL, FOCAL_PLANE, PIXELS, TAN_PIXELS, ACTUAL_PIXELS]
12 cameraSysMap = dict((sys.getSysName(), sys)
for sys
in cameraSysList)
14 def makeDetector(detectorConfig, ampInfoCatalog, focalPlaneToPupil, plateScale):
15 """Make a detector object:
17 @param detectorConfig -- config for this detector (an lsst.pex.config.Config)
18 @param ampInfoCatalog -- amplifier information for this detector (an lsst.afw.table.AmpInfoCatalog)
19 @param focalPlaneToPupil -- FOCAL_PLANE to PUPIL XYTransform
20 @param plateScale -- nominal plate scale (arcsec/mm)
21 @return detector (an lsst.afw.cameraGeom.Detector)
24 pixelSizeMm =
afwGeom.Extent2D(detectorConfig.pixelSize_x, detectorConfig.pixelSize_y)
26 transforms[FOCAL_PLANE] = orientation.makePixelFpTransform(pixelSizeMm)
28 llPoint =
afwGeom.Point2I(detectorConfig.bbox_x0, detectorConfig.bbox_y0)
29 urPoint =
afwGeom.Point2I(detectorConfig.bbox_x1, detectorConfig.bbox_y1)
32 tanPixSys =
CameraSys(TAN_PIXELS, detectorConfig.name)
35 orientation = orientation,
36 focalPlaneToPupil = focalPlaneToPupil,
37 pixelSizeMm = pixelSizeMm,
38 plateScale = plateScale,
44 detectorConfig.detectorType,
45 detectorConfig.serial,
54 """Make an instance of an Orientation class
56 @param detectorConfig -- config for this detector (an lsst.pex.config.Config)
57 @return orientation (an lsst.afw.cameraGeom.Orientation)
59 offset =
afwGeom.Point2D(detectorConfig.offset_x, detectorConfig.offset_y)
60 refPos =
afwGeom.Point2D(detectorConfig.refpos_x, detectorConfig.refpos_y)
62 pitch =
afwGeom.Angle(detectorConfig.pitchDeg, afwGeom.degrees)
64 return Orientation(offset, refPos, yaw, pitch, roll)
67 """Make a dictionary of CameraSys: XYTransform.
69 @param transformConfigDict -- an lsst.pex.config.ConfigDictField from an XYTransform registry;
70 keys are camera system names.
71 @return a dict of CameraSys or CameraSysPrefix: XYTransform
74 if transformConfigDict
is not None:
75 for key
in transformConfigDict:
76 transform = transformConfigDict[key].transform.apply()
81 """Construct a camera (lsst.afw.cameraGeom Camera)
83 @param[in] cameraConfig: an instance of CameraConfig
84 @param[in] ampInfoPath: path to ampInfo data files
85 @param[in] shortNameFunc: a function that converts a long detector name to a short one
86 @return camera (an lsst.afw.cameraGeom.Camera)
88 ampInfoCatDict = dict()
89 for detectorConfig
in cameraConfig.detectorList.itervalues():
90 shortName = shortNameFunc(detectorConfig.name)
91 ampCatPath = os.path.join(ampInfoPath, shortName +
".fits")
92 ampInfoCatalog = AmpInfoCatalog.readFits(ampCatPath)
93 ampInfoCatDict[detectorConfig.name] = ampInfoCatalog
98 """Construct a camera (lsst.afw.cameraGeom Camera)
100 @param[in] cameraConfig: an instance of CameraConfig
101 @param[in] ampInfoCatDict: a dictionary keyed on the detector name of AmpInfoCatalog objects
102 @return camera (an lsst.afw.cameraGeom.Camera)
104 nativeSys = cameraSysMap[cameraConfig.transformDict.nativeSys]
106 focalPlaneToPupil = transformDict[PUPIL]
110 for detectorConfig
in cameraConfig.detectorList.itervalues():
111 ampInfoCatalog = ampInfoCatDict[detectorConfig.name]
114 detectorConfig = detectorConfig,
115 ampInfoCatalog = ampInfoCatalog,
116 focalPlaneToPupil = focalPlaneToPupil,
117 plateScale = cameraConfig.plateScale,
120 return Camera(cameraConfig.name, detectorList, transformMap)
An integer coordinate rectangle.
def makeCameraFromCatalogs