LSST Applications g0f08755f38+9c285cab97,g1635faa6d4+13f3999e92,g1653933729+a8ce1bb630,g1a0ca8cf93+bf6eb00ceb,g28da252d5a+0829b12dee,g29321ee8c0+5700dc9eac,g2bbee38e9b+9634bc57db,g2bc492864f+9634bc57db,g2cdde0e794+c2c89b37c4,g3156d2b45e+41e33cbcdc,g347aa1857d+9634bc57db,g35bb328faa+a8ce1bb630,g3a166c0a6a+9634bc57db,g3e281a1b8c+9f2c4e2fc3,g414038480c+077ccc18e7,g41af890bb2+fde0dd39b6,g5fbc88fb19+17cd334064,g781aacb6e4+a8ce1bb630,g80478fca09+55a9465950,g82479be7b0+d730eedb7d,g858d7b2824+9c285cab97,g9125e01d80+a8ce1bb630,g9726552aa6+10f999ec6a,ga5288a1d22+2a84bb7594,gacf8899fa4+c69c5206e8,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gc28159a63d+9634bc57db,gcf0d15dbbd+4b7d09cae4,gda3e153d99+9c285cab97,gda6a2b7d83+4b7d09cae4,gdaeeff99f8+1711a396fd,ge2409df99d+5e831397f4,ge79ae78c31+9634bc57db,gf0baf85859+147a0692ba,gf3967379c6+41c94011de,gf3fb38a9a8+8f07a9901b,gfb92a5be7c+9c285cab97,w.2024.46
LSST Data Management Base Package
Loading...
Searching...
No Matches
Classes | Functions | Variables
lsst.afw.cameraGeom._assembleImage Namespace Reference

Classes

class  AmplifierIsolator
 

Functions

 _insertPixelChunk (outView, inView, amplifier)
 
 assembleAmplifierImage (destImage, rawImage, amplifier)
 
 assembleAmplifierRawImage (destImage, rawImage, amplifier)
 
 makeUpdatedDetector (ccd)
 

Variables

dict _SliceDict
 

Function Documentation

◆ _insertPixelChunk()

lsst.afw.cameraGeom._assembleImage._insertPixelChunk ( outView,
inView,
amplifier )
protected

Definition at line 32 of file _assembleImage.py.

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

◆ assembleAmplifierImage()

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 51 of file _assembleImage.py.

51def assembleAmplifierImage(destImage, rawImage, amplifier):
52 """Assemble the amplifier region of an image from a raw image.
53
54 Parameters
55 ----------
56 destImage : `lsst.afw.image.Image` or `lsst.afw.image.MaskedImage`
57 Assembled image; the region amplifier.getBBox() is overwritten with
58 the assembled amplifier image.
59 rawImage : `lsst.afw.image.Image` or `lsst.afw.image.MaskedImage`
60 Raw image (same type as destImage).
61 amplifier : `lsst.afw.cameraGeom.Amplifier`
62 Amplifier geometry, with raw amplifier info.
63
64 Raises
65 ------
66 RuntimeError
67 Raised if image types do not match or amplifier has no raw amplifier info.
68 """
69 if type(destImage.Factory) != type(rawImage.Factory): # noqa: E721
70 raise RuntimeError(f"destImage type = {type(destImage.Factory).__name__} != "
71 f"{type(rawImage.Factory).__name__} = rawImage type")
72 inView = rawImage.Factory(rawImage, amplifier.getRawDataBBox())
73 outView = destImage.Factory(destImage, amplifier.getBBox())
74
75 _insertPixelChunk(outView, inView, amplifier)
76
77

◆ assembleAmplifierRawImage()

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 78 of file _assembleImage.py.

78def assembleAmplifierRawImage(destImage, rawImage, amplifier):
79 """Assemble the amplifier region of a raw CCD image.
80
81 For most cameras this is a no-op: the raw image already is an assembled
82 CCD image.
83 However, it is useful for camera such as LSST for which each amplifier
84 image is a separate image.
85
86 Parameters
87 ----------
88 destImage : `lsst.afw.image.Image` or `lsst.afw.image.MaskedImage`
89 CCD Image; the region amplifier.getRawAmplifier().getBBox()
90 is overwritten with the raw amplifier image.
91 rawImage : `lsst.afw.image.Image` or `lsst.afw.image.MaskedImage`
92 Raw image (same type as destImage).
93 amplifier : `lsst.afw.cameraGeom.Amplifier`
94 Amplifier geometry with raw amplifier info
95
96 Raises
97 ------
98 RuntimeError
99 Raised if image types do not match or amplifier has no raw amplifier info.
100 """
101 if type(destImage.Factory) != type(rawImage.Factory): # noqa: E721
102 raise RuntimeError(f"destImage type = {type(destImage.Factory).__name__} != "
103 f"{type(rawImage.Factory).__name__} = rawImage type")
104 inBBox = amplifier.getRawBBox()
105 inView = rawImage.Factory(rawImage, inBBox)
106 outBBox = amplifier.getRawBBox()
107 outBBox.shift(amplifier.getRawXYOffset())
108 outView = destImage.Factory(destImage, outBBox)
109
110 _insertPixelChunk(outView, inView, amplifier)
111
112

◆ makeUpdatedDetector()

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 113 of file _assembleImage.py.

113def makeUpdatedDetector(ccd):
114 """Return a Detector that has had the definitions of amplifier geometry
115 updated post assembly.
116
117 Parameters
118 ----------
119 ccd : `lsst.afw.image.Detector`
120 The detector to copy and update.
121 """
122 builder = ccd.rebuild()
123 for amp in builder.getAmplifiers():
124 amp.transform()
125 return builder.finish()
126
127

Variable Documentation

◆ _SliceDict

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

Definition at line 26 of file _assembleImage.py.