LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Public Member Functions | Public Attributes | List of all members
lsst.jointcal.cameraGeometry.CameraModel Class Reference

Public Member Functions

def __init__ (self, wcsList, detectors, camera, n=100)
 
def computeDistortionModel (self)
 
def computePixelScale (self)
 
def computeCameraPixelScale (self, detector_id=30)
 

Public Attributes

 wcsList
 
 camera
 
 detectors
 
 maxFocalRadius
 
 n
 
 fieldAngle
 
 radialScale
 
 tangentialScale
 
 fieldAngles
 
 radialScales
 
 tangentialScales
 
 fieldAngleStd
 
 radialScaleStd
 
 tangentialScaleStd
 
 log
 

Detailed Description

Convert a jointcal `~lsst.afw.geom.SkyWcs` into a distortion model and
detector positions (TODO) that can be used by `~lsst.afw.cameraGeom`.

Because this code only operates on the WCS, it is independent of the
format of the persisted output (e.g. gen2 separate files vs. gen3 bundled
visits).

Parameters
----------
wcsList : `list` [`lsst.afw.geom.SkyWcs`]
    The WCS to use to compute the distortion model from, preferably from
    multiple visits on the same tract.
detectors : `list` [`int`]
    Detector ids that correspond one-to-one with ``wcsList``.
camera : `lsst.afw.cameraGeom.Camera`
    The camera these WCS were fit for.
n : `int`
    Number of points to compute the pixel scale at, along the +y axis.

Definition at line 36 of file cameraGeometry.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.jointcal.cameraGeometry.CameraModel.__init__ (   self,
  wcsList,
  detectors,
  camera,
  n = 100 
)

Definition at line 56 of file cameraGeometry.py.

56  def __init__(self, wcsList, detectors, camera, n=100):
57  self.wcsList = wcsList
58  self.camera = camera
59  self.detectors = detectors
60  self.maxFocalRadius = self.camera.computeMaxFocalPlaneRadius()
61  self.n = n
62  # the computed radius and pixel scales
63  self.fieldAngle = None # degrees
64  self.radialScale = None # arcsec
65  self.tangentialScale = None # arcsec
66  # the computed values for every input wcs
67  self.fieldAngles = None
68  self.radialScales = None
69  self.tangentialScales = None
70  self.fieldAngleStd = None
71  self.radialScaleStd = None
72  self.tangentialScaleStd = None
73 
74  self.log = _LOG.getChild("CameraModel")
75 

Member Function Documentation

◆ computeCameraPixelScale()

def lsst.jointcal.cameraGeometry.CameraModel.computeCameraPixelScale (   self,
  detector_id = 30 
)
Compute the radial and tangential pixel scales using the distortion
model supplied with the camera.

This is designed to be directly comparable with the results of
`~CameraModel.computePixelScale`.

Parameters
----------
detector_id: `int`
    Detector identifier for the detector_id to use for the calculation.

Returns
-------
fieldAngle : `numpy.ndarray`
    Field angles in degrees.
radialScale : `numpy.ndarray`
    Radial direction pixel scales in arcseconds/pixel.
tangentialScale : `numpy.ndarray`
    Tangential direction pixel scales in arcseconds/pixel.

Definition at line 126 of file cameraGeometry.py.

126  def computeCameraPixelScale(self, detector_id=30):
127  """Compute the radial and tangential pixel scales using the distortion
128  model supplied with the camera.
129 
130  This is designed to be directly comparable with the results of
131  `~CameraModel.computePixelScale`.
132 
133  Parameters
134  ----------
135  detector_id: `int`
136  Detector identifier for the detector_id to use for the calculation.
137 
138  Returns
139  -------
140  fieldAngle : `numpy.ndarray`
141  Field angles in degrees.
142  radialScale : `numpy.ndarray`
143  Radial direction pixel scales in arcseconds/pixel.
144  tangentialScale : `numpy.ndarray`
145  Tangential direction pixel scales in arcseconds/pixel.
146  """
147  # Make a trivial SkyWcs to get a field angle->sky transform from.
148  iwcToSkyWcs = lsst.afw.geom.makeSkyWcs(Point2D(0, 0), SpherePoint(0, 0, radians),
149  lsst.afw.geom.makeCdMatrix(1.0 * radians, 0 * radians, True))
150  iwcToSkyMap = iwcToSkyWcs.getFrameDict().getMapping("PIXELS", "SKY")
151  skyFrame = iwcToSkyWcs.getFrameDict().getFrame("SKY")
152 
153  # Extract the transforms that are defined just on the camera.
154  pixSys = self.camera[detector_id].makeCameraSys(cameraGeom.PIXELS)
155  pixelsToFocal = self.camera.getTransform(pixSys, cameraGeom.FOCAL_PLANE)
156  focalToField = self.camera.getTransform(cameraGeom.FOCAL_PLANE, cameraGeom.FIELD_ANGLE)
157 
158  # Build a SkyWcs that combines each of the above components.
159  pixelFrame = ast.Frame(2, "Domain=PIXELS")
160  focalFrame = ast.Frame(2, "Domain=FOCAL")
161  iwcFrame = ast.Frame(2, "Domain=IWC")
162  frameDict = ast.FrameDict(pixelFrame)
163  frameDict.addFrame("PIXELS", pixelsToFocal.getMapping(), focalFrame)
164  frameDict.addFrame("FOCAL", focalToField.getMapping(), iwcFrame)
165  frameDict.addFrame("IWC", iwcToSkyMap, skyFrame)
166  wcs = lsst.afw.geom.SkyWcs(frameDict)
167 
168  return self._computeDetectorPixelScale(detector_id, wcs)
169 
A FrameSet whose frames can be referenced by domain name.
Definition: FrameDict.h:67
Frame is used to represent a coordinate system.
Definition: Frame.h:157
A 2-dimensional celestial WCS that transform pixels to ICRS RA/Dec, using the LSST standard for pixel...
Definition: SkyWcs.h:117
std::shared_ptr< SkyWcs > makeSkyWcs(daf::base::PropertySet &metadata, bool strip=false)
Construct a SkyWcs from FITS keywords.
Definition: SkyWcs.cc:521
Eigen::Matrix2d makeCdMatrix(lsst::geom::Angle const &scale, lsst::geom::Angle const &orientation=0 *lsst::geom::degrees, bool flipX=false)
Make a WCS CD matrix.
Definition: SkyWcs.cc:133
lsst::geom::SpherePoint SpherePoint
Definition: misc.h:34
Point< double, 2 > Point2D
Definition: Point.h:324

◆ computeDistortionModel()

def lsst.jointcal.cameraGeometry.CameraModel.computeDistortionModel (   self)
Calculate the afw cameraGeom distortion model to be included in an
on-disk camera model.


PLACEHOLDER: This may be as simple as running `computePixelScale` and
then doing a numpy polynomial fit to it for the cameraGeom input.
However, we need to check details of how that distortion model is
stored in a Camera.
    e.g.: np.polyfit(self.fieldAngle, self.radialScale, poly_degree))

Definition at line 76 of file cameraGeometry.py.

76  def computeDistortionModel(self):
77  """Calculate the afw cameraGeom distortion model to be included in an
78  on-disk camera model.
79 
80 
81  PLACEHOLDER: This may be as simple as running `computePixelScale` and
82  then doing a numpy polynomial fit to it for the cameraGeom input.
83  However, we need to check details of how that distortion model is
84  stored in a Camera.
85  e.g.: np.polyfit(self.fieldAngle, self.radialScale, poly_degree))
86  """
87  raise NotImplementedError("not yet!")
88 

◆ computePixelScale()

def lsst.jointcal.cameraGeometry.CameraModel.computePixelScale (   self)
Compute the radial and tangential pixel scale by averaging over
multiple jointcal WCS models.

Also computes the standard deviation and logs any WCS that are
significant outliers.
The calculations are stored in the ``fieldAngle[s]``,
``radialScale[s]``, and ``tangentialScale[s]`` member variables.

Definition at line 89 of file cameraGeometry.py.

89  def computePixelScale(self):
90  """Compute the radial and tangential pixel scale by averaging over
91  multiple jointcal WCS models.
92 
93  Also computes the standard deviation and logs any WCS that are
94  significant outliers.
95  The calculations are stored in the ``fieldAngle[s]``,
96  ``radialScale[s]``, and ``tangentialScale[s]`` member variables.
97  """
98  self.fieldAngles = []
99  self.radialScales = []
100  self.tangentialScales = []
101  for id, wcs in zip(self.detectors, self.wcsList):
102  fieldAngle, radial, tangential = self._computeDetectorPixelScale(id, wcs)
103  self.fieldAngles.append(fieldAngle)
104  self.radialScales.append(radial)
105  self.tangentialScales.append(tangential)
106  # TODO: For now, don't worry about small differences in the computed
107  # field angles vs. their respective radial/tangential scales, just
108  # assume all fieldAngle positions are "close enough" and warn if not.
109  self.fieldAngle = np.mean(self.fieldAngles, axis=0)
110  self.fieldAngleStd = np.std(self.fieldAngles, axis=0)
111  if self.fieldAngleStd.max() > 1e-4:
112  self.log.warning("Large stddev in computed field angles between visits (max: %s degree).",
113  self.fieldAngleStd.max())
114  # import os; print(os.getpid()); import ipdb; ipdb.set_trace();
115  self.radialScale = np.mean(self.radialScales, axis=0)
116  self.radialScaleStd = np.std(self.radialScales, axis=0)
117  if self.radialScaleStd.max() > 1e-4:
118  self.log.warning("Large stddev in computed radial scales between visits (max: %s arcsec).",
119  self.radialScaleStd.max())
120  self.tangentialScale = np.mean(self.tangentialScales, axis=0)
121  self.tangentialScaleStd = np.std(self.tangentialScales, axis=0)
122  if self.tangentialScaleStd.max() > 1e-4:
123  self.log.warning("Large stddev in computed tangential scales between visits (max: %s arcsec).",
124  self.tangentialScaleStd.max())
125 
int max
std::shared_ptr< FrameSet > append(FrameSet const &first, FrameSet const &second)
Construct a FrameSet that performs two transformations in series.
Definition: functional.cc:33

Member Data Documentation

◆ camera

lsst.jointcal.cameraGeometry.CameraModel.camera

Definition at line 58 of file cameraGeometry.py.

◆ detectors

lsst.jointcal.cameraGeometry.CameraModel.detectors

Definition at line 59 of file cameraGeometry.py.

◆ fieldAngle

lsst.jointcal.cameraGeometry.CameraModel.fieldAngle

Definition at line 63 of file cameraGeometry.py.

◆ fieldAngles

lsst.jointcal.cameraGeometry.CameraModel.fieldAngles

Definition at line 67 of file cameraGeometry.py.

◆ fieldAngleStd

lsst.jointcal.cameraGeometry.CameraModel.fieldAngleStd

Definition at line 70 of file cameraGeometry.py.

◆ log

lsst.jointcal.cameraGeometry.CameraModel.log

Definition at line 74 of file cameraGeometry.py.

◆ maxFocalRadius

lsst.jointcal.cameraGeometry.CameraModel.maxFocalRadius

Definition at line 60 of file cameraGeometry.py.

◆ n

lsst.jointcal.cameraGeometry.CameraModel.n

Definition at line 61 of file cameraGeometry.py.

◆ radialScale

lsst.jointcal.cameraGeometry.CameraModel.radialScale

Definition at line 64 of file cameraGeometry.py.

◆ radialScales

lsst.jointcal.cameraGeometry.CameraModel.radialScales

Definition at line 68 of file cameraGeometry.py.

◆ radialScaleStd

lsst.jointcal.cameraGeometry.CameraModel.radialScaleStd

Definition at line 71 of file cameraGeometry.py.

◆ tangentialScale

lsst.jointcal.cameraGeometry.CameraModel.tangentialScale

Definition at line 65 of file cameraGeometry.py.

◆ tangentialScales

lsst.jointcal.cameraGeometry.CameraModel.tangentialScales

Definition at line 69 of file cameraGeometry.py.

◆ tangentialScaleStd

lsst.jointcal.cameraGeometry.CameraModel.tangentialScaleStd

Definition at line 72 of file cameraGeometry.py.

◆ wcsList

lsst.jointcal.cameraGeometry.CameraModel.wcsList

Definition at line 57 of file cameraGeometry.py.


The documentation for this class was generated from the following file: