LSSTApplications  17.0+10,17.0+51,17.0+88,18.0.0+10,18.0.0+15,18.0.0+34,18.0.0+4,18.0.0+6,18.0.0-2-ge43143a+6,18.1.0-1-g0001055+2,18.1.0-1-g0896a44+10,18.1.0-1-g1349e88+9,18.1.0-1-g2505f39+7,18.1.0-1-g380d4d4+9,18.1.0-1-g5e4b7ea+2,18.1.0-1-g7e8fceb,18.1.0-1-g85f8cd4+7,18.1.0-1-g9a6769a+3,18.1.0-1-ga1a4c1a+6,18.1.0-1-gc037db8+2,18.1.0-1-gd55f500+3,18.1.0-1-ge10677a+7,18.1.0-10-g73b8679e+12,18.1.0-12-gf30922b,18.1.0-13-g451e75588,18.1.0-13-gbfe7f7f,18.1.0-2-g31c43f9+7,18.1.0-2-g9c63283+9,18.1.0-2-gdf0b915+9,18.1.0-2-gf03bb23+2,18.1.0-3-g52aa583+3,18.1.0-3-g8f4a2b1+1,18.1.0-3-g9cb968e+8,18.1.0-4-g7bbbad0,18.1.0-5-g510c42a+8,18.1.0-5-ga46117f,18.1.0-5-gaeab27e+9,18.1.0-6-gdda7f3e+11,18.1.0-8-g4084bf03+1,w.2019.34
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.table.AmpInfoRecord`
    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 55 of file assembleImage.py.

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

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

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