LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
Functions | Variables
lsst.afw.cameraGeom.assembleImage Namespace Reference

Functions

def _insertPixelChunk
 
def assembleAmplifierImage
 Assemble the amplifier region of an image from a raw image. More...
 
def assembleAmplifierRawImage
 Assemble the amplifier region of a raw CCD image. More...
 

Variables

list __ALL__ = ['assembleAmplifierImage', 'assembleAmplifierRawImage']
 
dictionary _SliceDict
 

Function Documentation

def lsst.afw.cameraGeom.assembleImage._insertPixelChunk (   outView,
  inView,
  amplifier,
  hasArrays 
)
private

Definition at line 33 of file assembleImage.py.

33 
34 def _insertPixelChunk(outView, inView, amplifier, hasArrays):
35  # For the sake of simplicity and robustness, this code does not short-circuit the case flipX=flipY=False.
36  # However, it would save a bit of time, including the cost of making numpy array views.
37  # If short circuiting is wanted, do it here.
38 
39  xSlice = _SliceDict[amplifier.getRawFlipX()]
40  ySlice = _SliceDict[amplifier.getRawFlipY()]
41  if hasArrays:
42  # MaskedImage
43  inArrList = inView.getArrays()
44  outArrList = outView.getArrays()
45  else:
46  inArrList = [inView.getArray()]
47  outArrList = [outView.getArray()]
48 
49  for inArr, outArr in itertools.izip(inArrList, outArrList):
50  outArr[:] = inArr[ySlice, xSlice] # y,x because numpy arrays are transposed w.r.t. afw Images
def lsst.afw.cameraGeom.assembleImage.assembleAmplifierImage (   destImage,
  rawImage,
  amplifier 
)

Assemble the amplifier region of an image from a raw image.

Parameters
[in,out]destImageassembled image (lsst.afw.image.Image or MaskedImage); the region amplifier.getBBox() is overwritten with the assembled amplifier image
[in]rawImageraw image (same type as destImage)
[in]amplifieramplifier geometry: lsst.afw.cameraGeom.Amplifier with raw amplifier info
Exceptions
RuntimeErrorif:
  • image types do not match
  • amplifier has no raw amplifier info

Definition at line 51 of file assembleImage.py.

51 
52 def assembleAmplifierImage(destImage, rawImage, amplifier):
53  """!Assemble the amplifier region of an image from a raw image
54 
55  @param[in,out] destImage assembled image (lsst.afw.image.Image or MaskedImage);
56  the region amplifier.getBBox() is overwritten with the assembled amplifier image
57  @param[in] rawImage raw image (same type as destImage)
58  @param[in] amplifier amplifier geometry: lsst.afw.cameraGeom.Amplifier with raw amplifier info
59 
60  @throw RuntimeError if:
61  - image types do not match
62  - amplifier has no raw amplifier info
63  """
64  if not amplifier.getHasRawInfo():
65  raise RuntimeError("amplifier must contain raw amplifier info")
66  if type(destImage.Factory) != type(rawImage.Factory):
67  raise RuntimeError("destImage type = %s != %s = rawImage type" % \
68  type(destImage.Factory).__name__, type(rawImage.Factory).__name__)
69  inView = rawImage.Factory(rawImage, amplifier.getRawDataBBox(), False)
70  outView = destImage.Factory(destImage, amplifier.getBBox(), False)
71 
72  _insertPixelChunk(outView, inView, amplifier, hasattr(rawImage, "getArrays"))
def assembleAmplifierImage
Assemble the amplifier region of an image from a raw image.
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
[in,out]destImageCCD image (lsst.afw.image.Image or MaskedImage); the region amplifier.getRawAmplifier().getBBox() is overwritten with the raw amplifier image
[in]rawImageraw image (same type as destImage)
[in]amplifieramplifier geometry: lsst.afw.cameraGeom.Amplifier with raw amplifier info
Exceptions
RuntimeErrorif:
  • image types do not match
  • amplifier has no raw amplifier info

Definition at line 73 of file assembleImage.py.

73 
74 def assembleAmplifierRawImage(destImage, rawImage, amplifier):
75  """!Assemble the amplifier region of a raw CCD image
76 
77  For most cameras this is a no-op: the raw image already is an assembled CCD image.
78  However, it is useful for camera such as LSST for which each amplifier image is a separate image.
79 
80  @param[in,out] destImage CCD image (lsst.afw.image.Image or MaskedImage);
81  the region amplifier.getRawAmplifier().getBBox() is overwritten with the raw amplifier image
82  @param[in] rawImage raw image (same type as destImage)
83  @param[in] amplifier amplifier geometry: lsst.afw.cameraGeom.Amplifier with raw amplifier info
84 
85  @throw RuntimeError if:
86  - image types do not match
87  - amplifier has no raw amplifier info
88  """
89  if not amplifier.getHasRawInfo():
90  raise RuntimeError("amplifier must contain raw amplifier info")
91  if type(destImage.Factory) != type(rawImage.Factory):
92  raise RuntimeError("destImage type = %s != %s = rawImage type" % \
93  type(destImage.Factory).__name__, type(rawImage.Factory).__name__)
94  inBBox = amplifier.getRawBBox()
95  inView = rawImage.Factory(rawImage, inBBox, False)
96  outBBox = amplifier.getRawBBox()
97  outBBox.shift(amplifier.getRawXYOffset())
98  outView = destImage.Factory(destImage, outBBox, False)
99 
100  _insertPixelChunk(outView, inView, amplifier, hasattr(rawImage, "getArrays"))
def assembleAmplifierRawImage
Assemble the amplifier region of a raw CCD image.

Variable Documentation

list lsst.afw.cameraGeom.assembleImage.__ALL__ = ['assembleAmplifierImage', 'assembleAmplifierRawImage']

Definition at line 25 of file assembleImage.py.

dictionary lsst.afw.cameraGeom.assembleImage._SliceDict
Initial value:
1 = {
2  False: slice(None,None,1),
3  True: slice(None,None,-1),
4 }

Definition at line 28 of file assembleImage.py.