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-5532 #15

Merged
merged 1 commit into from
Mar 30, 2016
Merged
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
43 changes: 14 additions & 29 deletions python/lsst/meas/modelfit/starSelector.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,47 +21,32 @@
#

import lsst.pex.config
import lsst.meas.algorithms
from lsst.meas.algorithms.starSelectorRegistry import starSelectorRegistry
from lsst.afw.table import SourceCatalog
from lsst.pipe.base import Struct
from lsst.meas.algorithms import StarSelectorTask

class S13StarSelectorConfig(lsst.pex.config.Config):
__all__ = ["S13StarSelectorConfig", "S13StarSelectorTask"]

class S13StarSelectorConfig(StarSelectorTask.ConfigClass):
fluxMin = lsst.pex.config.Field(
doc = "specify the minimum apFlux for good PsfCandidates",
dtype = float,
default = 50000,
check = lambda x: x >= 0.0,
)
kernelSize = lsst.pex.config.Field(
doc = "size of the Psf kernel to create",
dtype = int,
default = 21,
)
borderWidth = lsst.pex.config.Field(
doc = "number of pixels to ignore around the edge of PSF candidate postage stamps",
dtype = int,
default = 0,
)

class S13StarSelector(object):
class S13StarSelectorTask(StarSelectorTask):
ConfigClass = S13StarSelectorConfig
usesMatches = False # selectStars does not use its matches argument

def __init__(self, config):
self.config = config

def selectStars(self, exposure, catalog, matches=None):
psfCandidateList = []
for source in catalog:
def selectStars(self, exposure, sourceCat, matches=None):
starCat = SourceCatalog(sourceCat.schema)
for source in sourceCat:
if source.getApFluxFlag():
continue
if source.getApFlux() < self.config.fluxMin:
continue
psfCandidate = lsst.meas.algorithms.makePsfCandidate(source, exposure)
if psfCandidate.getWidth() == 0:
psfCandidate.setBorderWidth(self.config.borderWidth)
psfCandidate.setWidth(self.config.kernelSize + 2*self.config.borderWidth)
psfCandidate.setHeight(self.config.kernelSize + 2*self.config.borderWidth)
psfCandidateList.append(psfCandidate)
return psfCandidateList

starSelectorRegistry.register("s13", S13StarSelector)
starCat.append(source)
return Struct(
starCat = starCat,
)