22 __all__ = [
"makeCameraFromPath",
"makeCameraFromCatalogs",
23 "makeDetector",
"copyDetector"]
28 from .cameraGeomLib
import FOCAL_PLANE, FIELD_ANGLE, PIXELS, TAN_PIXELS, ACTUAL_PIXELS, CameraSys, \
29 Detector, DetectorType, Orientation, TransformMap
30 from .camera
import Camera
31 from .makePixelToTanPixel
import makePixelToTanPixel
32 from .pupil
import PupilFactory
34 cameraSysList = [FIELD_ANGLE, FOCAL_PLANE, PIXELS, TAN_PIXELS, ACTUAL_PIXELS]
35 cameraSysMap = dict((sys.getSysName(), sys)
for sys
in cameraSysList)
39 """Build a dictionary of Detector constructor keyword arguments. 41 The returned dictionary can be passed as keyword arguments to the Detector 42 constructor, providing all required arguments. However, using these 43 arguments directly constructs a Detector with knowledge of only the 44 coordinate systems that are *directly* mapped to its own PIXELS coordinate 45 system. To construct Detectors with a shared TransformMap for the full 46 Camera, use makeCameraFromCatalogs or makeCameraFromPath instead of 47 calling this function or makeDetector directly. 51 detectorConfig : `lsst.pex.config.Config` 52 Configuration for this detector. 53 ampInfoCatalog : `lsst.afw.table.AmpInfoCatalog` 54 amplifier information for this detector 55 focalPlaneToField : `lsst.afw.geom.TransformPoint2ToPoint2` 56 FOCAL_PLANE to FIELD_ANGLE Transform 61 Contains the following keys: name, id, type, serial, bbox, orientation, 62 pixelSize, transforms, ampInfoCatalog, and optionally crosstalk. 63 The transforms key is a dictionary whose values are Transforms that map 64 the Detector's PIXEL coordinate system to the CameraSys in the key. 68 name=detectorConfig.name,
70 type=DetectorType(detectorConfig.detectorType),
71 physicalType=detectorConfig.physicalType,
72 serial=detectorConfig.serial,
73 ampInfoCatalog=ampInfoCatalog,
83 transforms[FOCAL_PLANE] = data[
"orientation"].makePixelFpTransform(data[
"pixelSize"])
85 tanPixSys = CameraSys(TAN_PIXELS, detectorConfig.name)
88 orientation=data[
"orientation"],
89 focalPlaneToField=focalPlaneToField,
90 pixelSizeMm=data[
"pixelSize"],
93 data[
"transforms"] = transforms
95 crosstalk = detectorConfig.getCrosstalk(len(ampInfoCatalog))
96 if crosstalk
is not None:
97 data[
"crosstalk"] = crosstalk
103 """Make a Detector instance from a detector config and amp info catalog 107 detectorConfig : `lsst.pex.config.Config` 108 Configuration for this detector. 109 ampInfoCatalog : `lsst.afw.table.AmpInfoCatalog` 110 amplifier information for this detector 111 focalPlaneToField : `lsst.afw.geom.TransformPoint2ToPoint2` 112 FOCAL_PLANE to FIELD_ANGLE Transform 116 detector : `lsst.afw.cameraGeom.Detector` 117 New Detector instance. 124 """Return a copy of a Detector with possibly-updated amplifier information. 126 No deep copies are made; the input transformDict is used unmodified 130 detector : `lsst.afw.cameraGeom.Detector` 131 The Detector to clone 132 ampInfoCatalog The ampInfoCatalog to use; default use original 136 detector : `lsst.afw.cameraGeom.Detector` 137 New Detector instance. 139 if ampInfoCatalog
is None:
140 ampInfoCatalog = detector.getAmpInfoCatalog()
142 return Detector(detector.getName(), detector.getId(), detector.getType(),
143 detector.getSerial(), detector.getBBox(),
144 ampInfoCatalog, detector.getOrientation(), detector.getPixelSize(),
145 detector.getTransformMap(), detector.getCrosstalk(), detector.getPhysicalType())
149 """Make an Orientation instance from a detector config 153 detectorConfig : `lsst.pex.config.Config` 154 Configuration for this detector. 158 orientation : `lsst.afw.cameraGeom.Orientation` 159 Location and rotation of the Detector. 166 return Orientation(offset, refPos, yaw, pitch, roll)
170 """Make a dictionary of CameraSys: lsst.afw.geom.Transform from a config dict. 174 transformConfigDict : value obtained from a `lsst.pex.config.ConfigDictField` 175 registry; keys are camera system names. 180 A dict of CameraSys or CameraSysPrefix: lsst.afw.geom.Transform 183 if transformConfigDict
is not None:
184 for key
in transformConfigDict:
185 transform = transformConfigDict[key].transform.apply()
186 resMap[CameraSys(key)] = transform
191 pupilFactoryClass=PupilFactory):
192 """Make a Camera instance from a directory of ampInfo files 194 The directory must contain one ampInfo fits file for each detector in cameraConfig.detectorList. 195 The name of each ampInfo file must be shortNameFunc(fullDetectorName) + ".fits". 199 cameraConfig : `CameraConfig` 200 Config describing camera and its detectors. 202 Path to ampInfo data files. 203 shortNameFunc : callable 204 A function that converts a long detector name to a short one. 205 pupilFactoryClass : `type`, optional 206 Class to attach to camera; default is `lsst.afw.cameraGeom.PupilFactory`. 210 camera : `lsst.afw.cameraGeom.Camera` 213 ampInfoCatDict = dict()
214 for detectorConfig
in cameraConfig.detectorList.values():
215 shortName = shortNameFunc(detectorConfig.name)
216 ampCatPath = os.path.join(ampInfoPath, shortName +
".fits")
217 ampInfoCatalog = AmpInfoCatalog.readFits(ampCatPath)
218 ampInfoCatDict[detectorConfig.name] = ampInfoCatalog
224 pupilFactoryClass=PupilFactory):
225 """Construct a Camera instance from a dictionary of detector name: AmpInfoCatalog 229 cameraConfig : `CameraConfig` 230 Config describing camera and its detectors. 231 ampInfoCatDict : `dict` 232 A dictionary of detector name: AmpInfoCatalog 233 pupilFactoryClass : `type`, optional 234 Class to attach to camera; `lsst.default afw.cameraGeom.PupilFactory`. 238 camera : `lsst.afw.cameraGeom.Camera` 241 nativeSys = cameraSysMap[cameraConfig.transformDict.nativeSys]
248 assert nativeSys == FOCAL_PLANE,
"Cameras with nativeSys != FOCAL_PLANE are not supported." 251 focalPlaneToField = transformDict[FIELD_ANGLE]
253 transformMapBuilder.connect(transformDict)
258 for detectorConfig
in cameraConfig.detectorList.values():
264 detectorConfig=detectorConfig,
265 ampInfoCatalog=ampInfoCatDict[detectorConfig.name],
266 focalPlaneToField=focalPlaneToField,
271 thisDetectorTransforms = thisDetectorData.pop(
"transforms")
274 detectorData.append(thisDetectorData)
280 detectorNativeSysPrefix = cameraSysMap.get(detectorConfig.transformDict.nativeSys, PIXELS)
289 assert detectorNativeSysPrefix == PIXELS,
"Detectors with nativeSys != PIXELS are not supported." 290 detectorNativeSys = CameraSys(detectorNativeSysPrefix, detectorConfig.name)
293 transformMapBuilder.connect(detectorNativeSys, thisDetectorTransforms)
297 transformMap = transformMapBuilder.build()
300 detectorList = [
Detector(transformMap=transformMap, **kw)
for kw
in detectorData]
302 return Camera(cameraConfig.name, detectorList, transformMap, pupilFactoryClass)
def copyDetector(detector, ampInfoCatalog=None)
def makeDetectorData(detectorConfig, ampInfoCatalog, focalPlaneToField)
def makeCameraFromCatalogs(cameraConfig, ampInfoCatDict, pupilFactoryClass=PupilFactory)
A class representing an angle.
Describe a detector's orientation in the focal plane.
def makeOrientation(detectorConfig)
def makeCameraFromPath(cameraConfig, ampInfoPath, shortNameFunc, pupilFactoryClass=PupilFactory)
Information about a CCD or other imaging detector.
def makePixelToTanPixel(bbox, orientation, focalPlaneToField, pixelSizeMm)
def makeTransformDict(transformConfigDict)
def makeDetector(detectorConfig, ampInfoCatalog, focalPlaneToField)
An integer coordinate rectangle.