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

Adapt to removal of pipe.base.task.Task.display(). #8

Merged
merged 1 commit into from
Jan 11, 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
47 changes: 42 additions & 5 deletions python/lsst/obs/cfht/cfhtCalibrate.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,35 @@
#
# LSST Data Management System
#
# Copyright 2008-2016 AURA/LSST.
#
# This product includes software developed by the
# LSST Project (http://www.lsst.org/).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
# see <https://www.lsstcorp.org/LegalNotices/>.
#
import math

import lsst.afw.math as afwMath
import lsst.afw.table as afwTable
from lsst.meas.base import BasePlugin
import lsst.meas.algorithms as measAlg
import lsst.pipe.base as pipeBase
from lsstDebug import getDebugFrame
from lsst.afw.display import getDisplay
from lsst.meas.astrom import displayAstrometry

import lsst.pipe.tasks.calibrate

Expand Down Expand Up @@ -43,13 +68,17 @@ def run(self, exposure, defects=None, idFactory=None, expId=0):
backgrounds = afwMath.BackgroundList()
keepCRs = True # At least until we know the PSF
self.repair.run(exposure, defects=defects, keepCRs=keepCRs)
self.display('repair', exposure=exposure)
frame = getDebugFrame(self._display, "repair")
if frame:
getDisplay(frame).mtv(exposure)

if self.config.doBackground:
with self.timer("background"):
bg, exposure = measAlg.estimateBackground(exposure, self.config.background, subtract=True)
backgrounds.append(bg)
self.display('background', exposure=exposure)
frame = getDebugFrame(self._display, "background")
if frame:
getDisplay(frame).mtv(exposure)

# Make both tables from the same detRet, since detection can only be run once
table1 = afwTable.SourceTable.make(self.schema1, idFactory)
Expand Down Expand Up @@ -83,7 +112,9 @@ def run(self, exposure, defects=None, idFactory=None, expId=0):

if self.config.doPsf:
self.repair.run(exposure, defects=defects, keepCRs=None)
self.display('PSF_repair', exposure=exposure)
frame = getDebugFrame(self._display, "PSF_repair")
if frame:
getDisplay(frame).mtv(exposure)

if self.config.doBackground:
# Background estimation ignores (by default) pixels with the
Expand All @@ -97,7 +128,9 @@ def run(self, exposure, defects=None, idFactory=None, expId=0):
self.log.info("Fit and subtracted background")
backgrounds.append(bg)

self.display('PSF_background', exposure=exposure)
frame = getDebugFrame(self._display, "PSF_background")
if frame:
getDisplay(frame).mtv(exposure)

# make a second table with which to do the second measurement
# the schemaMapper will copy the footprints and ids, which is all we need.
Expand Down Expand Up @@ -151,7 +184,11 @@ def run(self, exposure, defects=None, idFactory=None, expId=0):
metadata.set('COLORTERM3', 0.0)
else:
photocalRet = None
self.display('calibrate', exposure=exposure, sources=sources, matches=matches)

frame = getDebugFrame(self._display, "calibrate")
if frame:
displayAstrometry(exposure=exposure, sourceCat=sources, matches=matches,
frame=self.frame, pause=False)

return pipeBase.Struct(
exposure = exposure,
Expand Down