LSSTApplications  16.0-11-g09ed895+2,16.0-11-g12e47bd,16.0-11-g9bb73b2+6,16.0-12-g5c924a4+6,16.0-14-g9a974b3+1,16.0-15-g1417920+1,16.0-15-gdd5ca33+1,16.0-16-gf0259e2,16.0-17-g31abd91+7,16.0-17-g7d7456e+7,16.0-17-ga3d2e9f+13,16.0-18-ga4d4bcb+1,16.0-18-gd06566c+1,16.0-2-g0febb12+21,16.0-2-g9d5294e+69,16.0-2-ga8830df+6,16.0-20-g21842373+7,16.0-24-g3eae5ec,16.0-28-gfc9ea6c+4,16.0-29-ge8801f9,16.0-3-ge00e371+34,16.0-4-g18f3627+13,16.0-4-g5f3a788+20,16.0-4-ga3eb747+10,16.0-4-gabf74b7+29,16.0-4-gb13d127+6,16.0-49-g42e581f7+6,16.0-5-g27fb78a+7,16.0-5-g6a53317+34,16.0-5-gb3f8a4b+87,16.0-6-g9321be7+4,16.0-6-gcbc7b31+42,16.0-6-gf49912c+29,16.0-7-gd2eeba5+51,16.0-71-ge89f8615e,16.0-8-g21fd5fe+29,16.0-8-g3a9f023+20,16.0-8-g4734f7a+1,16.0-8-g5858431+3,16.0-9-gf5c1f43+8,master-gd73dc1d098+1,w.2019.01
LSSTDataManagementBasePackage
cameraConfig.py
Go to the documentation of this file.
1 import numpy as np
2 import lsst.pex.config as pexConfig
3 from .transformConfig import TransformMapConfig
4 
5 __all__ = ["CameraConfig", "DetectorConfig"]
6 
7 
8 class DetectorConfig(pexConfig.Config):
9  """!A configuration that represents (and can be used to construct) a Detector
10  """
11  transformDict = pexConfig.ConfigField(
12  "Dictionary of camera transforms keyed on the transform type.", TransformMapConfig)
13  name = pexConfig.Field("Name of detector slot", str)
14  id = pexConfig.Field("ID of detector slot", int)
15  bbox_x0 = pexConfig.Field("x0 of pixel bounding box", int)
16  bbox_y0 = pexConfig.Field("y0 of pixel bounding box", int)
17  bbox_x1 = pexConfig.Field("x1 of pixel bounding box", int)
18  bbox_y1 = pexConfig.Field("y1 of pixel bounding box", int)
19  detectorType = pexConfig.Field(
20  "Detector type: SCIENCE=0, FOCUS=1, GUIDER=2, WAVEFRONT=3", int)
21  serial = pexConfig.Field(
22  "Serial string associated with this specific detector", str)
23  offset_x = pexConfig.Field(
24  "x offset from the origin of the camera in mm in the transposed system.", float)
25  offset_y = pexConfig.Field(
26  "y offset from the origin of the camera in mm in the transposed system.", float)
27  refpos_x = pexConfig.Field("x position of the reference point in the detector in pixels "
28  "in transposed coordinates.", float)
29  refpos_y = pexConfig.Field("y position of the reference point in the detector in pixels "
30  "in transposed coordinates.", float)
31  yawDeg = pexConfig.Field("yaw (rotation about z) of the detector in degrees. "
32  "This includes any necessary rotation to go from "
33  "detector coordinates to camera coordinates "
34  "after optional transposition.", float)
35  pitchDeg = pexConfig.Field(
36  "pitch (rotation about y) of the detector in degrees", float)
37  rollDeg = pexConfig.Field(
38  "roll (rotation about x) of the detector in degrees", float)
39  pixelSize_x = pexConfig.Field("Pixel size in the x dimension in mm", float)
40  pixelSize_y = pexConfig.Field("Pixel size in the y dimension in mm", float)
41 
42  # Depending on the choice of detector coordinates, the pixel grid may need
43  # to be transposed before rotation to put it in camera coordinates.
44  transposeDetector = pexConfig.Field(
45  "Transpose the pixel grid before orienting in focal plane?", bool)
46 
47  crosstalk = pexConfig.ListField(
48  dtype=float,
49  doc=("Flattened crosstalk coefficient matrix; should have nAmps x nAmps entries. "
50  "Once 'reshape'-ed, ``coeffs[i][j]`` is the fraction of the j-th amp present on the i-th amp."),
51  optional=True
52  )
53 
54  def getCrosstalk(self, numAmps):
55  """Return a 2-D numpy array of crosstalk coefficients of the proper shape"""
56  if not self.crosstalk:
57  return None
58  try:
59  return np.array(self.crosstalk, dtype=np.float32).reshape((numAmps, numAmps))
60  except Exception as e:
61  raise RuntimeError("Cannot reshape 'crosstalk' coefficients to square matrix: %s" % (e,))
62 
63 
64 class CameraConfig(pexConfig.Config):
65  """!A configuration that represents (and can be used to construct) a Camera
66  """
67  detectorList = pexConfig.ConfigDictField(
68  "List of detector configs", keytype=int, itemtype=DetectorConfig)
69  transformDict = pexConfig.ConfigField(
70  "Dictionary of camera transforms keyed on the transform type.", TransformMapConfig)
71  name = pexConfig.Field("Name of this camera", str)
72 
73  plateScale = pexConfig.Field(
74  "Plate scale of the camera in arcsec/mm", float)
75  # Note that the radial transform will also apply a scaling, so all coefficients should be
76  # scaled by the plate scale in appropriate units
77  radialCoeffs = pexConfig.ListField(
78  "Coefficients for radial distortion", float)
A configuration that represents (and can be used to construct) a Detector.
Definition: cameraConfig.py:8
A configuration that represents (and can be used to construct) a Camera.
Definition: cameraConfig.py:64