LSST Applications g063fba187b+cac8b7c890,g0f08755f38+6aee506743,g1653933729+a8ce1bb630,g168dd56ebc+a8ce1bb630,g1a2382251a+b4475c5878,g1dcb35cd9c+8f9bc1652e,g20f6ffc8e0+6aee506743,g217e2c1bcf+73dee94bd0,g28da252d5a+1f19c529b9,g2bbee38e9b+3f2625acfc,g2bc492864f+3f2625acfc,g3156d2b45e+6e55a43351,g32e5bea42b+1bb94961c2,g347aa1857d+3f2625acfc,g35bb328faa+a8ce1bb630,g3a166c0a6a+3f2625acfc,g3e281a1b8c+c5dd892a6c,g3e8969e208+a8ce1bb630,g414038480c+5927e1bc1e,g41af890bb2+8a9e676b2a,g7af13505b9+809c143d88,g80478fca09+6ef8b1810f,g82479be7b0+f568feb641,g858d7b2824+6aee506743,g89c8672015+f4add4ffd5,g9125e01d80+a8ce1bb630,ga5288a1d22+2903d499ea,gb58c049af0+d64f4d3760,gc28159a63d+3f2625acfc,gcab2d0539d+b12535109e,gcf0d15dbbd+46a3f46ba9,gda6a2b7d83+46a3f46ba9,gdaeeff99f8+1711a396fd,ge79ae78c31+3f2625acfc,gef2f8181fd+0a71e47438,gf0baf85859+c1f95f4921,gfa517265be+6aee506743,gfa999e8aa5+17cd334064,w.2024.51
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.