Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-14102 have measurePsf use new MakePsfCandidatesTask #195

Merged
merged 2 commits into from
May 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion bin.src/assembleCoadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
# the GNU General Public License along with this program. If not,
# see <http://www.lsstcorp.org/LegalNotices/>.
#
from __future__ import print_function
from lsst.pipe.tasks.assembleCoadd import AssembleCoaddTask, SafeClipAssembleCoaddTask,\
CompareWarpAssembleCoaddTask
import sys
Expand Down
2 changes: 0 additions & 2 deletions bin.src/dumpTaskMetadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
#
"""Select images and report which tracts and patches they are in
"""
from __future__ import print_function

import lsst.daf.base as dafBase
import lsst.pex.config as pexConfig
import lsst.pipe.base as pipeBase
Expand Down
1 change: 0 additions & 1 deletion bin.src/reportImagesInPatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#
"""Select images for a given coadd patch
"""
from __future__ import print_function
import numpy

import lsst.pex.config as pexConfig
Expand Down
2 changes: 0 additions & 2 deletions bin.src/reportImagesToCoadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
#
"""Select images and report which tracts and patches they are in
"""
from __future__ import print_function
from builtins import zip
import numpy

import lsst.pex.config as pexConfig
Expand Down
2 changes: 0 additions & 2 deletions bin.src/reportPatches.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
a proper implementation will report all tracts and patches that overlap each image
- One must specify a patch and tract even though those arguments are ignored.
"""
from __future__ import print_function

import lsst.pex.config as pexConfig
import lsst.afw.geom as afwGeom
import lsst.pipe.base as pipeBase
Expand Down
5 changes: 1 addition & 4 deletions bin.src/reportTaskTiming.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
#
"""Select images and report which tracts and patches they are in
"""
from __future__ import print_function
from builtins import zip
from builtins import object
import collections
import re

Expand All @@ -41,7 +38,7 @@ class ReportTaskTimingConfig(pexConfig.Config):
pass


class ResourceInfo(object):
class ResourceInfo:
# note: UTime, STime and MaxRss were renamed to UserTime, SystemTime and MaxResidentSetSize;
# list both so the code can report time for both older and newer runs
_BaseNameList = ("CpuTime", "UserTime", "SystemTime", "MaxResidentSetSize", "UTime", "STime", "MaxRss")
Expand Down
1 change: 0 additions & 1 deletion examples/exampleStatsTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
# the GNU General Public License along with this program. If not,
# see <http://www.lsstcorp.org/LegalNotices/>.
#
from __future__ import print_function
import os
import sys

Expand Down
1 change: 0 additions & 1 deletion examples/measurePsfTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
# see <http://www.lsstcorp.org/LegalNotices/>.
#

from __future__ import print_function
import os
import sys
import numpy as np
Expand Down
2 changes: 0 additions & 2 deletions examples/photoCalTask.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/usr/bin/env python
from __future__ import absolute_import, division
from __future__ import print_function
#
# LSST Data Management System
# Copyright 2008, 2009, 2010 LSST Corporation.
Expand Down
2 changes: 0 additions & 2 deletions examples/runRepair.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
# the GNU General Public License along with this program. If not,
# see <http://www.lsstcorp.org/LegalNotices/>.
#
from __future__ import print_function
from builtins import zip
import numpy
import sys

Expand Down
1 change: 0 additions & 1 deletion python/lsst/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import absolute_import, division, print_function
import pkgutil
import lsstimport
__path__ = pkgutil.extend_path(__path__, __name__)
1 change: 0 additions & 1 deletion python/lsst/pipe/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import absolute_import, division, print_function
import pkgutil
import lsstimport
__path__ = pkgutil.extend_path(__path__, __name__)
1 change: 0 additions & 1 deletion python/lsst/pipe/tasks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
from __future__ import absolute_import, division, print_function
from .version import *
3 changes: 0 additions & 3 deletions python/lsst/pipe/tasks/assembleCoadd.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from __future__ import absolute_import, division, print_function
from builtins import zip
from builtins import range
#
# LSST Data Management System
# Copyright 2008-2016 AURA/LSST.
Expand Down
1 change: 0 additions & 1 deletion python/lsst/pipe/tasks/calibrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
# the GNU General Public License along with this program. If not,
# see <https://www.lsstcorp.org/LegalNotices/>.
#
from __future__ import absolute_import, division, print_function
import math

from lsstDebug import getDebugFrame
Expand Down
2 changes: 0 additions & 2 deletions python/lsst/pipe/tasks/characterizeImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
# the GNU General Public License along with this program. If not,
# see <https://www.lsstcorp.org/LegalNotices/>.
#
from __future__ import absolute_import, division, print_function
from builtins import range
import numpy as np

from lsstDebug import getDebugFrame
Expand Down
1 change: 0 additions & 1 deletion python/lsst/pipe/tasks/coaddBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
# the GNU General Public License along with this program. If not,
# see <http://www.lsstcorp.org/LegalNotices/>.
#
from __future__ import absolute_import, division, print_function
import numpy

import lsst.pex.config as pexConfig
Expand Down
3 changes: 0 additions & 3 deletions python/lsst/pipe/tasks/coaddHelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
# the GNU General Public License along with this program. If not,
# see <http://www.lsstcorp.org/LegalNotices/>.
#

from __future__ import absolute_import, division, print_function
from builtins import zip
from lsst.pipe.base import Struct

"""Helper functions for coaddition.
Expand Down
4 changes: 1 addition & 3 deletions python/lsst/pipe/tasks/coaddInputRecorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
# the GNU General Public License along with this program. If not,
# see <http://www.lsstcorp.org/LegalNotices/>.
#
from __future__ import absolute_import, division, print_function
from builtins import object
import numpy

import lsst.pex.config as pexConfig
Expand Down Expand Up @@ -62,7 +60,7 @@ class CoaddInputRecorderConfig(pexConfig.Config):
)


class CoaddTempExpInputRecorder(object):
class CoaddTempExpInputRecorder:
"""A helper class for CoaddInputRecorderTask, managing the CoaddInputs object for that single
CoaddTempExp. This will contain a single 'visit' record for the CoaddTempExp and a number of 'ccd'
records.
Expand Down
2 changes: 0 additions & 2 deletions python/lsst/pipe/tasks/colorterms.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
# the GNU General Public License along with this program. If not,
# see <http://www.lsstcorp.org/LegalNotices/>.
#

from __future__ import absolute_import, division, print_function
import fnmatch

import numpy as np
Expand Down
1 change: 0 additions & 1 deletion python/lsst/pipe/tasks/exampleCmdLineTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
# the GNU General Public License along with this program. If not,
# see <http://www.lsstcorp.org/LegalNotices/>.
#
from __future__ import absolute_import, division, print_function
from lsst.afw.display.ds9 import mtv
import lsst.pex.config as pexConfig
import lsst.pipe.base as pipeBase
Expand Down
1 change: 0 additions & 1 deletion python/lsst/pipe/tasks/exampleStatsTasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
# the GNU General Public License along with this program. If not,
# see <http://www.lsstcorp.org/LegalNotices/>.
#
from __future__ import absolute_import, division, print_function
import lsst.afw.image as afwImage
import lsst.afw.math as afwMath
import lsst.pex.config as pexConfig
Expand Down
5 changes: 1 addition & 4 deletions python/lsst/pipe/tasks/fakes.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,11 @@
# the GNU General Public License along with this program. If not,
# see <http://www.lsstcorp.org/LegalNotices/>.
#

from __future__ import absolute_import, division, print_function
import abc

import lsst.pex.config
import lsst.pipe.base
import lsst.afw.image
from future.utils import with_metaclass


class BaseFakeSourcesConfig(lsst.pex.config.Config):
Expand All @@ -36,7 +33,7 @@ class BaseFakeSourcesConfig(lsst.pex.config.Config):
)


class BaseFakeSourcesTask(with_metaclass(abc.ABCMeta, lsst.pipe.base.Task)):
class BaseFakeSourcesTask(lsst.pipe.base.Task, metaclass=abc.ABCMeta):
"""An abstract base class for subtasks that inject fake sources into images to test completeness and
other aspects of the processing.

Expand Down
1 change: 0 additions & 1 deletion python/lsst/pipe/tasks/getRepositoryData.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

Use this as a base task for creating graphs and reports for a set of data.
"""
from __future__ import absolute_import, division, print_function
import lsst.pex.config as pexConfig
import lsst.pipe.base as pipeBase

Expand Down
2 changes: 0 additions & 2 deletions python/lsst/pipe/tasks/imageDifference.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
# the GNU General Public License along with this program. If not,
# see <http://www.lsstcorp.org/LegalNotices/>.
#
from __future__ import absolute_import, division, print_function
from builtins import zip
import math
import random
import numpy
Expand Down
4 changes: 1 addition & 3 deletions python/lsst/pipe/tasks/ingest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from __future__ import absolute_import, division, print_function
from past.builtins import basestring
from builtins import object
import os
import shutil
import tempfile
Expand Down Expand Up @@ -198,7 +196,7 @@ class RegisterConfig(Config):
permissions = Field(dtype=int, default=0o664, doc="Permissions mode for registry; 0o664 = rw-rw-r--")


class RegistryContext(object):
class RegistryContext:
"""Context manager to provide a registry

An existing registry is copied, so that it may continue
Expand Down
2 changes: 0 additions & 2 deletions python/lsst/pipe/tasks/ingestCalibs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import, division, print_function
from builtins import zip
import collections
import datetime
import sqlite3
Expand Down
2 changes: 0 additions & 2 deletions python/lsst/pipe/tasks/ingestPgsql.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import, division, print_function

import os

from lsst.pex.config import ConfigurableField
Expand Down
1 change: 0 additions & 1 deletion python/lsst/pipe/tasks/interpImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
# the GNU General Public License along with this program. If not,
# see <https://www.lsstcorp.org/LegalNotices/>.
#
from __future__ import absolute_import, division, print_function
import lsst.pex.config as pexConfig
import lsst.afw.math as afwMath
import lsst.meas.algorithms as measAlg
Expand Down
2 changes: 0 additions & 2 deletions python/lsst/pipe/tasks/makeCoaddTempExp.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
# the GNU General Public License along with this program. If not,
# see <http://www.lsstcorp.org/LegalNotices/>.
#

from __future__ import absolute_import, division, print_function
import numpy

import lsst.pex.config as pexConfig
Expand Down
1 change: 0 additions & 1 deletion python/lsst/pipe/tasks/makeDiscreteSkyMap.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
# the GNU General Public License along with this program. If not,
# see <https://www.lsstcorp.org/LegalNotices/>.
#
from __future__ import absolute_import, division, print_function
import sys
import traceback
import lsst.geom
Expand Down
1 change: 0 additions & 1 deletion python/lsst/pipe/tasks/makeSkyMap.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
# the GNU General Public License along with this program. If not,
# see <https://www.lsstcorp.org/LegalNotices/>.
#
from __future__ import absolute_import, division, print_function
import sys
import traceback

Expand Down
7 changes: 1 addition & 6 deletions python/lsst/pipe/tasks/matchBackgrounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
# see <http://www.lsstcorp.org/LegalNotices/>.

from __future__ import absolute_import, division, print_function
from builtins import zip
from builtins import range
from builtins import object
import numpy
import lsst.afw.image as afwImage
import lsst.afw.math as afwMath
Expand Down Expand Up @@ -580,7 +575,7 @@ def _gridImage(self, maskedImage, binsize, statsFlag):
return numpy.array(bgX), numpy.array(bgY), numpy.array(bgZ), numpy.array(bgdZ)


class DataRefMatcher(object):
class DataRefMatcher:
"""Match data references for a specified dataset type

Note that this is not exact, but should suffice for this task
Expand Down
30 changes: 20 additions & 10 deletions python/lsst/pipe/tasks/measurePsf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
# the GNU General Public License along with this program. If not,
# see <http://www.lsstcorp.org/LegalNotices/>.
#
from __future__ import absolute_import, division, print_function

from builtins import zip

import lsst.afw.math as afwMath
import lsst.afw.display.ds9 as ds9
import lsst.meas.algorithms as measAlg
Expand All @@ -32,10 +28,22 @@


class MeasurePsfConfig(pexConfig.Config):
starSelector = measAlg.starSelectorRegistry.makeField("Star selection algorithm", default="objectSize")
psfDeterminer = measAlg.psfDeterminerRegistry.makeField("PSF Determination algorithm", default="pca")
reserve = pexConfig.ConfigurableField(target=measAlg.ReserveSourcesTask,
doc="Reserve sources from fitting")
starSelector = measAlg.starSelectorRegistry.makeField(
"Star selection algorithm",
default="objectSize"
)
makePsfCandidates = pexConfig.ConfigurableField(
target=measAlg.MakePsfCandidatesTask,
doc="Task to make psf candidates from selected stars.",
)
psfDeterminer = measAlg.psfDeterminerRegistry.makeField(
"PSF Determination algorithm",
default="pca"
)
reserve = pexConfig.ConfigurableField(
target=measAlg.ReserveSourcesTask,
doc="Reserve sources from fitting"
)

## \addtogroup LSST_task_documentation
## \{
Expand Down Expand Up @@ -223,6 +231,7 @@ def __init__(self, schema=None, **kwargs):
self.candidateKey = None
self.usedKey = None
self.makeSubtask("starSelector", schema=schema)
self.makeSubtask("makePsfCandidates")
self.makeSubtask("psfDeterminer", schema=schema)
self.makeSubtask("reserve", columnName="calib_psf", schema=schema,
doc="set if source was reserved from PSF determination")
Expand Down Expand Up @@ -262,8 +271,9 @@ def run(self, exposure, sources, expId=0, matches=None):
#
# Run star selector
#
selectionResult = self.starSelector.run(exposure=exposure, sourceCat=sources, matches=matches)
reserveResult = self.reserve.run(selectionResult.starCat, expId=expId)
stars = self.starSelector.run(sourceCat=sources, matches=matches, exposure=exposure)
selectionResult = self.makePsfCandidates.run(stars.starCat, exposure=exposure)
reserveResult = self.reserve.run(selectionResult.goodStarCat, expId=expId)
psfCandidateList = [cand for cand, use
in zip(selectionResult.psfCandidates, reserveResult.use) if use]

Expand Down
1 change: 0 additions & 1 deletion python/lsst/pipe/tasks/mocks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import absolute_import, division, print_function
from .simpleMapper import *
from .mockCoadd import MockCoaddTask
from .mockObject import MockObjectTask
3 changes: 0 additions & 3 deletions python/lsst/pipe/tasks/mocks/mockCoadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
# the GNU General Public License along with this program. If not,
# see <https://www.lsstcorp.org/LegalNotices/>.
#

from __future__ import absolute_import, division, print_function
from builtins import range
import lsst.afw.image
import lsst.afw.geom
import lsst.pex.config
Expand Down
2 changes: 0 additions & 2 deletions python/lsst/pipe/tasks/mocks/mockObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
# the GNU General Public License along with this program. If not,
# see <http://www.lsstcorp.org/LegalNotices/>.
#

from __future__ import absolute_import, division, print_function
import numpy

import lsst.pex.config
Expand Down