22 from __future__
import absolute_import, division, print_function
23 from builtins
import range
24 from .cameraGeomLib
import FOCAL_PLANE, PIXELS
25 from .detectorCollection
import DetectorCollection
26 from .pupil
import PupilFactory
31 """!A collection of Detectors plus additional coordinate system support 33 Camera.transform transforms points from one camera coordinate system to another. 35 Camera.getTransform returns a transform between camera coordinate systems. 37 Camera.findDetectors finds all detectors overlapping a specified point. 40 def __init__(self, name, detectorList, transformMap, pupilFactoryClass=PupilFactory):
41 """!Construct a Camera 43 @param[in] name name of camera 44 @param[in] detectorList a sequence of detectors in index order 45 @param[in] transformMap a TransformMap that at least supports 46 FOCAL_PLANE and FIELD_ANGLE coordinates 47 @param[in] pupilFactoryClass a PupilFactory class for this camera 48 [default: afw.cameraGeom.PupilFactory] 54 super(Camera, self).
__init__(detectorList)
57 """!Return the camera name 62 """!Construct a PupilFactory. 64 @param[in] visitInfo VisitInfo object for a particular exposure. 65 @param[in] pupilSize Size in meters of constructed Pupil array. 66 Note that this may be larger than the actual 67 diameter of the illuminated pupil to 68 accommodate zero-padding. 69 @param[in] npix Constructed Pupils will be npix x npix. 70 @param[in] kwargs Other keyword arguments for the pupil factory 78 def _getTransformFromOneTransformMap(self, fromSys, toSys):
79 """!Get a transform from one TransformMap 81 `fromSys` and `toSys` must both be present in the same transform map, 82 but that transform map may be from any detector or this camera object. 84 @param[in] fromSys Camera coordinate system of `position` 86 @param[in] toSys Camera coordinate system of returned point(s) 88 @return an lsst.afw.geom.TransformPoint2ToPoint2 that transforms from 89 `fromSys` to `toSys` in the forward direction 91 @throws lsst.pex.exceptions.InvalidParameter if no transform is 92 available. This includes the case that fromSys specifies a known 93 detector and toSys specifies any other detector (known or unknown) 94 @throws KeyError if an unknown detector is specified 96 if fromSys.hasDetectorName():
97 det = self[fromSys.getDetectorName()]
98 return det.getTransformMap().
getTransform(fromSys, toSys)
99 elif toSys.hasDetectorName():
100 det = self[toSys.getDetectorName()]
101 return det.getTransformMap().
getTransform(fromSys, toSys)
106 """!Find the detectors that cover a point in any camera system 108 @param[in] point position to use in lookup (lsst.afw.geom.Point2D) 109 @param[in] cameraSys camera coordinate system of `point` 110 @return a list of zero or more Detectors that overlap the specified point 114 nativePoint = transform.applyForward(point)
117 for detector
in self:
119 pointPixels = nativeToPixels.applyForward(nativePoint)
121 detectorList.append(detector)
125 """!Find the detectors that cover a list of points in any camera system 127 @param[in] pointList a list of points (lsst.afw.geom.Point2D) 128 @param[in] cameraSys the camera coordinate system of the points in `pointList` 129 @return a list of lists; each list contains the names of all detectors 130 which contain the corresponding point 135 nativePointList = transform.applyForward(pointList)
138 for i
in range(len(pointList)):
139 detectorList.append([])
141 for detector
in self:
142 pixelSys = detector.makeCameraSys(PIXELS)
144 detectorPointList = transform.applyForward(nativePointList)
146 for i, pt
in enumerate(detectorPointList):
148 detectorList[i].append(detector)
153 """!Get a transform from one CameraSys to another 155 @param[in] fromSys From CameraSys 156 @param[in] toSys To CameraSys 157 @return an lsst.afw.geom.TransformPoint2ToPoint2 that transforms from 158 `fromSys` to `toSys` in the forward direction 160 @throws lsst.pex.exceptions.InvalidParameter if no transform is 162 @throws KeyError if an unknown detector is specified 167 return fromSysToNative.then(nativeToToSys)
170 """!Obtain the transform registry. 172 @return a TransformMap 174 @note: TransformRegistries are immutable, so this should be safe. 179 """!Transform a point or list of points from one camera coordinate system 182 @param[in] points an lsst.afw.geom.Point2D or list of Point2D 183 @param[in] fromSys Transform from this CameraSys 184 @param[in] toSys Transform to this CameraSys 185 @return `points` transformed to `toSys` (an lsst.afw.geom.Point2D 189 return transform.applyForward(points)
def __init__(self, name, detectorList, transformMap, pupilFactoryClass=PupilFactory)
Construct a Camera.
def getTransformMap(self)
Obtain the transform registry.
def getName(self)
Return the camera name.
def getPupilFactory(self, visitInfo, pupilSize, npix, kwargs)
Construct a PupilFactory.
def findDetectors(self, point, cameraSys)
Find the detectors that cover a point in any camera system.
def getTransform(self, fromSys, toSys)
Get a transform from one CameraSys to another.
def _getTransformFromOneTransformMap(self, fromSys, toSys)
Get a transform from one TransformMap.
def transform(self, points, fromSys, toSys)
Transform a point or list of points from one camera coordinate system to another. ...
def telescopeDiameter(self)
A collection of Detectors plus additional coordinate system support.
A floating-point coordinate rectangle geometry.
def findDetectorsList(self, pointList, cameraSys)
Find the detectors that cover a list of points in any camera system.
An immutable collection of Detectors that can be accessed by name or ID.