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):
15 """!Make a Detector instance from a detector config and amp info catalog
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 @return detector (an lsst.afw.cameraGeom.Detector)
23 pixelSizeMm =
afwGeom.Extent2D(detectorConfig.pixelSize_x, detectorConfig.pixelSize_y)
25 transforms[FOCAL_PLANE] = orientation.makePixelFpTransform(pixelSizeMm)
27 llPoint =
afwGeom.Point2I(detectorConfig.bbox_x0, detectorConfig.bbox_y0)
28 urPoint =
afwGeom.Point2I(detectorConfig.bbox_x1, detectorConfig.bbox_y1)
31 tanPixSys =
CameraSys(TAN_PIXELS, detectorConfig.name)
34 orientation = orientation,
35 focalPlaneToPupil = focalPlaneToPupil,
36 pixelSizeMm = pixelSizeMm,
42 detectorConfig.detectorType,
43 detectorConfig.serial,
52 """!Make an Orientation instance from a detector config
54 @param detectorConfig config for this detector (an lsst.pex.config.Config)
55 @return orientation (an lsst.afw.cameraGeom.Orientation)
57 offset =
afwGeom.Point2D(detectorConfig.offset_x, detectorConfig.offset_y)
58 refPos =
afwGeom.Point2D(detectorConfig.refpos_x, detectorConfig.refpos_y)
60 pitch =
afwGeom.Angle(detectorConfig.pitchDeg, afwGeom.degrees)
62 return Orientation(offset, refPos, yaw, pitch, roll)
65 """!Make a dictionary of CameraSys: lsst.afw.geom.XYTransform from a config dict.
67 @param transformConfigDict an lsst.pex.config.ConfigDictField from an lsst.afw.geom.XYTransform
68 registry; keys are camera system names.
69 @return a dict of CameraSys or CameraSysPrefix: lsst.afw.geom.XYTransform
72 if transformConfigDict
is not None:
73 for key
in transformConfigDict:
74 transform = transformConfigDict[key].transform.apply()
79 """!Make a Camera instance from a directory of ampInfo files
81 The directory must contain one ampInfo fits file for each detector in cameraConfig.detectorList.
82 The name of each ampInfo file must be shortNameFunc(fullDetectorName) + ".fits".
84 @param[in] cameraConfig an instance of CameraConfig
85 @param[in] ampInfoPath path to ampInfo data files
86 @param[in] shortNameFunc a function that converts a long detector name to a short one
87 @return camera (an lsst.afw.cameraGeom.Camera)
89 ampInfoCatDict = dict()
90 for detectorConfig
in cameraConfig.detectorList.values():
91 shortName = shortNameFunc(detectorConfig.name)
92 ampCatPath = os.path.join(ampInfoPath, shortName +
".fits")
93 ampInfoCatalog = AmpInfoCatalog.readFits(ampCatPath)
94 ampInfoCatDict[detectorConfig.name] = ampInfoCatalog
99 """!Construct a Camera instance from a dictionary of detector name: AmpInfoCatalog
101 @param[in] cameraConfig an instance of CameraConfig
102 @param[in] ampInfoCatDict a dictionary of detector name: AmpInfoCatalog
103 @return camera (an lsst.afw.cameraGeom.Camera)
105 nativeSys = cameraSysMap[cameraConfig.transformDict.nativeSys]
107 focalPlaneToPupil = transformDict[PUPIL]
111 for detectorConfig
in cameraConfig.detectorList.values():
112 ampInfoCatalog = ampInfoCatDict[detectorConfig.name]
115 detectorConfig = detectorConfig,
116 ampInfoCatalog = ampInfoCatalog,
117 focalPlaneToPupil = focalPlaneToPupil,
120 return Camera(cameraConfig.name, detectorList, transformMap)
Camera coordinate system; used as a key in in TransformMap.
def makeTransformDict
Make a dictionary of CameraSys: lsst.afw.geom.XYTransform from a config dict.
An integer coordinate rectangle.
Describe a detector's orientation in the focal plane.
A class representing an Angle.
def makeOrientation
Make an Orientation instance from a detector config.
def makeCameraFromPath
Make a Camera instance from a directory of ampInfo files.
def makePixelToTanPixel
Make an XYTransform whose forward direction converts PIXEL to TAN_PIXEL for one detector.
def makeDetector
Make a Detector instance from a detector config and amp info catalog.
Information about a CCD or other imaging detector.
def makeCameraFromCatalogs
Construct a Camera instance from a dictionary of detector name: AmpInfoCatalog.