1 from __future__
import absolute_import, division
25 __ALL__ = [
'assembleAmplifierImage',
'assembleAmplifierRawImage']
29 False: slice(
None,
None,1),
30 True: slice(
None,
None,-1),
38 xSlice = _SliceDict[amplifier.getRawFlipX()]
39 ySlice = _SliceDict[amplifier.getRawFlipY()]
42 inArrList = inView.getArrays()
43 outArrList = outView.getArrays()
45 inArrList = [inView.getArray()]
46 outArrList = [outView.getArray()]
48 for inArr, outArr
in itertools.izip(inArrList, outArrList):
49 outArr[:] = inArr[ySlice, xSlice]
52 """!Assemble the amplifier region of an image from a raw image
54 @param[in,out] destImage assembled image (lsst.afw.image.Image or MaskedImage);
55 the region amplifier.getBBox() is overwritten with the assembled amplifier image
56 @param[in] rawImage raw image (same type as destImage)
57 @param[in] amplifier amplifier geometry: lsst.afw.cameraGeom.Amplifier with raw amplifier info
59 @throw RuntimeError if:
60 - image types do not match
61 - amplifier has no raw amplifier info
63 if not amplifier.getHasRawInfo():
64 raise RuntimeError(
"amplifier must contain raw amplifier info")
65 if type(destImage.Factory) != type(rawImage.Factory):
66 raise RuntimeError(
"destImage type = %s != %s = rawImage type" % \
67 type(destImage.Factory).__name__, type(rawImage.Factory).__name__)
68 inView = rawImage.Factory(rawImage, amplifier.getRawDataBBox(),
False)
69 outView = destImage.Factory(destImage, amplifier.getBBox(),
False)
74 """!Assemble the amplifier region of a raw CCD image
76 For most cameras this is a no-op: the raw image already is an assembled CCD image.
77 However, it is useful for camera such as LSST for which each amplifier image is a separate image.
79 @param[in,out] destImage CCD image (lsst.afw.image.Image or MaskedImage);
80 the region amplifier.getRawAmplifier().getBBox() is overwritten with the raw amplifier image
81 @param[in] rawImage raw image (same type as destImage)
82 @param[in] amplifier amplifier geometry: lsst.afw.cameraGeom.Amplifier with raw amplifier info
84 @throw RuntimeError if:
85 - image types do not match
86 - amplifier has no raw amplifier info
88 if not amplifier.getHasRawInfo():
89 raise RuntimeError(
"amplifier must contain raw amplifier info")
90 if type(destImage.Factory) != type(rawImage.Factory):
91 raise RuntimeError(
"destImage type = %s != %s = rawImage type" % \
92 type(destImage.Factory).__name__, type(rawImage.Factory).__name__)
93 inBBox = amplifier.getRawBBox()
94 inView = rawImage.Factory(rawImage, inBBox,
False)
95 outBBox = amplifier.getRawBBox()
96 outBBox.shift(amplifier.getRawXYOffset())
97 outView = destImage.Factory(destImage, outBBox,
False)
def assembleAmplifierRawImage
Assemble the amplifier region of a raw CCD image.
def assembleAmplifierImage
Assemble the amplifier region of an image from a raw image.