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

DM-12085: Camera geometry incorrect and outdated in obs_test #38

Merged
merged 3 commits into from
Oct 3, 2017
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions python/lsst/obs/test/dualRawImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@
# see <http://www.lsstcorp.org/LegalNotices/>.
#


class RawAndFlatContainer(object):
def __init__(self, a, b):
self.raw = a
self.flat = b


def RawAndFlatAssembler(dataId, componentInfo, cls):
obj = cls(a=componentInfo['raw'].obj, b=componentInfo['flat'].obj)
return obj


def RawAndFlatDisassembler(obj, dataId, componentInfo):
componentInfo['raw'].obj = obj.raw
componentInfo['flat'].obj = obj.flat
22 changes: 14 additions & 8 deletions python/lsst/obs/test/testCamera.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,24 @@ def __init__(self):
"""Construct a TestCamera
"""
plateScale = afwGeom.Angle(20, afwGeom.arcseconds) # plate scale, in angle on sky/mm
radialDistortion = 0.925 # radial distortion in mm/rad^2
radialCoeff = np.array((0.0, 1.0, 0.0, radialDistortion)) / plateScale.asRadians()
focalPlaneToField = afwGeom.makeRadialTransform(radialCoeff)
# Radial distortion is modeled as a radial polynomial that converts from focal plane (in mm)
# to field angle (in radians). Thus the coefficients are:
# C0: always 0, for continuity at the center of the focal plane; units are rad
# C1: 1/plateScale; units are rad/mm
# C2: usually 0; units are rad/mm^2
# C3: radial distortion; units are rad/mm^3
radialCoeff = np.array([0.0, 1.0, 0.0, 0.925]) / plateScale.asRadians()
fieldAngleToFocalPlane = afwGeom.makeRadialTransform(radialCoeff)
focalPlaneToFieldAngle = fieldAngleToFocalPlane.getInverse()
cameraTransformMap = cameraGeom.TransformMap(cameraGeom.FOCAL_PLANE,
{cameraGeom.FIELD_ANGLE: focalPlaneToField})
detectorList = self._makeDetectorList(focalPlaneToField)
{cameraGeom.FIELD_ANGLE: focalPlaneToFieldAngle})
detectorList = self._makeDetectorList(focalPlaneToFieldAngle)
cameraGeom.Camera.__init__(self, "test", detectorList, cameraTransformMap)

def _makeDetectorList(self, focalPlaneToField):
def _makeDetectorList(self, focalPlaneToFieldAngle):
"""Make a list of detectors

@param[in] focalPlaneToField An lsst.afw.geom.TransformPoint2ToPoint2
@param[in] focalPlaneToFieldAngle An lsst.afw.geom.TransformPoint2ToPoint2
that transforms from FOCAL_PLANE to FIELD_ANGLE coordinates
in the forward direction
@return a list of detectors (lsst.afw.cameraGeom.Detector)
Expand All @@ -76,7 +82,7 @@ def _makeDetectorList(self, focalPlaneToField):
detectorConfigList = self._makeDetectorConfigList()
for detectorConfig in detectorConfigList:
ampInfoCatalog = self._makeAmpInfoCatalog()
detector = makeDetector(detectorConfig, ampInfoCatalog, focalPlaneToField)
detector = makeDetector(detectorConfig, ampInfoCatalog, focalPlaneToFieldAngle)
detectorList.append(detector)
return detectorList

Expand Down
1 change: 1 addition & 0 deletions tests/test_composite.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

ROOT = getPackageDir('obs_test')


def makeRampDecoratedImage(bbox, start, **metadataDict):
"""Make a DecoratedImageU that is a ramp
"""
Expand Down
3 changes: 2 additions & 1 deletion tests/test_obs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import lsst.utils.tests
from lsst.utils import getPackageDir
from lsst.afw.geom import Extent2I
from lsst.afw.geom import arcseconds, Extent2I
import lsst.obs.base.tests
import lsst.obs.test

Expand Down Expand Up @@ -111,6 +111,7 @@ def setUp(self):
self.setUp_camera(camera_name='test',
n_detectors=1,
first_detector_name='0',
plate_scale=20 * arcseconds,
)

super(TestObsTest, self).setUp()
Expand Down