115 """Generate a simulated ISR LSST image.
119 exposure : `lsst.afw.image.Exposure` or `dict`
120 Simulated ISR image data.
124 This method constructs a "raw" data image.
131 for idx, amp
in enumerate(exposure.getDetector()):
135 if self.config.isTrimmed:
138 bbox = amp.getRawDataBBox().shiftedBy(amp.getRawXYOffset())
140 ampData = exposure.image[bbox]
143 if self.config.doAddSky:
144 self.
amplifierAddNoise(ampData, self.config.skyLevel, np.sqrt(self.config.skyLevel))
146 if self.config.doAddSource:
147 for sourceAmp, sourceFlux, sourceX, sourceY
in zip(self.config.sourceAmp,
148 self.config.sourceFlux,
150 self.config.sourceY):
155 if self.config.doAddFringe:
157 x0=np.array(self.config.fringeX0),
158 y0=np.array(self.config.fringeY0))
160 if self.config.doAddFlat:
161 if ampData.getArray().sum() == 0.0:
163 u0 = exposure.getDimensions().getX()
164 v0 = exposure.getDimensions().getY()
169 if self.config.doAddDark:
171 self.config.darkRate * self.config.darkTime,
172 np.sqrt(self.config.darkRate * self.config.darkTime))
177 if self.config.doApplyGain:
178 self.
applyGain(ampData, self.config.gain)
182 self.
amplifierAddNoise(ampData, self.config.biasLevel
if self.config.doAddBias
else 0.0,
183 self.config.readNoise / self.config.gain)
186 if self.config.doAddCrosstalk:
188 for idxS, ampS
in enumerate(exposure.getDetector()):
189 for idxT, ampT
in enumerate(exposure.getDetector()):
190 ampDataT = exposure.image[ampT.getBBox()
if self.config.isTrimmed
191 else ampT.getRawDataBBox().shiftedBy(ampT.getRawXYOffset())]
192 outAmp = ctCalib.extractAmp(exposure.getImage(), ampS, ampT,
193 isTrimmed=self.config.isTrimmed)
197 for amp
in exposure.getDetector():
200 if self.config.isTrimmed:
203 bbox = amp.getRawDataBBox().shiftedBy(amp.getRawXYOffset())
204 ampData = exposure.image[bbox]
207 if not self.config.isTrimmed:
208 parallelOscanBBox = amp.getRawParallelOverscanBBox().shiftedBy(amp.getRawXYOffset())
209 parallelOscanData = exposure.image[parallelOscanBBox]
211 serialOscanBBox = amp.getRawSerialOverscanBBox().shiftedBy(amp.getRawXYOffset())
214 if self.config.doAddParallelOverscan:
215 if not self.config.isTrimmed:
219 if self.config.doAddBias
else 0.0,
220 self.config.readNoise / self.config.gain)
224 1.0 * self.config.overscanScale)
228 1.0 * self.config.overscanScale)
233 if self.config.doAddSerialOverscan:
234 if not self.config.isTrimmed:
238 grownImageBBox = bbox.expandedTo(parallelOscanBBox)
243 grownImageBBox.getMinY()),
245 grownImageBBox.getHeight()),
247 serialOscanData = exposure.image[serialOscanBBox]
252 if self.config.doAddBias
else 0.0,
253 self.config.readNoise / self.config.gain)
258 1.0 * self.config.overscanScale)
260 1.0 * self.config.overscanScale)
264 1.0 * self.config.overscanScale)
266 if self.config.doGenerateAmpDict:
268 for amp
in exposure.getDetector():
269 expDict[amp.getName()] = exposure