LSSTApplications  18.0.0+106,18.0.0+50,19.0.0,19.0.0+1,19.0.0+10,19.0.0+11,19.0.0+13,19.0.0+17,19.0.0+2,19.0.0-1-g20d9b18+6,19.0.0-1-g425ff20,19.0.0-1-g5549ca4,19.0.0-1-g580fafe+6,19.0.0-1-g6fe20d0+1,19.0.0-1-g7011481+9,19.0.0-1-g8c57eb9+6,19.0.0-1-gb5175dc+11,19.0.0-1-gdc0e4a7+9,19.0.0-1-ge272bc4+6,19.0.0-1-ge3aa853,19.0.0-10-g448f008b,19.0.0-12-g6990b2c,19.0.0-2-g0d9f9cd+11,19.0.0-2-g3d9e4fb2+11,19.0.0-2-g5037de4,19.0.0-2-gb96a1c4+3,19.0.0-2-gd955cfd+15,19.0.0-3-g2d13df8,19.0.0-3-g6f3c7dc,19.0.0-4-g725f80e+11,19.0.0-4-ga671dab3b+1,19.0.0-4-gad373c5+3,19.0.0-5-ga2acb9c+2,19.0.0-5-gfe96e6c+2,w.2020.01
LSSTDataManagementBasePackage
Functions
lsst.afw.cameraGeom.assembleImage Namespace Reference

Functions

def assembleAmplifierImage (destImage, rawImage, amplifier)
 
def assembleAmplifierRawImage (destImage, rawImage, amplifier)
 
def makeUpdatedDetector (ccd)
 

Function Documentation

◆ assembleAmplifierImage()

def lsst.afw.cameraGeom.assembleImage.assembleAmplifierImage (   destImage,
  rawImage,
  amplifier 
)
Assemble the amplifier region of an image from a raw image.

Parameters
----------
destImage : `lsst.afw.image.Image` or `lsst.afw.image.MaskedImage`
    Assembled image; the region amplifier.getBBox() is overwritten with
    the assembled amplifier image.
rawImage : `lsst.afw.image.Image` or `lsst.afw.image.MaskedImage`
    Raw image (same type as destImage).
amplifier : `lsst.afw.cameraGeom.Amplifier`
    Amplifier geometry, with raw amplifier info.

Raises
------
RuntimeError
    Raised if image types do not match or amplifier has no raw amplifier info.

Definition at line 54 of file assembleImage.py.

54 def assembleAmplifierImage(destImage, rawImage, amplifier):
55  """Assemble the amplifier region of an image from a raw image.
56 
57  Parameters
58  ----------
59  destImage : `lsst.afw.image.Image` or `lsst.afw.image.MaskedImage`
60  Assembled image; the region amplifier.getBBox() is overwritten with
61  the assembled amplifier image.
62  rawImage : `lsst.afw.image.Image` or `lsst.afw.image.MaskedImage`
63  Raw image (same type as destImage).
64  amplifier : `lsst.afw.cameraGeom.Amplifier`
65  Amplifier geometry, with raw amplifier info.
66 
67  Raises
68  ------
69  RuntimeError
70  Raised if image types do not match or amplifier has no raw amplifier info.
71  """
72  if not amplifier.getHasRawInfo():
73  raise RuntimeError("amplifier must contain raw amplifier info")
74  if type(destImage.Factory) != type(rawImage.Factory): # noqa: E721
75  raise RuntimeError("destImage type = %s != %s = rawImage type" %
76  type(destImage.Factory).__name__, type(rawImage.Factory).__name__)
77  inView = rawImage.Factory(rawImage, amplifier.getRawDataBBox())
78  outView = destImage.Factory(destImage, amplifier.getBBox())
79 
80  _insertPixelChunk(outView, inView, amplifier,
81  hasattr(rawImage, "getArrays"))
82 
83 
table::Key< int > type
Definition: Detector.cc:163
def assembleAmplifierImage(destImage, rawImage, amplifier)

◆ assembleAmplifierRawImage()

def lsst.afw.cameraGeom.assembleImage.assembleAmplifierRawImage (   destImage,
  rawImage,
  amplifier 
)
Assemble the amplifier region of a raw CCD image.

For most cameras this is a no-op: the raw image already is an assembled
CCD image.
However, it is useful for camera such as LSST for which each amplifier
image is a separate image.

Parameters
----------
destImage : `lsst.afw.image.Image` or `lsst.afw.image.MaskedImage`
    CCD Image; the region amplifier.getRawAmplifier().getBBox()
    is overwritten with the raw amplifier image.
rawImage : `lsst.afw.image.Image` or `lsst.afw.image.MaskedImage`
    Raw image (same type as destImage).
amplifier : `lsst.afw.cameraGeom.Amplifier`
    Amplifier geometry with raw amplifier info

Raises
------
RuntimeError
    Raised if image types do not match or amplifier has no raw amplifier info.

Definition at line 84 of file assembleImage.py.

84 def assembleAmplifierRawImage(destImage, rawImage, amplifier):
85  """Assemble the amplifier region of a raw CCD image.
86 
87  For most cameras this is a no-op: the raw image already is an assembled
88  CCD image.
89  However, it is useful for camera such as LSST for which each amplifier
90  image is a separate image.
91 
92  Parameters
93  ----------
94  destImage : `lsst.afw.image.Image` or `lsst.afw.image.MaskedImage`
95  CCD Image; the region amplifier.getRawAmplifier().getBBox()
96  is overwritten with the raw amplifier image.
97  rawImage : `lsst.afw.image.Image` or `lsst.afw.image.MaskedImage`
98  Raw image (same type as destImage).
99  amplifier : `lsst.afw.cameraGeom.Amplifier`
100  Amplifier geometry with raw amplifier info
101 
102  Raises
103  ------
104  RuntimeError
105  Raised if image types do not match or amplifier has no raw amplifier info.
106  """
107  if not amplifier.getHasRawInfo():
108  raise RuntimeError("amplifier must contain raw amplifier info")
109  if type(destImage.Factory) != type(rawImage.Factory): # noqa: E721
110  raise RuntimeError("destImage type = %s != %s = rawImage type" %
111  type(destImage.Factory).__name__, type(rawImage.Factory).__name__)
112  inBBox = amplifier.getRawBBox()
113  inView = rawImage.Factory(rawImage, inBBox)
114  outBBox = amplifier.getRawBBox()
115  outBBox.shift(amplifier.getRawXYOffset())
116  outView = destImage.Factory(destImage, outBBox)
117 
118  _insertPixelChunk(outView, inView, amplifier,
119  hasattr(rawImage, "getArrays"))
120 
121 
table::Key< int > type
Definition: Detector.cc:163
def assembleAmplifierRawImage(destImage, rawImage, amplifier)

◆ makeUpdatedDetector()

def lsst.afw.cameraGeom.assembleImage.makeUpdatedDetector (   ccd)
Return a Detector that has had the definitions of amplifier geometry
updated post assembly.

Parameters
----------
ccd : `lsst.afw.image.Detector`
    The detector to copy and update.

Definition at line 122 of file assembleImage.py.

122 def makeUpdatedDetector(ccd):
123  """Return a Detector that has had the definitions of amplifier geometry
124  updated post assembly.
125 
126  Parameters
127  ----------
128  ccd : `lsst.afw.image.Detector`
129  The detector to copy and update.
130  """
131  builder = ccd.rebuild()
132  for amp in builder.getAmplifiers():
133  assert amp.getHasRawInfo()
134 
135  bbox = amp.getRawBBox()
136  awidth, aheight = bbox.getDimensions()
137  #
138  # Figure out how far flipping the amp LR and/or TB offsets the bboxes
139  #
140  boxMin0 = bbox.getMin() # initial position of rawBBox's LLC corner
141  if amp.getRawFlipX():
142  bbox.flipLR(awidth)
143  if amp.getRawFlipY():
144  bbox.flipTB(aheight)
145  shift = boxMin0 - bbox.getMin()
146 
147  for bboxName in ("",
148  "HorizontalOverscan",
149  "Data",
150  "VerticalOverscan",
151  "Prescan"):
152  bbox = getattr(amp, "getRaw%sBBox" % bboxName)()
153  if amp.getRawFlipX():
154  bbox.flipLR(awidth)
155  if amp.getRawFlipY():
156  bbox.flipTB(aheight)
157  bbox.shift(amp.getRawXYOffset() + shift)
158 
159  getattr(amp, "setRaw%sBBox" % bboxName)(bbox)
160  #
161  # All of these have now been transferred to the per-amp geometry
162  #
163  amp.setRawXYOffset(lsst.geom.ExtentI(0, 0))
164  amp.setRawFlipX(False)
165  amp.setRawFlipY(False)
166 
167  return builder.finish()