Exemplo n.º 1
0
    def testTaskAPI(self):
        """Test that the Tasks work

        Checks both MeasureCrosstalkTask and the CrosstalkTask.
        """
        # make exposure available to NullIsrTask
        # without NullIsrTask's `self` hiding this test class's `self`
        exposure = self.exposure

        class NullIsrTask(IsrTask):
            def runDataRef(self, dataRef):
                return Struct(exposure=exposure)

        config = MeasureCrosstalkTask.ConfigClass()
        config.isr.retarget(NullIsrTask)
        config.threshold = self.value - 1
        measure = MeasureCrosstalkTask(config=config)
        fakeDataRef = Struct(dataId={'fake': 1})
        coeff, coeffErr, coeffNum = measure.reduce(
            [measure.runDataRef(fakeDataRef)])
        self.checkCoefficients(coeff, coeffErr, coeffNum)

        config = IsrTask.ConfigClass()
        config.crosstalk.minPixelToMask = self.value - 1
        config.crosstalk.crosstalkMaskPlane = self.crosstalkStr
        isr = IsrTask(config=config)
        isr.crosstalk.run(self.exposure)
        self.checkSubtracted(self.exposure)
Exemplo n.º 2
0
    def testTaskAPI(self):
        """Test that the Tasks work

        Checks both MeasureCrosstalkTask and the CrosstalkTask.
        """
        # make exposure available to NullIsrTask
        # without NullIsrTask's `self` hiding this test class's `self`
        exposure = self.exposure

        class NullIsrTask(IsrTask):
            def runDataRef(self, dataRef):
                return Struct(exposure=exposure)

        config = MeasureCrosstalkTask.ConfigClass()
        config.isr.retarget(NullIsrTask)
        config.threshold = self.value - 1
        measure = MeasureCrosstalkTask(config=config)
        fakeDataRef = Struct(dataId={'fake': 1})
        coeff, coeffErr, coeffNum = measure.reduce([measure.runDataRef(fakeDataRef)])
        self.checkCoefficients(coeff, coeffErr, coeffNum)

        config = IsrTask.ConfigClass()
        config.crosstalk.minPixelToMask = self.value - 1
        config.crosstalk.crosstalkMaskPlane = self.crosstalkStr
        isr = IsrTask(config=config)
        isr.crosstalk.run(self.exposure)
        self.checkSubtracted(self.exposure)
Exemplo n.º 3
0
    def testDirectAPI(self):
        """Test that individual function calls work"""
        config = MeasureCrosstalkTask.ConfigClass()
        measure = MeasureCrosstalkTask(config=config)
        ratios = measure.extractCrosstalkRatios(self.exposure,
                                                threshold=self.value - 1)
        coeff, coeffErr, coeffNum = measure.measureCrosstalkCoefficients(
            ratios)
        self.checkCoefficients(coeff, coeffErr, coeffNum)
        subtractCrosstalk(self.exposure,
                          minPixelToMask=self.value - 1,
                          crosstalkStr=self.crosstalkStr)
        self.checkSubtracted(self.exposure)

        outPath = tempfile.mktemp(
        ) if outputName is None else "{}-isrCrosstalk".format(outputName)
        writeCrosstalkCoeffs(outPath,
                             coeff,
                             det=None,
                             crosstalkName="testDirectAPI",
                             indent=2)
Exemplo n.º 4
0
    def testDirectAPI(self):
        """Test that individual function calls work"""
        config = MeasureCrosstalkTask.ConfigClass()
        measure = MeasureCrosstalkTask(config=config)
        ratios = measure.extractCrosstalkRatios(self.exposure,
                                                threshold=self.value - 1)
        coeff, coeffErr, coeffNum = measure.measureCrosstalkCoefficients(
            ratios)
        self.checkCoefficients(coeff, coeffErr, coeffNum)
        calib = CrosstalkCalib()
        calib.coeffs = coeff.transpose()
        calib.coeffErr = coeffErr.transpose()
        calib.coeffNum = coeffNum.transpose()
        calib.subtractCrosstalk(self.exposure,
                                crosstalkCoeffs=coeff.transpose(),
                                minPixelToMask=self.value - 1,
                                crosstalkStr=self.crosstalkStr)
        self.checkSubtracted(self.exposure)

        outPath = tempfile.mktemp(
        ) if outputName is None else "{}-isrCrosstalk".format(outputName)
        outPath += '.yaml'
        calib.writeText(outPath)
Exemplo n.º 5
0
#!/usr/bin/env python
from lsst.ip.isr import MeasureCrosstalkTask

MeasureCrosstalkTask.parseAndRun()
Exemplo n.º 6
0
#!/usr/bin/env python
from lsst.ip.isr import MeasureCrosstalkTask
MeasureCrosstalkTask.parseAndRun()