コード例 #1
0
ファイル: testCoadds.py プロジェクト: Daraexus/pipe_tasks
    def setUp(self):

        # Create a task that creates simulated images and builds a coadd from them
        self.mocksTask = lsst.pipe.tasks.mocks.MockCoaddTask()

        # Create an instance of DetectCoaddSourcesTask to measure on the coadd.
        # There's no noise in these images, so we set a direct-value threshold,
        # and the background weighting (when using Approximate) to False

        detectConfig = DetectCoaddSourcesTask.ConfigClass()
        detectConfig.detection.thresholdType = "value"
        detectConfig.detection.thresholdValue = 0.01
        detectConfig.detection.background.weighting = False
        self.detectTask = DetectCoaddSourcesTask(config=detectConfig)

        if REUSE_DATAREPO and os.path.exists(os.path.join(DATAREPO_ROOT, "_mapper")):
            self.butler = lsst.daf.persistence.Butler(DATAREPO_ROOT)
        else:
            self.butler = lsst.pipe.tasks.mocks.makeDataRepo(DATAREPO_ROOT)

            self.mocksTask.buildAllInputs(self.butler)
            self.addMaskPlanes()
            self.checkMaskPlanesExist()
            self.mocksTask.buildCoadd(self.butler)
            self.mocksTask.buildMockCoadd(self.butler)
            self.detectTask.writeSchemas(self.butler)
            # Now run the seperate multiband tasks on the Coadd to make the reference
            # catalog for the forced photometry tests.
            self.runTaskOnPatches(self.detectTask)

            mergeDetConfig = MergeDetectionsTask.ConfigClass()
            mergeDetConfig.priorityList = ['r', ]
            mergeDetTask = MergeDetectionsTask(config=mergeDetConfig, butler=self.butler)
            mergeDetTask.writeSchemas(self.butler)
            self.runTaskOnPatchList(mergeDetTask)

            measMergedConfig = MeasureMergedCoaddSourcesTask.ConfigClass()
            measMergedConfig.measurement.slots.shape = "base_SdssShape"
            measMergedConfig.measurement.doApplyApCorr = "no"
            measMergedConfig.measurement.plugins['base_PixelFlags'].masksFpAnywhere = []
            measMergedConfig.propagateFlags.flags = {} # Disable flag propagation: no flags to propagate
            measMergedConfig.doMatchSources = False  # We don't have a reference catalog available
            measMergedTask = MeasureMergedCoaddSourcesTask(config=measMergedConfig, butler=self.butler)
            measMergedTask.writeSchemas(self.butler)
            self.runTaskOnPatches(measMergedTask)

            mergeMeasConfig = MergeMeasurementsTask.ConfigClass()
            mergeMeasConfig.priorityList = ['r', ]
            mergeMeasTask = MergeMeasurementsTask(config=mergeMeasConfig, butler=self.butler)
            mergeMeasTask.writeSchemas(self.butler)
            self.runTaskOnPatchList(mergeMeasTask)
コード例 #2
0
def setup_module(module):
    lsst.utils.tests.init()

    if os.path.exists(DATAREPO_ROOT):
        print("Deleting existing repo: %r" % (DATAREPO_ROOT,))
        shutil.rmtree(DATAREPO_ROOT)

    if not haveMeasBase:
        raise unittest.SkipTest("meas_base could not be imported")

    # Create a task that creates simulated images and builds a coadd from them
    mocksTask = lsst.pipe.tasks.mocks.MockCoaddTask()

    # Create an instance of DetectCoaddSourcesTask to measure on the coadd.
    # There's no noise in these images, so we set a direct-value threshold,
    # and the background weighting (when using Approximate) to False

    detectConfig = DetectCoaddSourcesTask.ConfigClass()
    # Images have no noise, so we can't use the default DynamicDetectionTask
    detectConfig.detection.retarget(lsst.meas.algorithms.SourceDetectionTask)
    detectConfig.detection.thresholdType = "value"
    detectConfig.detection.thresholdValue = 0.01
    detectConfig.detection.background.weighting = False
    detectTask = DetectCoaddSourcesTask(config=detectConfig)

    butler = lsst.pipe.tasks.mocks.makeDataRepo(DATAREPO_ROOT)

    mocksTask.buildAllInputs(butler)

    addMaskPlanes(butler)
    mocksTask.buildCoadd(butler)
    mocksTask.buildMockCoadd(butler)
    detectTask.writeSchemas(butler)
    # Now run the seperate multiband tasks on the Coadd to make the reference
    # catalog for the forced photometry tests.
    runTaskOnPatches(butler, detectTask, mocksTask)

    mergeDetConfig = MergeDetectionsTask.ConfigClass()
    mergeDetConfig.priorityList = ['r', ]
    mergeDetTask = MergeDetectionsTask(config=mergeDetConfig, butler=butler)
    mergeDetTask.writeSchemas(butler)
    runTaskOnPatchList(butler, mergeDetTask, mocksTask)

    deblendSourcesConfig = DeblendCoaddSourcesTask.ConfigClass()
    deblendSourcesTask = DeblendCoaddSourcesTask(config=deblendSourcesConfig, butler=butler)
    deblendSourcesTask.writeSchemas(butler)
    runTaskOnPatchList(butler, deblendSourcesTask, mocksTask)

    measMergedConfig = MeasureMergedCoaddSourcesTask.ConfigClass()
    measMergedConfig.measurement.slots.shape = "base_SdssShape"
    measMergedConfig.measurement.plugins['base_PixelFlags'].masksFpAnywhere = []
    measMergedConfig.propagateFlags.flags = {}  # Disable flag propagation: no flags to propagate
    measMergedConfig.doMatchSources = False  # We don't have a reference catalog available
    measMergedTask = MeasureMergedCoaddSourcesTask(config=measMergedConfig, butler=butler)
    measMergedTask.writeSchemas(butler)
    runTaskOnPatches(butler, measMergedTask, mocksTask)

    mergeMeasConfig = MergeMeasurementsTask.ConfigClass()
    mergeMeasConfig.priorityList = ['r', ]
    mergeMeasTask = MergeMeasurementsTask(config=mergeMeasConfig, butler=butler)
    mergeMeasTask.writeSchemas(butler)
    runTaskOnPatchList(butler, mergeMeasTask, mocksTask)

    runForcedPhotCoaddTask(butler, mocksTask)
    runForcedPhotCcdTask(butler)
コード例 #3
0
#!/usr/bin/env python
from lsst.pipe.tasks.multiBand import MergeMeasurementsTask
MergeMeasurementsTask.parseAndRun()