232 self.
bfKernel = np.array([[4.83499829e-01, 8.10171823e-01, 5.31096720e-01,
233 3.54369868e-02, -8.44782871e-01, -1.64614462e+00,
234 -3.83933101e+00, -5.60243416e+00, -6.51691578e+00,
235 -5.60243416e+00, -3.83933101e+00, -1.64614462e+00,
236 -8.44782871e-01, 3.54369868e-02, 5.31096720e-01,
237 8.10171823e-01, 4.83499829e-01],
238 [1.12382749e+00, 2.22609074e+00, 1.27877807e+00,
239 4.55434098e-01, -1.76842385e+00, -1.90046460e+00,
240 -8.10874526e+00, -1.20534899e+01, -1.48627948e+01,
241 -1.20534899e+01, -8.10874526e+00, -1.90046460e+00,
242 -1.76842385e+00, 4.55434098e-01, 1.27877807e+00,
243 2.22609074e+00, 1.12382749e+00],
244 [1.78571940e+00, 4.38918110e+00, 3.95098587e+00,
245 3.70961649e-01, -3.48151981e+00, -9.61567736e+00,
246 -1.78621172e+01, -2.32278872e+01, -2.31833727e+01,
247 -2.32278872e+01, -1.78621172e+01, -9.61567736e+00,
248 -3.48151981e+00, 3.70961649e-01, 3.95098587e+00,
249 4.38918110e+00, 1.78571940e+00],
250 [1.62986900e+00, 3.67851228e+00, 5.68645252e+00,
251 2.15342566e-01, -8.89937202e+00, -1.44739813e+01,
252 -2.98952660e+01, -4.37420817e+01, -4.83160958e+01,
253 -4.37420817e+01, -2.98952660e+01, -1.44739813e+01,
254 -8.89937202e+00, 2.15342566e-01, 5.68645252e+00,
255 3.67851228e+00, 1.62986900e+00],
256 [1.05524430e+00, 1.71917897e+00, 1.73105590e+00,
257 -2.10088420e+00, -1.15118208e+01, -2.55007598e+01,
258 -4.73056159e+01, -6.97257685e+01, -8.09264433e+01,
259 -6.97257685e+01, -4.73056159e+01, -2.55007598e+01,
260 -1.15118208e+01, -2.10088420e+00, 1.73105590e+00,
261 1.71917897e+00, 1.05524430e+00],
262 [8.71929228e-01, 5.41025574e-01, 9.47560771e-01,
263 -5.75314708e-01, -7.46104027e+00, -4.42314481e+01,
264 -9.54126971e+01, -1.61603201e+02, -2.07520692e+02,
265 -1.61603201e+02, -9.54126971e+01, -4.42314481e+01,
266 -7.46104027e+00, -5.75314708e-01, 9.47560771e-01,
267 5.41025574e-01, 8.71929228e-01],
268 [1.89144704e+00, 3.57543979e+00, -6.91419168e-02,
269 -3.37950835e+00, -1.46695089e+01, -7.22850746e+01,
270 -1.65563055e+02, -3.10820425e+02, -4.70026655e+02,
271 -3.10820425e+02, -1.65563055e+02, -7.22850746e+01,
272 -1.46695089e+01, -3.37950835e+00, -6.91419168e-02,
273 3.57543979e+00, 1.89144704e+00],
274 [3.11841913e+00, 7.84024994e+00, 1.88495248e+00,
275 -7.69011009e+00, -2.71782400e+01, -1.04343326e+02,
276 -2.47561370e+02, -5.32959841e+02, -1.16529012e+03,
277 -5.32959841e+02, -2.47561370e+02, -1.04343326e+02,
278 -2.71782400e+01, -7.69011009e+00, 1.88495248e+00,
279 7.84024994e+00, 3.11841913e+00],
280 [2.74197956e+00, 4.73107997e+00, -9.48352966e-01,
281 -9.44822832e+00, -3.06477671e+01, -1.26788739e+02,
282 -3.22828411e+02, -8.47943472e+02, -3.87702420e+03,
283 -8.47943472e+02, -3.22828411e+02, -1.26788739e+02,
284 -3.06477671e+01, -9.44822832e+00, -9.48352966e-01,
285 4.73107997e+00, 2.74197956e+00],
286 [3.11841913e+00, 7.84024994e+00, 1.88495248e+00,
287 -7.69011009e+00, -2.71782400e+01, -1.04343326e+02,
288 -2.47561370e+02, -5.32959841e+02, -1.16529012e+03,
289 -5.32959841e+02, -2.47561370e+02, -1.04343326e+02,
290 -2.71782400e+01, -7.69011009e+00, 1.88495248e+00,
291 7.84024994e+00, 3.11841913e+00],
292 [1.89144704e+00, 3.57543979e+00, -6.91419168e-02,
293 -3.37950835e+00, -1.46695089e+01, -7.22850746e+01,
294 -1.65563055e+02, -3.10820425e+02, -4.70026655e+02,
295 -3.10820425e+02, -1.65563055e+02, -7.22850746e+01,
296 -1.46695089e+01, -3.37950835e+00, -6.91419168e-02,
297 3.57543979e+00, 1.89144704e+00],
298 [8.71929228e-01, 5.41025574e-01, 9.47560771e-01,
299 -5.75314708e-01, -7.46104027e+00, -4.42314481e+01,
300 -9.54126971e+01, -1.61603201e+02, -2.07520692e+02,
301 -1.61603201e+02, -9.54126971e+01, -4.42314481e+01,
302 -7.46104027e+00, -5.75314708e-01, 9.47560771e-01,
303 5.41025574e-01, 8.71929228e-01],
304 [1.05524430e+00, 1.71917897e+00, 1.73105590e+00,
305 -2.10088420e+00, -1.15118208e+01, -2.55007598e+01,
306 -4.73056159e+01, -6.97257685e+01, -8.09264433e+01,
307 -6.97257685e+01, -4.73056159e+01, -2.55007598e+01,
308 -1.15118208e+01, -2.10088420e+00, 1.73105590e+00,
309 1.71917897e+00, 1.05524430e+00],
310 [1.62986900e+00, 3.67851228e+00, 5.68645252e+00,
311 2.15342566e-01, -8.89937202e+00, -1.44739813e+01,
312 -2.98952660e+01, -4.37420817e+01, -4.83160958e+01,
313 -4.37420817e+01, -2.98952660e+01, -1.44739813e+01,
314 -8.89937202e+00, 2.15342566e-01, 5.68645252e+00,
315 3.67851228e+00, 1.62986900e+00],
316 [1.78571940e+00, 4.38918110e+00, 3.95098587e+00,
317 3.70961649e-01, -3.48151981e+00, -9.61567736e+00,
318 -1.78621172e+01, -2.32278872e+01, -2.31833727e+01,
319 -2.32278872e+01, -1.78621172e+01, -9.61567736e+00,
320 -3.48151981e+00, 3.70961649e-01, 3.95098587e+00,
321 4.38918110e+00, 1.78571940e+00],
322 [1.12382749e+00, 2.22609074e+00, 1.27877807e+00,
323 4.55434098e-01, -1.76842385e+00, -1.90046460e+00,
324 -8.10874526e+00, -1.20534899e+01, -1.48627948e+01,
325 -1.20534899e+01, -8.10874526e+00, -1.90046460e+00,
326 -1.76842385e+00, 4.55434098e-01, 1.27877807e+00,
327 2.22609074e+00, 1.12382749e+00],
328 [4.83499829e-01, 8.10171823e-01, 5.31096720e-01,
329 3.54369868e-02, -8.44782871e-01, -1.64614462+00,
330 -3.83933101e+00, -5.60243416e+00, -6.51691578e+00,
331 -5.60243416e+00, -3.83933101e+00, -1.64614462e+00,
332 -8.44782871e-01, 3.54369868e-02, 5.31096720e-01,
333 8.10171823e-01, 4.83499829e-01]]) * 1e-10
341 129.0, 151.9, 179.4, 211.9, 250.5, 296.2, 350.0,
342 413.5, 488.0, 576.0, 680.4, 753.0, 888.2, 1040.5,
343 1254.1, 1478.9, 1747.0, 2055.7, 2416.9, 2855.2,
344 3361.9, 3969.4, 4665.9, 5405.3, 6380.0, 7516.7,
345 8875.9, 10488.6, 12681.9, 14974.2, 17257.6, 20366.5,
346 24026.7, 28372.1, 33451.7, 39550.4, 46624.8, 55042.9,
347 64862.7, 76503.1, 90265.6, 106384.2, 0.0, 0.0, 0.0,
348 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1,
349 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0,
350 0.1, 0.2, 0.6, 0.1, 0.0, 0.1, 0.0, 0.6, 0.3, 0.5, 0.8,
351 0.8, 1.5, 2.0, 1.8, 2.4, 2.6, 3.7, 5.0, 6.4, 8.4, 10.9,
362 'decayTime': {
'C:0,0': 2.30,
370 'globalCti': {
'C:0,0': 5.25e-07,
378 'signals': {
'C:0,0': np.linspace(1.0e2, 1.0e5, 10),
379 'C:0,1': np.linspace(1.0e2, 1.0e5, 10),
380 'C:0,2': np.linspace(1.0e2, 1.0e5, 10),
381 'C:0,3': np.linspace(1.0e2, 1.0e5, 10),
382 'C:1,0': np.linspace(1.0e2, 1.0e5, 10),
383 'C:1,1': np.linspace(1.0e2, 1.0e5, 10),
384 'C:1,2': np.linspace(1.0e2, 1.0e5, 10),
385 'C:1,3': np.linspace(1.0e2, 1.0e5, 10)},
386 'serialEper': {
'C:0,0': np.full(10, 5.25e-07),
387 'C:0,1': np.full(10, 5.38e-07),
388 'C:0,2': np.full(10, 5.80e-07),
389 'C:0,3': np.full(10, 5.91e-07),
390 'C:1,0': np.full(10, 6.24e-07),
391 'C:1,1': np.full(10, 5.72e-07),
392 'C:1,2': np.full(10, 5.60e-07),
393 'C:1,3': np.full(10, 4.40e-07)},
394 'parallelEper': {
'C:0,0': np.full(10, 5.25e-07),
395 'C:0,1': np.full(10, 5.38e-07),
396 'C:0,2': np.full(10, 5.80e-07),
397 'C:0,3': np.full(10, 5.91e-07),
398 'C:1,0': np.full(10, 6.24e-07),
399 'C:1,1': np.full(10, 5.72e-07),
400 'C:1,2': np.full(10, 5.60e-07),
401 'C:1,3': np.full(10, 4.40e-07)},
402 'serialCtiTurnoff': {
'C:0,0': 1.0e5,
410 'parallelCtiTurnoff': {
'C:0,0': 1.0e5,
418 'serialCtiTurnoffSamplingErr': {
'C:0,0': 1.0e3,
426 'parallelCtiTurnoffSamplingErr': {
'C:0,0': 1.0e3,
434 'serialTraps': {
'C:0,0': {
'size': 20000.0,
437 'trap_type':
'spline',
439 'C:0,1': {
'size': 20000.0,
442 'trap_type':
'spline',
444 'C:0,2': {
'size': 20000.0,
447 'trap_type':
'spline',
449 'C:0,3': {
'size': 20000.0,
452 'trap_type':
'spline',
454 'C:1,0': {
'size': 20000.0,
457 'trap_type':
'spline',
459 'C:1,1': {
'size': 20000.0,
462 'trap_type':
'spline',
464 'C:1,2': {
'size': 20000.0,
467 'trap_type':
'spline',
469 'C:1,3': {
'size': 20000.0,
472 'trap_type':
'spline',
479 self.makeSubtask(
"assembleCcd")
508 """Generate a simulated ISR LSST image.
512 exposure : `lsst.afw.image.Exposure` or `dict`
513 Simulated ISR image data.
517 This method constructs a "raw" data image.
523 rngSky = np.random.RandomState(seed=self.config.rngSeed + 1)
524 rngDark = np.random.RandomState(seed=self.config.rngSeed + 2)
525 rng2DBias = np.random.RandomState(seed=self.config.rngSeed + 3)
526 rngOverscan = np.random.RandomState(seed=self.config.rngSeed + 4)
527 rngReadNoise = np.random.RandomState(seed=self.config.rngSeed + 5)
528 rngBrighterFatter = galsim.BaseDeviate(self.config.rngSeed + 6)
531 if self.config.doAddHighSignalNonlinearity:
537 for idx, amp
in enumerate(exposure.getDetector()):
540 if self.config.isTrimmed:
544 bbox = amp.getRawDataBBox()
545 bboxFull = amp.getRawBBox()
548 ampImageData = exposure.image[bbox]
550 ampFullData = exposure.image[bboxFull]
556 if self.config.doAddSky:
560 self.config.skyLevel,
561 np.sqrt(self.config.skyLevel),
565 if self.config.doAddSource:
566 for sourceAmp, sourceFlux, sourceX, sourceY
in zip(self.config.sourceAmp,
567 self.config.sourceFlux,
569 self.config.sourceY):
574 if self.config.doAddFringe:
578 np.array(self.config.fringeScale),
579 x0=np.array(self.config.fringeX0),
580 y0=np.array(self.config.fringeY0))
582 if self.config.doAddFlat:
583 if self.config.calibMode:
588 u0 = exposure.getDetector().getBBox().getDimensions().getX()/2.
589 v0 = exposure.getDetector().getBBox().getDimensions().getY()/2.
595 if self.config.doAddBrightDefects:
598 for defect
in defectList:
599 exposure.image[defect.getBBox()] = self.config.brightDefectLevel
601 for idx, amp
in enumerate(exposure.getDetector()):
604 if self.config.isTrimmed:
608 bbox = amp.getRawDataBBox()
609 bboxFull = amp.getRawBBox()
612 ampImageData = exposure.image[bbox]
614 ampFullData = exposure.image[bboxFull]
617 if self.config.doAddDark
or self.config.doAddDarkNoiseOnly:
618 if self.config.doAddDarkNoiseOnly:
621 darkLevel = self.config.darkRate * self.config.darkTime
622 if self.config.calibMode:
625 darkNoise = np.sqrt(self.config.darkRate * self.config.darkTime)
630 if self.config.doAddBrighterFatter
is True:
634 self.config.bfStrength,
639 if self.config.doAddDeferredCharge:
644 if self.config.doAdd2DBias:
651 self.config.noise2DBias,
659 if self.config.doAddClockInjectedOffset:
662 self.config.clockInjectedOffsetLevel,
668 if (self.config.doAddParallelOverscanRamp
or self.config.doAddSerialOverscanRamp)
and \
669 not self.config.isTrimmed:
671 if self.config.doAddParallelOverscanRamp:
674 1.0 * self.config.overscanScale)
676 if self.config.doAddSerialOverscanRamp:
679 1.0 * self.config.overscanScale)
683 if self.config.doAddHighSignalNonlinearity:
685 if linearizer.linearityType[amp.getName()] !=
"Spline":
686 raise RuntimeError(
"IsrMockLSST only supports spline non-linearity.")
688 coeffs = linearizer.linearityCoeffs[amp.getName()]
689 centers, values = np.split(coeffs, 2)
693 values[centers < self.config.highSignalNonlinearityThreshold] = 0.0
696 values *= self.config.gainDict[amp.getName()]
705 self.config.clockInjectedOffsetLevel
if self.config.doAddClockInjectedOffset
else 0.0,
712 if not self.config.calibMode:
717 self.config.readNoise,
722 if not self.config.isTrimmed:
723 parallelOverscanBBox = amp.getRawParallelOverscanBBox()
724 parallelOverscanData = exposure.image[parallelOverscanBBox]
727 serialOverscanData = exposure.image[serialOverscanBBox]
732 parallelOverscanData,
734 self.config.readNoise,
740 self.config.readNoise,
745 if self.config.doAddBadParallelOverscanColumn
and not self.config.isTrimmed:
748 amp = exposure.getDetector()[2]
749 parBBox = amp.getRawParallelOverscanBBox()
754 exposure[bboxBad].image.array[:, :] += self.config.badParallelOverscanColumnLevel
756 if self.config.doAddBadParallelOverscanColumnNeighbors:
757 for neighbor
in [49, 51]:
762 exposure[bboxBad].image.array[:, :] += self.config.badParallelOverscanColumnNeighborsLevel
766 if self.config.doAddCrosstalk:
773 ctCalib.subtractCrosstalk(
776 doSubtrahendMasking=
True,
777 minPixelToMask=1e100,
782 for amp
in exposure.getDetector():
785 if self.config.isTrimmed:
789 bbox = amp.getRawDataBBox()
790 bboxFull = amp.getRawBBox()
793 ampImageData = exposure.image[bbox]
795 ampFullData = exposure.image[bboxFull]
798 if self.config.doApplyGain:
799 gain = self.config.gainDict.get(amp.getName(), self.config.gain)
804 if self.config.doAddBias:
808 if self.config.doRoundAdu:
812 if self.config.calibMode:
813 if self.config.doApplyGain:
814 exposure.metadata[
"LSST ISR UNITS"] =
"adu"
816 exposure.metadata[
"LSST ISR UNITS"] =
"electron"
820 exposure.variance.array[:, :] = np.abs(np.median(exposure.image.array)/10.)
822 if self.config.doGenerateAmpDict:
824 for amp
in exposure.getDetector():
825 expDict[amp.getName()] = exposure