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

add DipoleFitTask as default dipole measurement task #51

Merged
merged 1 commit into from
May 16, 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
25 changes: 18 additions & 7 deletions python/lsst/pipe/tasks/imageDifference.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
from lsst.pipe.tasks.registerImage import RegisterTask
from lsst.meas.algorithms import SourceDetectionTask, PsfAttributes, SingleGaussianPsf, \
ObjectSizeStarSelectorTask
from lsst.ip.diffim import ImagePsfMatchTask, DipoleMeasurementTask, DipoleAnalysis, \
from lsst.ip.diffim import ImagePsfMatchTask, DipoleAnalysis, \
SourceFlagChecker, KernelCandidateF, cast_KernelCandidateF, makeKernelBasisList, \
KernelCandidateQa, DiaCatalogSourceSelectorTask, DiaCatalogSourceSelectorConfig, \
GetCoaddAsTemplateTask, GetCalexpAsTemplateTask
GetCoaddAsTemplateTask, GetCalexpAsTemplateTask, DipoleFitTask
import lsst.ip.diffim.diffimTools as diffimTools
import lsst.ip.diffim.utils as diUtils

Expand Down Expand Up @@ -70,6 +70,7 @@ class ImageDifferenceConfig(pexConfig.Config):
doMatchSources = pexConfig.Field(dtype=bool, default=True,
doc="Match diaSources with input calexp sources and ref catalog sources")
doMeasurement = pexConfig.Field(dtype=bool, default=True, doc="Measure diaSources?")
doDipoleFitting = pexConfig.Field(dtype=bool, default=True, doc="Measure dipoles using new algorithm?")
doWriteSubtractedExp = pexConfig.Field(dtype=bool, default=True, doc="Write difference exposure?")
doWriteMatchedExp = pexConfig.Field(dtype=bool, default=False,
doc="Write warped and PSF-matched template coadd exposure?")
Expand Down Expand Up @@ -103,9 +104,13 @@ class ImageDifferenceConfig(pexConfig.Config):
target=SourceDetectionTask,
doc="Low-threshold detection for final measurement",
)
#measurement = pexConfig.ConfigurableField(
# target=DipoleMeasurementTask,
# doc="Final source measurement on low-threshold detections; dipole fitting enabled.",
#)
measurement = pexConfig.ConfigurableField(
target=DipoleMeasurementTask,
doc="Final source measurement on low-threshold detections; dipole fitting enabled.",
target=DipoleFitTask,
doc="Enable updated dipole fitting method.",
)
getTemplate = pexConfig.ConfigurableField(
target = GetCoaddAsTemplateTask,
Expand Down Expand Up @@ -207,8 +212,11 @@ def __init__(self, **kwargs):
if self.config.doDetection:
self.makeSubtask("detection", schema=self.schema)
if self.config.doMeasurement:
self.makeSubtask("measurement", schema=self.schema,
algMetadata=self.algMetadata)
if not self.config.doDipoleFitting:
self.makeSubtask("measurement", schema=self.schema,
algMetadata=self.algMetadata)
else:
self.makeSubtask("measurement", schema=self.schema)
if self.config.doMatchSources:
self.schema.addField("refMatchId", "L", "unique id of reference catalog match")
self.schema.addField("srcMatchId", "L", "unique id of source match")
Expand Down Expand Up @@ -518,7 +526,10 @@ def run(self, sensorRef, templateIdList=None):

if self.config.doMeasurement:
self.log.info("Running diaSource measurement")
self.measurement.run(diaSources, subtractedExposure)
if not self.config.doDipoleFitting:
self.measurement.run(diaSources, subtractedExposure)
else:
self.measurement.run(diaSources, subtractedExposure, exposure, templateExposure)

# Match with the calexp sources if possible
if self.config.doMatchSources:
Expand Down