lsst.afw  13.0-94-ga1c444047
makePixelToTanPixel.py
Go to the documentation of this file.
1 from __future__ import absolute_import, division, print_function
2 #
3 # LSST Data Management System
4 # Copyright 2014 LSST Corporation.
5 #
6 # This product includes software developed by the
7 # LSST Project (http://www.lsst.org/).
8 #
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the LSST License Statement and
20 # the GNU General Public License along with this program. If not,
21 # see <http://www.lsstcorp.org/LegalNotices/>.
22 #
23 import lsst.afw.geom as afwGeom
24 
25 __all__ = ["makePixelToTanPixel"]
26 
27 
28 def makePixelToTanPixel(bbox, orientation, focalPlaneToPupil, pixelSizeMm):
29  """!Make an XYTransform whose forward direction converts PIXEL to TAN_PIXEL for one detector
30 
31  PIXELS and TAN_PIXELS are defined in @ref afwCameraGeomCoordSys in doc/cameraGeom.dox
32 
33  @param[in] bbox detector bounding box (an lsst.afw.geom.Box2I)
34  @param[in] orientation orientation of detector in focal plane (an lsst.afw.cameraGeom.Orientation)
35  @param[in] focalPlaneToPupil an lsst.afw.math.XYTransform that converts from focal plane (mm)
36  to pupil coordinates (radians) in the forward direction
37  @param[in] pixelSizeMm size of the pixel in mm in X and Y (an lsst.afw.geom.Extent2D)
38  """
39  pixelToFocalPlane = orientation.makePixelFpTransform(pixelSizeMm)
40  pixelToPupil = afwGeom.MultiXYTransform(
41  (pixelToFocalPlane, focalPlaneToPupil))
42  # pupilToTanPix is affine and matches pupilToPix at pupil center
43  # Note: focal plane to pupil is typically a radial transform,
44  # and linearizing the inverse transform of that may fail,
45  # so linearize the forward direction instead. (pixelToPupil is pixelToFocalPlane,
46  # an affine transform, followed by focalPlaneToPupil,
47  # so the same consideration applies to pixelToPupil)
48  pixAtPupilCtr = pixelToPupil.reverseTransform(afwGeom.Point2D(0, 0))
49  tanPixToPupilAffine = pixelToPupil.linearizeForwardTransform(pixAtPupilCtr)
50  pupilToTanPix = afwGeom.AffineXYTransform(tanPixToPupilAffine.invert())
51 
52  return afwGeom.MultiXYTransform((pixelToPupil, pupilToTanPix))
def makePixelToTanPixel(bbox, orientation, focalPlaneToPupil, pixelSizeMm)
Make an XYTransform whose forward direction converts PIXEL to TAN_PIXEL for one detector.
Wrap a sequence of multiple XYTransforms.
Definition: XYTransform.h:129
Wrap an AffineTransform.
Definition: XYTransform.h:148