LSST Applications 27.0.0,g0265f82a02+469cd937ee,g02d81e74bb+21ad69e7e1,g1470d8bcf6+cbe83ee85a,g2079a07aa2+e67c6346a6,g212a7c68fe+04a9158687,g2305ad1205+94392ce272,g295015adf3+81dd352a9d,g2bbee38e9b+469cd937ee,g337abbeb29+469cd937ee,g3939d97d7f+72a9f7b576,g487adcacf7+71499e7cba,g50ff169b8f+5929b3527e,g52b1c1532d+a6fc98d2e7,g591dd9f2cf+df404f777f,g5a732f18d5+be83d3ecdb,g64a986408d+21ad69e7e1,g858d7b2824+21ad69e7e1,g8a8a8dda67+a6fc98d2e7,g99cad8db69+f62e5b0af5,g9ddcbc5298+d4bad12328,ga1e77700b3+9c366c4306,ga8c6da7877+71e4819109,gb0e22166c9+25ba2f69a1,gb6a65358fc+469cd937ee,gbb8dafda3b+69d3c0e320,gc07e1c2157+a98bf949bb,gc120e1dc64+615ec43309,gc28159a63d+469cd937ee,gcf0d15dbbd+72a9f7b576,gdaeeff99f8+a38ce5ea23,ge6526c86ff+3a7c1ac5f1,ge79ae78c31+469cd937ee,gee10cc3b42+a6fc98d2e7,gf1cff7945b+21ad69e7e1,gfbcc870c63+9a11dc8c8f
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Static Protected Attributes | List of all members
lsst.ip.isr.isrMock.IsrMock Class Reference
Inheritance diagram for lsst.ip.isr.isrMock.IsrMock:
lsst.ip.isr.isrMock.BfKernelMock lsst.ip.isr.isrMock.CrosstalkCoeffMock lsst.ip.isr.isrMock.DefectMock lsst.ip.isr.isrMock.MasterMock lsst.ip.isr.isrMock.RawMock lsst.ip.isr.isrMock.TransmissionMock lsst.ip.isr.isrMockLSST.IsrMockLSST lsst.ip.isr.isrMock.BiasMock lsst.ip.isr.isrMock.DarkMock lsst.ip.isr.isrMock.FlatMock lsst.ip.isr.isrMock.FringeMock lsst.ip.isr.isrMock.CalibratedRawMock lsst.ip.isr.isrMock.RawDictMock lsst.ip.isr.isrMock.TrimmedRawMock lsst.ip.isr.isrMockLSST.BfKernelMockLSST lsst.ip.isr.isrMockLSST.CrosstalkCoeffMockLSST lsst.ip.isr.isrMockLSST.DefectMockLSST lsst.ip.isr.isrMockLSST.RawMockLSST lsst.ip.isr.isrMockLSST.ReferenceMockLSST lsst.ip.isr.isrMockLSST.TransmissionMockLSST

Public Member Functions

 __init__ (self, **kwargs)
 
 run (self)
 
 makeData (self)
 
 makeBfKernel (self)
 
 makeDefectList (self)
 
 makeCrosstalkCoeff (self)
 
 makeTransmissionCurve (self)
 
 makeImage (self)
 
 getCamera (self)
 
 getExposure (self)
 
 getWcs (self)
 
 localCoordToExpCoord (self, ampData, x, y)
 
 amplifierAddNoise (self, ampData, mean, sigma)
 
 amplifierAddYGradient (self, ampData, start, end)
 
 amplifierAddSource (self, ampData, scale, x0, y0)
 
 amplifierAddCT (self, ampDataSource, ampDataTarget, scale)
 
 amplifierAddFringe (self, amp, ampData, scale, x0=100, y0=0)
 
 amplifierMultiplyFlat (self, amp, ampData, fracDrop, u0=100.0, v0=100.0)
 

Public Attributes

 rng
 
 crosstalkCoeffs
 
 bfKernel
 

Static Public Attributes

 ConfigClass = IsrMockConfig
 

Static Protected Attributes

str _DefaultName = "isrMock"
 

Detailed Description

Class to generate consistent mock images for ISR testing.

ISR testing currently relies on one-off fake images that do not
accurately mimic the full set of detector effects. This class
uses the test camera/detector/amplifier structure defined in
`lsst.afw.cameraGeom.testUtils` to avoid making the test data
dependent on any of the actual obs package formats.

Definition at line 254 of file isrMock.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.ip.isr.isrMock.IsrMock.__init__ ( self,
** kwargs )

Reimplemented in lsst.ip.isr.isrMock.RawMock, lsst.ip.isr.isrMock.TrimmedRawMock, lsst.ip.isr.isrMock.CalibratedRawMock, lsst.ip.isr.isrMock.RawDictMock, lsst.ip.isr.isrMock.MasterMock, lsst.ip.isr.isrMock.BiasMock, lsst.ip.isr.isrMock.DarkMock, lsst.ip.isr.isrMock.FlatMock, lsst.ip.isr.isrMock.FringeMock, lsst.ip.isr.isrMock.UntrimmedFringeMock, lsst.ip.isr.isrMock.BfKernelMock, lsst.ip.isr.isrMock.DefectMock, lsst.ip.isr.isrMock.CrosstalkCoeffMock, lsst.ip.isr.isrMock.TransmissionMock, lsst.ip.isr.isrMockLSST.IsrMockLSST, lsst.ip.isr.isrMockLSST.RawMockLSST, lsst.ip.isr.isrMockLSST.TrimmedRawMockLSST, lsst.ip.isr.isrMockLSST.CalibratedRawMockLSST, lsst.ip.isr.isrMockLSST.ReferenceMockLSST, lsst.ip.isr.isrMockLSST.DarkMockLSST, lsst.ip.isr.isrMockLSST.BiasMockLSST, lsst.ip.isr.isrMockLSST.FlatMockLSST, lsst.ip.isr.isrMockLSST.FringeMockLSST, lsst.ip.isr.isrMockLSST.BfKernelMockLSST, lsst.ip.isr.isrMockLSST.DefectMockLSST, lsst.ip.isr.isrMockLSST.CrosstalkCoeffMockLSST, and lsst.ip.isr.isrMockLSST.TransmissionMockLSST.

Definition at line 266 of file isrMock.py.

266 def __init__(self, **kwargs):
267 super().__init__(**kwargs)
268 self.rng = np.random.RandomState(self.config.rngSeed)
269 self.crosstalkCoeffs = np.array([[0.0, 0.0, 0.0, 0.0, 0.0, -1e-3, 0.0, 0.0],
270 [1e-2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
271 [1e-2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
272 [1e-2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
273 [1e-2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
274 [1e-2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
275 [1e-2, 0.0, 0.0, 2.2e-2, 0.0, 0.0, 0.0, 0.0],
276 [1e-2, 5e-3, 5e-4, 3e-3, 4e-2, 5e-3, 5e-3, 0.0]])
277
278 self.bfKernel = np.array([[1., 4., 7., 4., 1.],
279 [4., 16., 26., 16., 4.],
280 [7., 26., 41., 26., 7.],
281 [4., 16., 26., 16., 4.],
282 [1., 4., 7., 4., 1.]]) / 273.0
283

Member Function Documentation

◆ amplifierAddCT()

lsst.ip.isr.isrMock.IsrMock.amplifierAddCT ( self,
ampDataSource,
ampDataTarget,
scale )
Add a scaled copy of an amplifier to another, simulating crosstalk.

 This method operates in the amplifier coordinate frame.

Parameters
----------
ampDataSource : `lsst.afw.image.ImageF`
    Amplifier image to add scaled copy from.
ampDataTarget : `lsst.afw.image.ImageF`
    Amplifier image to add scaled copy to.
scale : `float`
    Flux scale of the copy to add to the target.

Notes
-----
This simulates simple crosstalk between amplifiers.

Definition at line 731 of file isrMock.py.

731 def amplifierAddCT(self, ampDataSource, ampDataTarget, scale):
732 """Add a scaled copy of an amplifier to another, simulating crosstalk.
733
734 This method operates in the amplifier coordinate frame.
735
736 Parameters
737 ----------
738 ampDataSource : `lsst.afw.image.ImageF`
739 Amplifier image to add scaled copy from.
740 ampDataTarget : `lsst.afw.image.ImageF`
741 Amplifier image to add scaled copy to.
742 scale : `float`
743 Flux scale of the copy to add to the target.
744
745 Notes
746 -----
747 This simulates simple crosstalk between amplifiers.
748 """
749 ampDataTarget.array[:] = (ampDataTarget.array[:]
750 + scale * ampDataSource.array[:])
751

◆ amplifierAddFringe()

lsst.ip.isr.isrMock.IsrMock.amplifierAddFringe ( self,
amp,
ampData,
scale,
x0 = 100,
y0 = 0 )
Add a fringe-like ripple pattern to an amplifier's image data.

Parameters
----------
amp : `~lsst.afw.ampInfo.AmpInfoRecord`
    Amplifier to operate on. Needed for amp<->exp coordinate
    transforms.
ampData : `lsst.afw.image.ImageF`
    Amplifier image to operate on.
scale : `numpy.array` or `float`
    Peak intensity scaling for the ripple.
x0 : `numpy.array` or `float`, optional
    Fringe center
y0 : `numpy.array` or `float`, optional
    Fringe center

Notes
-----
This uses an offset sinc function to generate a ripple
pattern. True fringes have much finer structure, but this
pattern should be visually identifiable. The (x, y)
coordinates are in the frame of the amplifier, and (u, v) in
the frame of the full trimmed image.

Definition at line 753 of file isrMock.py.

753 def amplifierAddFringe(self, amp, ampData, scale, x0=100, y0=0):
754 """Add a fringe-like ripple pattern to an amplifier's image data.
755
756 Parameters
757 ----------
758 amp : `~lsst.afw.ampInfo.AmpInfoRecord`
759 Amplifier to operate on. Needed for amp<->exp coordinate
760 transforms.
761 ampData : `lsst.afw.image.ImageF`
762 Amplifier image to operate on.
763 scale : `numpy.array` or `float`
764 Peak intensity scaling for the ripple.
765 x0 : `numpy.array` or `float`, optional
766 Fringe center
767 y0 : `numpy.array` or `float`, optional
768 Fringe center
769
770 Notes
771 -----
772 This uses an offset sinc function to generate a ripple
773 pattern. True fringes have much finer structure, but this
774 pattern should be visually identifiable. The (x, y)
775 coordinates are in the frame of the amplifier, and (u, v) in
776 the frame of the full trimmed image.
777 """
778 for x in range(0, ampData.getDimensions().getX()):
779 for y in range(0, ampData.getDimensions().getY()):
780 (u, v) = self.localCoordToExpCoord(amp, x, y)
781 ampData.getArray()[y][x] = np.sum((ampData.getArray()[y][x]
782 + scale * np.sinc(((u - x0) / 50)**2
783 + ((v - y0) / 50)**2)))
784

◆ amplifierAddNoise()

lsst.ip.isr.isrMock.IsrMock.amplifierAddNoise ( self,
ampData,
mean,
sigma )
Add Gaussian noise to an amplifier's image data.

 This method operates in the amplifier coordinate frame.

Parameters
----------
ampData : `lsst.afw.image.ImageF`
    Amplifier image to operate on.
mean : `float`
    Mean value of the Gaussian noise.
sigma : `float`
    Sigma of the Gaussian noise.

Definition at line 673 of file isrMock.py.

673 def amplifierAddNoise(self, ampData, mean, sigma):
674 """Add Gaussian noise to an amplifier's image data.
675
676 This method operates in the amplifier coordinate frame.
677
678 Parameters
679 ----------
680 ampData : `lsst.afw.image.ImageF`
681 Amplifier image to operate on.
682 mean : `float`
683 Mean value of the Gaussian noise.
684 sigma : `float`
685 Sigma of the Gaussian noise.
686 """
687 ampArr = ampData.array
688 ampArr[:] = ampArr[:] + self.rng.normal(mean, sigma,
689 size=ampData.getDimensions()).transpose()
690

◆ amplifierAddSource()

lsst.ip.isr.isrMock.IsrMock.amplifierAddSource ( self,
ampData,
scale,
x0,
y0 )
Add a single Gaussian source to an amplifier.

 This method operates in the amplifier coordinate frame.

Parameters
----------
ampData : `lsst.afw.image.ImageF`
    Amplifier image to operate on.
scale : `float`
    Peak flux of the source to add.
x0 : `float`
    X-coordinate of the source peak.
y0 : `float`
    Y-coordinate of the source peak.

Definition at line 710 of file isrMock.py.

710 def amplifierAddSource(self, ampData, scale, x0, y0):
711 """Add a single Gaussian source to an amplifier.
712
713 This method operates in the amplifier coordinate frame.
714
715 Parameters
716 ----------
717 ampData : `lsst.afw.image.ImageF`
718 Amplifier image to operate on.
719 scale : `float`
720 Peak flux of the source to add.
721 x0 : `float`
722 X-coordinate of the source peak.
723 y0 : `float`
724 Y-coordinate of the source peak.
725 """
726 for x in range(0, ampData.getDimensions().getX()):
727 for y in range(0, ampData.getDimensions().getY()):
728 ampData.array[y][x] = (ampData.array[y][x]
729 + scale * np.exp(-0.5 * ((x - x0)**2 + (y - y0)**2) / 3.0**2))
730

◆ amplifierAddYGradient()

lsst.ip.isr.isrMock.IsrMock.amplifierAddYGradient ( self,
ampData,
start,
end )
Add a y-axis linear gradient to an amplifier's image data.

 This method operates in the amplifier coordinate frame.

Parameters
----------
ampData : `lsst.afw.image.ImageF`
    Amplifier image to operate on.
start : `float`
    Start value of the gradient (at y=0).
end : `float`
    End value of the gradient (at y=ymax).

Definition at line 691 of file isrMock.py.

691 def amplifierAddYGradient(self, ampData, start, end):
692 """Add a y-axis linear gradient to an amplifier's image data.
693
694 This method operates in the amplifier coordinate frame.
695
696 Parameters
697 ----------
698 ampData : `lsst.afw.image.ImageF`
699 Amplifier image to operate on.
700 start : `float`
701 Start value of the gradient (at y=0).
702 end : `float`
703 End value of the gradient (at y=ymax).
704 """
705 nPixY = ampData.getDimensions().getY()
706 ampArr = ampData.array
707 ampArr[:] = ampArr[:] + (np.interp(range(nPixY), (0, nPixY - 1), (start, end)).reshape(nPixY, 1)
708 + np.zeros(ampData.getDimensions()).transpose())
709

◆ amplifierMultiplyFlat()

lsst.ip.isr.isrMock.IsrMock.amplifierMultiplyFlat ( self,
amp,
ampData,
fracDrop,
u0 = 100.0,
v0 = 100.0 )
Multiply an amplifier's image data by a flat-like pattern.

Parameters
----------
amp : `lsst.afw.ampInfo.AmpInfoRecord`
    Amplifier to operate on. Needed for amp<->exp coordinate
    transforms.
ampData : `lsst.afw.image.ImageF`
    Amplifier image to operate on.
fracDrop : `float`
    Fractional drop from center to edge of detector along x-axis.
u0 : `float`
    Peak location in detector coordinates.
v0 : `float`
    Peak location in detector coordinates.

Notes
-----
This uses a 2-d Gaussian to simulate an illumination pattern
that falls off towards the edge of the detector. The (x, y)
coordinates are in the frame of the amplifier, and (u, v) in
the frame of the full trimmed image.

Definition at line 785 of file isrMock.py.

785 def amplifierMultiplyFlat(self, amp, ampData, fracDrop, u0=100.0, v0=100.0):
786 """Multiply an amplifier's image data by a flat-like pattern.
787
788 Parameters
789 ----------
790 amp : `lsst.afw.ampInfo.AmpInfoRecord`
791 Amplifier to operate on. Needed for amp<->exp coordinate
792 transforms.
793 ampData : `lsst.afw.image.ImageF`
794 Amplifier image to operate on.
795 fracDrop : `float`
796 Fractional drop from center to edge of detector along x-axis.
797 u0 : `float`
798 Peak location in detector coordinates.
799 v0 : `float`
800 Peak location in detector coordinates.
801
802 Notes
803 -----
804 This uses a 2-d Gaussian to simulate an illumination pattern
805 that falls off towards the edge of the detector. The (x, y)
806 coordinates are in the frame of the amplifier, and (u, v) in
807 the frame of the full trimmed image.
808 """
809 if fracDrop >= 1.0:
810 raise RuntimeError("Flat fractional drop cannot be greater than 1.0")
811
812 sigma = u0 / np.sqrt(-2.0 * np.log(fracDrop))
813
814 for x in range(0, ampData.getDimensions().getX()):
815 for y in range(0, ampData.getDimensions().getY()):
816 (u, v) = self.localCoordToExpCoord(amp, x, y)
817 f = np.exp(-0.5 * ((u - u0)**2 + (v - v0)**2) / sigma**2)
818 ampData.array[y][x] = (ampData.array[y][x] * f)
819
820

◆ getCamera()

lsst.ip.isr.isrMock.IsrMock.getCamera ( self)
Construct a test camera object.

Returns
-------
camera : `lsst.afw.cameraGeom.camera`
    Test camera.

Definition at line 502 of file isrMock.py.

502 def getCamera(self):
503 """Construct a test camera object.
504
505 Returns
506 -------
507 camera : `lsst.afw.cameraGeom.camera`
508 Test camera.
509 """
510 cameraWrapper = afwTestUtils.CameraWrapper(
511 plateScale=self.config.plateScale,
512 radialDistortion=self.config.radialDistortion,
513 isLsstLike=self.config.isLsstLike,
514 )
515 camera = cameraWrapper.camera
516 return camera
517

◆ getExposure()

lsst.ip.isr.isrMock.IsrMock.getExposure ( self)
Construct a test exposure.

The test exposure has a simple WCS set, as well as a list of
unlikely header keywords that can be removed during ISR
processing to exercise that code.

Returns
-------
exposure : `lsst.afw.exposure.Exposure`
    Construct exposure containing masked image of the
    appropriate size.

Definition at line 518 of file isrMock.py.

518 def getExposure(self):
519 """Construct a test exposure.
520
521 The test exposure has a simple WCS set, as well as a list of
522 unlikely header keywords that can be removed during ISR
523 processing to exercise that code.
524
525 Returns
526 -------
527 exposure : `lsst.afw.exposure.Exposure`
528 Construct exposure containing masked image of the
529 appropriate size.
530 """
531 camera = self.getCamera()
532 detector = camera[self.config.detectorIndex]
533 image = afwUtils.makeImageFromCcd(detector,
534 isTrimmed=self.config.isTrimmed,
535 showAmpGain=False,
536 rcMarkSize=0,
537 binSize=1,
538 imageFactory=afwImage.ImageF)
539
540 var = afwImage.ImageF(image.getDimensions())
541 mask = afwImage.Mask(image.getDimensions())
542 image.assign(0.0)
543
544 maskedImage = afwImage.makeMaskedImage(image, mask, var)
545 exposure = afwImage.makeExposure(maskedImage)
546 exposure.setDetector(detector)
547 exposure.setWcs(self.getWcs())
548
549 visitInfo = afwImage.VisitInfo(exposureTime=self.config.expTime, darkTime=self.config.darkTime)
550 exposure.getInfo().setVisitInfo(visitInfo)
551
552 metadata = exposure.getMetadata()
553 metadata.add("SHEEP", 7.3, "number of sheep on farm")
554 metadata.add("MONKEYS", 155, "monkeys per tree")
555 metadata.add("VAMPIRES", 4, "How scary are vampires.")
556
557 ccd = exposure.getDetector()
558 newCcd = ccd.rebuild()
559 newCcd.clear()
560 readoutMap = {
561 'LL': ReadoutCorner.LL,
562 'LR': ReadoutCorner.LR,
563 'UR': ReadoutCorner.UR,
564 'UL': ReadoutCorner.UL,
565 }
566 for amp in ccd:
567 newAmp = amp.rebuild()
568 newAmp.setLinearityCoeffs((0., 1., 0., 0.))
569 newAmp.setLinearityType("Polynomial")
570 newAmp.setGain(self.config.gain)
571 newAmp.setSuspectLevel(25000.0)
572 newAmp.setSaturation(32000.0)
573 readoutCorner = 'LL'
574
575 # Apply flips to bbox where needed
576 imageBBox = amp.getRawDataBBox()
577 rawBbox = amp.getRawBBox()
578 parallelOscanBBox = amp.getRawParallelOverscanBBox()
579 serialOscanBBox = amp.getRawSerialOverscanBBox()
580 prescanBBox = amp.getRawPrescanBBox()
581 # This follows cameraGeom.testUtils
582 flipx = bool(amp.getRawFlipX())
583 flipy = bool(amp.getRawFlipY())
584 if flipx:
585 xExt = rawBbox.getDimensions().getX()
586 rawBbox.flipLR(xExt)
587 imageBBox.flipLR(xExt)
588 parallelOscanBBox.flipLR(xExt)
589 serialOscanBBox.flipLR(xExt)
590 prescanBBox.flipLR(xExt)
591 if flipy:
592 yExt = rawBbox.getDimensions().getY()
593 rawBbox.flipTB(yExt)
594 imageBBox.flipTB(yExt)
595 parallelOscanBBox.flipTB(yExt)
596 serialOscanBBox.flipTB(yExt)
597 prescanBBox.flipTB(yExt)
598 if not flipx and not flipy:
599 readoutCorner = 'LL'
600 elif flipx and not flipy:
601 readoutCorner = 'LR'
602 elif flipx and flipy:
603 readoutCorner = 'UR'
604 elif not flipx and flipy:
605 readoutCorner = 'UL'
606 newAmp.setReadoutCorner(readoutMap[readoutCorner])
607 newAmp.setRawBBox(rawBbox)
608 newAmp.setRawDataBBox(imageBBox)
609 newAmp.setRawParallelOverscanBBox(parallelOscanBBox)
610 newAmp.setRawSerialOverscanBBox(serialOscanBBox)
611 newAmp.setRawPrescanBBox(prescanBBox)
612 newAmp.setRawFlipX(False)
613 newAmp.setRawFlipY(False)
614
615 newCcd.append(newAmp)
616
617 exposure.setDetector(newCcd.finish())
618
619 exposure.image.array[:] = np.zeros(exposure.getImage().getDimensions()).transpose()
620 exposure.mask.array[:] = np.zeros(exposure.getMask().getDimensions()).transpose()
621 exposure.variance.array[:] = np.zeros(exposure.getVariance().getDimensions()).transpose()
622
623 return exposure
624
Represent a 2-dimensional array of bitmask pixels.
Definition Mask.h:77
Information about a single exposure of an imaging camera.
Definition VisitInfo.h:68
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > * makeMaskedImage(typename std::shared_ptr< Image< ImagePixelT > > image, typename std::shared_ptr< Mask< MaskPixelT > > mask=Mask< MaskPixelT >(), typename std::shared_ptr< Image< VariancePixelT > > variance=Image< VariancePixelT >())
A function to return a MaskedImage of the correct type (cf.
std::shared_ptr< Exposure< ImagePixelT, MaskPixelT, VariancePixelT > > makeExposure(MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > &mimage, std::shared_ptr< geom::SkyWcs const > wcs=std::shared_ptr< geom::SkyWcs const >())
A function to return an Exposure of the correct type (cf.
Definition Exposure.h:484

◆ getWcs()

lsst.ip.isr.isrMock.IsrMock.getWcs ( self)
Construct a dummy WCS object.

Taken from the deprecated ip_isr/examples/exampleUtils.py.

This is not guaranteed, given the distortion and pixel scale
listed in the afwTestUtils camera definition.

Returns
-------
wcs : `lsst.afw.geom.SkyWcs`
    Test WCS transform.

Definition at line 625 of file isrMock.py.

625 def getWcs(self):
626 """Construct a dummy WCS object.
627
628 Taken from the deprecated ip_isr/examples/exampleUtils.py.
629
630 This is not guaranteed, given the distortion and pixel scale
631 listed in the afwTestUtils camera definition.
632
633 Returns
634 -------
635 wcs : `lsst.afw.geom.SkyWcs`
636 Test WCS transform.
637 """
638 return afwGeom.makeSkyWcs(crpix=lsst.geom.Point2D(0.0, 100.0),
639 crval=lsst.geom.SpherePoint(45.0, 25.0, lsst.geom.degrees),
640 cdMatrix=afwGeom.makeCdMatrix(scale=1.0*lsst.geom.degrees))
641
Point in an unspecified spherical coordinate system.
Definition SpherePoint.h:57
std::shared_ptr< SkyWcs > makeSkyWcs(daf::base::PropertySet &metadata, bool strip=false)
Construct a SkyWcs from FITS keywords.
Definition SkyWcs.cc:521
Eigen::Matrix2d makeCdMatrix(lsst::geom::Angle const &scale, lsst::geom::Angle const &orientation=0 *lsst::geom::degrees, bool flipX=false)
Make a WCS CD matrix.
Definition SkyWcs.cc:133

◆ localCoordToExpCoord()

lsst.ip.isr.isrMock.IsrMock.localCoordToExpCoord ( self,
ampData,
x,
y )
Convert between a local amplifier coordinate and the full
exposure coordinate.

Parameters
----------
ampData : `lsst.afw.image.ImageF`
    Amplifier image to use for conversions.
x : `int`
    X-coordinate of the point to transform.
y : `int`
    Y-coordinate of the point to transform.

Returns
-------
u : `int`
    Transformed x-coordinate.
v : `int`
    Transformed y-coordinate.

Notes
-----
The output is transposed intentionally here, to match the
internal transpose between numpy and afw.image coordinates.

Definition at line 642 of file isrMock.py.

642 def localCoordToExpCoord(self, ampData, x, y):
643 """Convert between a local amplifier coordinate and the full
644 exposure coordinate.
645
646 Parameters
647 ----------
648 ampData : `lsst.afw.image.ImageF`
649 Amplifier image to use for conversions.
650 x : `int`
651 X-coordinate of the point to transform.
652 y : `int`
653 Y-coordinate of the point to transform.
654
655 Returns
656 -------
657 u : `int`
658 Transformed x-coordinate.
659 v : `int`
660 Transformed y-coordinate.
661
662 Notes
663 -----
664 The output is transposed intentionally here, to match the
665 internal transpose between numpy and afw.image coordinates.
666 """
667 u = x + ampData.getBBox().getBeginX()
668 v = y + ampData.getBBox().getBeginY()
669
670 return (v, u)
671

◆ makeBfKernel()

lsst.ip.isr.isrMock.IsrMock.makeBfKernel ( self)
Generate a simple Gaussian brighter-fatter kernel.

Returns
-------
kernel : `numpy.ndarray`
    Simulated brighter-fatter kernel.

Definition at line 338 of file isrMock.py.

338 def makeBfKernel(self):
339 """Generate a simple Gaussian brighter-fatter kernel.
340
341 Returns
342 -------
343 kernel : `numpy.ndarray`
344 Simulated brighter-fatter kernel.
345 """
346 return self.bfKernel
347

◆ makeCrosstalkCoeff()

lsst.ip.isr.isrMock.IsrMock.makeCrosstalkCoeff ( self)
Generate the simulated crosstalk coefficients.

Returns
-------
coeffs : `numpy.ndarray`
    Simulated crosstalk coefficients.

Definition at line 359 of file isrMock.py.

359 def makeCrosstalkCoeff(self):
360 """Generate the simulated crosstalk coefficients.
361
362 Returns
363 -------
364 coeffs : `numpy.ndarray`
365 Simulated crosstalk coefficients.
366 """
367
368 return self.crosstalkCoeffs
369

◆ makeData()

lsst.ip.isr.isrMock.IsrMock.makeData ( self)
Generate simulated ISR data.

Currently, only the class defined crosstalk coefficient
matrix, brighter-fatter kernel, a constant unity transmission
curve, or a simple single-entry defect list can be generated.

Returns
-------
dataProduct :
    Simulated ISR data product.

Definition at line 310 of file isrMock.py.

310 def makeData(self):
311 """Generate simulated ISR data.
312
313 Currently, only the class defined crosstalk coefficient
314 matrix, brighter-fatter kernel, a constant unity transmission
315 curve, or a simple single-entry defect list can be generated.
316
317 Returns
318 -------
319 dataProduct :
320 Simulated ISR data product.
321 """
322 if sum(map(bool, [self.config.doBrighterFatter,
323 self.config.doDefects,
324 self.config.doTransmissionCurve,
325 self.config.doCrosstalkCoeffs])) != 1:
326 raise RuntimeError("Only one data product can be generated at a time.")
327 elif self.config.doBrighterFatter is True:
328 return self.makeBfKernel()
329 elif self.config.doDefects is True:
330 return self.makeDefectList()
331 elif self.config.doTransmissionCurve is True:
332 return self.makeTransmissionCurve()
333 elif self.config.doCrosstalkCoeffs is True:
334 return self.crosstalkCoeffs
335 else:
336 return None
337

◆ makeDefectList()

lsst.ip.isr.isrMock.IsrMock.makeDefectList ( self)
Generate a simple single-entry defect list.

Returns
-------
defectList : `lsst.meas.algorithms.Defects`
    Simulated defect list

Definition at line 348 of file isrMock.py.

348 def makeDefectList(self):
349 """Generate a simple single-entry defect list.
350
351 Returns
352 -------
353 defectList : `lsst.meas.algorithms.Defects`
354 Simulated defect list
355 """
356 return Defects([lsst.geom.Box2I(lsst.geom.Point2I(0, 0),
357 lsst.geom.Extent2I(40, 50))])
358
An integer coordinate rectangle.
Definition Box.h:55

◆ makeImage()

lsst.ip.isr.isrMock.IsrMock.makeImage ( self)
Generate a simulated ISR image.

Returns
-------
exposure : `lsst.afw.image.Exposure` or `dict`
    Simulated ISR image data.

Notes
-----
This method currently constructs a "raw" data image by:

* Generating a simulated sky with noise
* Adding a single Gaussian "star"
* Adding the fringe signal
* Multiplying the frame by the simulated flat
* Adding dark current (and noise)
* Adding a bias offset (and noise)
* Adding an overscan gradient parallel to the pixel y-axis
* Simulating crosstalk by adding a scaled version of each
  amplifier to each other amplifier.

The exposure with image data constructed this way is in one of
three formats.

* A single image, with overscan and prescan regions retained
* A single image, with overscan and prescan regions trimmed
* A `dict`, containing the amplifer data indexed by the
  amplifier name.

The nonlinearity, CTE, and brighter fatter are currently not
implemented.

Note that this method generates an image in the reverse
direction as the ISR processing, as the output image here has
had a series of instrument effects added to an idealized
exposure.

Reimplemented in lsst.ip.isr.isrMockLSST.IsrMockLSST.

Definition at line 381 of file isrMock.py.

381 def makeImage(self):
382 """Generate a simulated ISR image.
383
384 Returns
385 -------
386 exposure : `lsst.afw.image.Exposure` or `dict`
387 Simulated ISR image data.
388
389 Notes
390 -----
391 This method currently constructs a "raw" data image by:
392
393 * Generating a simulated sky with noise
394 * Adding a single Gaussian "star"
395 * Adding the fringe signal
396 * Multiplying the frame by the simulated flat
397 * Adding dark current (and noise)
398 * Adding a bias offset (and noise)
399 * Adding an overscan gradient parallel to the pixel y-axis
400 * Simulating crosstalk by adding a scaled version of each
401 amplifier to each other amplifier.
402
403 The exposure with image data constructed this way is in one of
404 three formats.
405
406 * A single image, with overscan and prescan regions retained
407 * A single image, with overscan and prescan regions trimmed
408 * A `dict`, containing the amplifer data indexed by the
409 amplifier name.
410
411 The nonlinearity, CTE, and brighter fatter are currently not
412 implemented.
413
414 Note that this method generates an image in the reverse
415 direction as the ISR processing, as the output image here has
416 had a series of instrument effects added to an idealized
417 exposure.
418 """
419 exposure = self.getExposure()
420
421 for idx, amp in enumerate(exposure.getDetector()):
422 bbox = None
423 if self.config.isTrimmed is True:
424 bbox = amp.getBBox()
425 else:
426 bbox = amp.getRawDataBBox()
427
428 ampData = exposure.image[bbox]
429
430 if self.config.doAddSky is True:
431 self.amplifierAddNoise(ampData, self.config.skyLevel, np.sqrt(self.config.skyLevel))
432
433 if self.config.doAddSource is True:
434 for sourceAmp, sourceFlux, sourceX, sourceY in zip(self.config.sourceAmp,
435 self.config.sourceFlux,
436 self.config.sourceX,
437 self.config.sourceY):
438 if idx == sourceAmp:
439 self.amplifierAddSource(ampData, sourceFlux, sourceX, sourceY)
440
441 if self.config.doAddFringe is True:
442 self.amplifierAddFringe(amp, ampData, np.array(self.config.fringeScale),
443 x0=np.array(self.config.fringeX0),
444 y0=np.array(self.config.fringeY0))
445
446 if self.config.doAddFlat is True:
447 if ampData.getArray().sum() == 0.0:
448 self.amplifierAddNoise(ampData, 1.0, 0.0)
449 u0 = exposure.getDimensions().getX()
450 v0 = exposure.getDimensions().getY()
451 self.amplifierMultiplyFlat(amp, ampData, self.config.flatDrop, u0=u0, v0=v0)
452
453 if self.config.doAddDark is True:
454 self.amplifierAddNoise(ampData,
455 self.config.darkRate * self.config.darkTime / self.config.gain,
456 np.sqrt(self.config.darkRate
457 * self.config.darkTime / self.config.gain))
458
459 if self.config.doAddCrosstalk is True:
460 ctCalib = CrosstalkCalib()
461 for idxS, ampS in enumerate(exposure.getDetector()):
462 for idxT, ampT in enumerate(exposure.getDetector()):
463 ampDataT = exposure.image[ampT.getBBox()
464 if self.config.isTrimmed else ampT.getRawDataBBox()]
465 outAmp = ctCalib.extractAmp(exposure.getImage(), ampS, ampT,
466 isTrimmed=self.config.isTrimmed)
467 self.amplifierAddCT(outAmp, ampDataT, self.crosstalkCoeffs[idxS][idxT])
468
469 for amp in exposure.getDetector():
470 bbox = None
471 if self.config.isTrimmed is True:
472 bbox = amp.getBBox()
473 else:
474 bbox = amp.getRawDataBBox()
475
476 ampData = exposure.image[bbox]
477
478 if self.config.doAddBias is True:
479 self.amplifierAddNoise(ampData, self.config.biasLevel,
480 self.config.readNoise / self.config.gain)
481
482 if self.config.doAddOverscan is True:
483 oscanBBox = amp.getRawHorizontalOverscanBBox()
484 oscanData = exposure.image[oscanBBox]
485 self.amplifierAddNoise(oscanData, self.config.biasLevel,
486 self.config.readNoise / self.config.gain)
487
488 self.amplifierAddYGradient(ampData, -1.0 * self.config.overscanScale,
489 1.0 * self.config.overscanScale)
490 self.amplifierAddYGradient(oscanData, -1.0 * self.config.overscanScale,
491 1.0 * self.config.overscanScale)
492
493 if self.config.doGenerateAmpDict is True:
494 expDict = dict()
495 for amp in exposure.getDetector():
496 expDict[amp.getName()] = exposure
497 return expDict
498 else:
499 return exposure
500

◆ makeTransmissionCurve()

lsst.ip.isr.isrMock.IsrMock.makeTransmissionCurve ( self)
Generate a simulated flat transmission curve.

Returns
-------
transmission : `lsst.afw.image.TransmissionCurve`
    Simulated transmission curve.

Definition at line 370 of file isrMock.py.

370 def makeTransmissionCurve(self):
371 """Generate a simulated flat transmission curve.
372
373 Returns
374 -------
375 transmission : `lsst.afw.image.TransmissionCurve`
376 Simulated transmission curve.
377 """
378
379 return afwImage.TransmissionCurve.makeIdentity()
380

◆ run()

lsst.ip.isr.isrMock.IsrMock.run ( self)
Generate a mock ISR product, and return it.

Returns
-------
image : `lsst.afw.image.Exposure`
    Simulated ISR image with signals added.
dataProduct :
    Simulated ISR data products.
None :
    Returned if no valid configuration was found.

Raises
------
RuntimeError
    Raised if both doGenerateImage and doGenerateData are specified.

Reimplemented in lsst.ip.isr.isrMockLSST.IsrMockLSST.

Definition at line 284 of file isrMock.py.

284 def run(self):
285 """Generate a mock ISR product, and return it.
286
287 Returns
288 -------
289 image : `lsst.afw.image.Exposure`
290 Simulated ISR image with signals added.
291 dataProduct :
292 Simulated ISR data products.
293 None :
294 Returned if no valid configuration was found.
295
296 Raises
297 ------
298 RuntimeError
299 Raised if both doGenerateImage and doGenerateData are specified.
300 """
301 if self.config.doGenerateImage and self.config.doGenerateData:
302 raise RuntimeError("Only one of doGenerateImage and doGenerateData may be specified.")
303 elif self.config.doGenerateImage:
304 return self.makeImage()
305 elif self.config.doGenerateData:
306 return self.makeData()
307 else:
308 return None
309

Member Data Documentation

◆ _DefaultName

str lsst.ip.isr.isrMock.IsrMock._DefaultName = "isrMock"
staticprotected

Definition at line 264 of file isrMock.py.

◆ bfKernel

lsst.ip.isr.isrMock.IsrMock.bfKernel

Definition at line 278 of file isrMock.py.

◆ ConfigClass

lsst.ip.isr.isrMock.IsrMock.ConfigClass = IsrMockConfig
static

Definition at line 263 of file isrMock.py.

◆ crosstalkCoeffs

lsst.ip.isr.isrMock.IsrMock.crosstalkCoeffs

Definition at line 269 of file isrMock.py.

◆ rng

lsst.ip.isr.isrMock.IsrMock.rng

Definition at line 268 of file isrMock.py.


The documentation for this class was generated from the following file: