Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change camGeom stuff to work after DM-5922 changes #68

Merged
merged 1 commit into from
Sep 23, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 13 additions & 9 deletions python/lsst/obs/base/yamlCamera.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,30 @@ def __init__(self, cameraYamlFile):
cameraParams = yaml.load(fd, Loader=yaml.Loader)

plateScale = afwGeom.Angle(cameraParams["plateScale"], afwGeom.arcseconds)
# radial coefficients of the form [0, no units, 1/rad but usually 0, 1/rad^2, …]
# Radial distortion is modeled as a radial polynomial that converts from focal plane radius (in mm)
# to field angle (in radians). The coefficients are divided by the plate scale (in mm/radians)
# meaning that C1 is always 1.
radialCoeffs = np.array(cameraParams["radialCoeffs"])/plateScale.asRadians()
focalPlaneToPupil = afwGeom.makeRadialTransform(radialCoeffs)
pupilToFocalPlane = focalPlaneToPupil.getInverse()
cameraTransformMap = cameraGeom.CameraTransformMap(cameraGeom.FOCAL_PLANE,
{cameraGeom.PUPIL: pupilToFocalPlane})
detectorList = self._makeDetectorList(cameraParams["CCDs"], pupilToFocalPlane, plateScale)
fieldAngleToFocalPlane = afwGeom.makeRadialTransform(radialCoeffs)
focalPlaneToFieldAngle = fieldAngleToFocalPlane.getInverse()
cameraTransformMap = cameraGeom.TransformMap(cameraGeom.FOCAL_PLANE,
{cameraGeom.FIELD_ANGLE: focalPlaneToFieldAngle})
detectorList = self._makeDetectorList(cameraParams["CCDs"], focalPlaneToFieldAngle)
cameraGeom.Camera.__init__(self, cameraParams["name"], detectorList, cameraTransformMap)

def _makeDetectorList(self, ccdParams, focalPlaneToPupil, plateScale):
def _makeDetectorList(self, ccdParams, focalPlaneToFieldAngle):
"""!Make a list of detectors
@param[in] ccdParams Dict of YAML descriptions of CCDs
@param[in] focalPlaneToPupil lsst.afw.geom.XYTransform from FOCAL_PLANE to PUPIL coordinates
@param[in] plateScale plate scale, in angle on sky/mm
@param[in] focalPlaneToFieldAngle lsst.afw.geom.TransformPoint2ToPoint2
from FOCAL_PLANE to FIELD_ANGLE coordinates
@return a list of detectors (lsst.afw.cameraGeom.Detector)
"""
detectorList = []
detectorConfigList = self._makeDetectorConfigList(ccdParams)
for ccd, detectorConfig in zip(ccdParams.values(), detectorConfigList):
ampInfoCatalog = self._makeAmpInfoCatalog(ccd)
detector = makeDetector(detectorConfig, ampInfoCatalog, focalPlaneToPupil)
detector = makeDetector(detectorConfig, ampInfoCatalog, focalPlaneToFieldAngle)
detectorList.append(detector)
return detectorList

Expand Down