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-7502: Switch to use lsst.log #7

Merged
merged 1 commit into from
Sep 22, 2016
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
4 changes: 2 additions & 2 deletions examples/warpAndCoadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
import traceback

import lsst.pex.config as pexConfig
import lsst.pex.logging as pexLog
import lsst.afw.geom as afwGeom
import lsst.afw.image as afwImage
import lsst.afw.math as afwMath
import lsst.coadd.utils as coaddUtils
from lsst.log import Log


class WarpAndCoaddConfig(pexConfig.Config):
Expand Down Expand Up @@ -159,7 +159,7 @@ def warpAndCoadd(coaddPath, exposureListPath, config):
(timePerGoodExposure,), file=sys.stderr)

if __name__ == "__main__":
pexLog.Trace.setVerbosity('lsst.coadd', 3)
Log.getLogger('coadd').setLevel(Log.DEBUG)
helpStr = """Usage: warpAndCoadd.py coaddPath exposureListPath

where:
Expand Down
6 changes: 3 additions & 3 deletions python/lsst/coadd/utils/coadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from builtins import object

import lsst.pex.config as pexConfig
from lsst.pex.logging import Log
from lsst.log import Log
import lsst.afw.image as afwImage
import lsst.afw.math as afwMath
from .utilsLib import addToCoadd, setCoaddEdgeBits
Expand Down Expand Up @@ -61,7 +61,7 @@ def __init__(self, bbox, wcs, badMaskPlanes, logName="coadd.utils.Coadd"):
badMaskPlanes should always include "NO_DATA".
@param[in] logName: name by which messages are logged
"""
self._log = Log(Log.getDefaultLog(), logName)
self._log = Log.getLogger(logName)
self._bbox = bbox
self._wcs = wcs
self._badPixelMask = afwImage.MaskU.getPlaneBitMask(badMaskPlanes)
Expand Down Expand Up @@ -121,7 +121,7 @@ def addExposure(self, exposure, weightFactor=1.0):
filter = exposure.getFilter()
self._filterDict.setdefault(filter.getName(), filter)

self._log.log(Log.INFO, "Add exposure to coadd with weight=%0.3g" % (weight,))
self._log.info("Add exposure to coadd with weight=%0.3g", weight)

overlapBBox = addToCoadd(self._coadd.getMaskedImage(), self._weightMap,
maskedImage, self._badPixelMask, weight)
Expand Down
1 change: 0 additions & 1 deletion python/lsst/coadd/utils/utilsLib.i
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ Python interface to lsst::coadd::utils functions and classes
// Everything we will need in the _wrap.cc file
%{
#include <cstdint>
#include "lsst/pex/logging.h"
#include "lsst/afw/cameraGeom.h"
#include "lsst/coadd/utils.h"
%}
Expand Down
5 changes: 2 additions & 3 deletions tests/testAddToCoadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,15 @@
import lsst.afw.math as afwMath
import lsst.afw.display.ds9 as ds9
import lsst.pex.exceptions as pexExcept
import lsst.pex.logging as pexLog
import lsst.coadd.utils as coaddUtils
from lsst.log import Log

try:
display
except NameError:
display = False
Verbosity = 0 # increase to see trace

pexLog.Trace_setVerbosity("lsst.coadd.utils", Verbosity)
Log.getLogger("coadd.utils").setLevel(Log.INFO)

try:
AfwdataDir = lsst.utils.getPackageDir('afwdata')
Expand Down
5 changes: 2 additions & 3 deletions tests/testCoadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,16 @@
import lsst.afw.geom as afwGeom
import lsst.afw.image as afwImage
import lsst.afw.image.utils as imageUtils
import lsst.pex.logging as pexLog
import lsst.coadd.utils as coaddUtils
import lsst.pex.policy as pexPolicy
from lsst.log import Log

try:
display
except NameError:
display = False
Verbosity = 0 # increase to see trace

pexLog.Trace_setVerbosity("lsst.coadd.utils", Verbosity)
Log.getLogger("coadd.utils").setLevel(Log.INFO)

try:
AfwdataDir = lsst.utils.getPackageDir('afwdata')
Expand Down
5 changes: 2 additions & 3 deletions tests/testCopyGoodPixels.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,15 @@
import lsst.utils.tests
import lsst.afw.geom as afwGeom
import lsst.afw.image as afwImage
import lsst.pex.logging as pexLog
import lsst.coadd.utils as coaddUtils
from lsst.log import Log

try:
display
except NameError:
display = False
Verbosity = 0 # increase to see trace

pexLog.Trace_setVerbosity("lsst.coadd.utils", Verbosity)
Log.getLogger("coadd.utils").setLevel(Log.INFO)


def referenceCopyGoodPixelsImage(destImage, srcImage):
Expand Down
5 changes: 2 additions & 3 deletions tests/testSetCoaddEdgeBits.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@
import lsst.utils.tests
import lsst.afw.geom as afwGeom
import lsst.afw.image as afwImage
import lsst.pex.logging as pexLog
import lsst.coadd.utils as coaddUtils
from lsst.log import Log

Verbosity = 0 # increase to see trace
pexLog.Trace_setVerbosity("lsst.coadd.utils", Verbosity)
Log.getLogger("coadd.utils").setLevel(Log.INFO)


class SetCoaddEdgeBitsTestCase(lsst.utils.tests.TestCase):
Expand Down
6 changes: 2 additions & 4 deletions tests/testSetMaskBits.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,10 @@

import lsst.utils.tests
import lsst.afw.image as afwImage
import lsst.pex.logging as pexLog
import lsst.coadd.utils as coaddUtils
from lsst.log import Log

Verbosity = 0

pexLog.Trace_setVerbosity("lsst.coadd.utils", Verbosity)
Log.getLogger("coadd.utils").setLevel(Log.INFO)


def countBits(val):
Expand Down
2 changes: 1 addition & 1 deletion ups/coadd_utils.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import lsst.sconsUtils

dependencies = {
"required": ["afw", "pex_logging"],
"required": ["afw"],
"buildRequired": ["swig"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it not necessary to replace "pex_logging" with "log" (as you did here lsst-dm/legacy-daf_persistence@04c1827#diff-8ffc87142b5d2a853222efb750057a1eL6) that no C code uses logging in this repo?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. No c++ codes in this package use log (yet).

}

Expand Down
2 changes: 1 addition & 1 deletion ups/coadd_utils.table
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
setupRequired(afw)
setupRequired(log)
setupRequired(numpy)
setupRequired(pex_config)
setupRequired(pex_logging)
setupRequired(pipe_base)
setupRequired(scons)
setupRequired(sconsUtils)
Expand Down