Skip to content

Commit

Permalink
Switch lsst.log usage to logging
Browse files Browse the repository at this point in the history
  • Loading branch information
timj committed Jul 20, 2021
1 parent f96c353 commit a272210
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 14 deletions.
4 changes: 3 additions & 1 deletion python/lsst/pipe/tasks/assembleCoadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import copy
import numpy
import warnings
import logging
import lsst.pex.config as pexConfig
import lsst.pex.exceptions as pexExceptions
import lsst.geom as geom
Expand All @@ -34,7 +35,6 @@
import lsst.coadd.utils as coaddUtils
import lsst.pipe.base as pipeBase
import lsst.meas.algorithms as measAlg
import lsst.log as log
import lsstDebug
import lsst.utils as utils
from lsst.skymap import BaseSkyMap
Expand All @@ -52,6 +52,8 @@
"SafeClipAssembleCoaddTask", "SafeClipAssembleCoaddConfig",
"CompareWarpAssembleCoaddTask", "CompareWarpAssembleCoaddConfig"]

log = logging.getLogger(__name__.partition(".")[2])


class AssembleCoaddConnections(pipeBase.PipelineTaskConnections,
dimensions=("tract", "patch", "band", "skymap"),
Expand Down
4 changes: 3 additions & 1 deletion python/lsst/pipe/tasks/makeCoaddTempExp.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
# see <http://www.lsstcorp.org/LegalNotices/>.
#
import numpy
import logging

import lsst.pex.config as pexConfig
import lsst.daf.persistence as dafPersist
import lsst.afw.image as afwImage
import lsst.coadd.utils as coaddUtils
import lsst.pipe.base as pipeBase
import lsst.pipe.base.connectionTypes as connectionTypes
import lsst.log as log
import lsst.utils as utils
import lsst.geom
from lsst.meas.algorithms import CoaddPsf, CoaddPsfConfig
Expand All @@ -39,6 +39,8 @@

__all__ = ["MakeCoaddTempExpTask", "MakeWarpTask", "MakeWarpConfig"]

log = logging.getLogger(__name__.partition(".")[2])


class MissingExposureError(Exception):
"""Raised when data cannot be retrieved for an exposure.
Expand Down
4 changes: 2 additions & 2 deletions python/lsst/pipe/tasks/objectMasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@

import re
import os.path
import logging
import lsst.daf.base as dafBase
import lsst.geom as geom
import lsst.afw.table as afwTable
from lsst.daf.butler.formatters.file import FileFormatter
from lsst.log import Log


class ObjectMaskCatalog:
Expand Down Expand Up @@ -118,7 +118,7 @@ def read(fileName):
region definitions.
"""

log = Log.getLogger("ObjectMaskCatalog")
log = logging.getLogger("ObjectMaskCatalog")

brightObjects = ObjectMaskCatalog()
checkedWcsIsFk5 = False
Expand Down
4 changes: 2 additions & 2 deletions tests/test_isPrimaryFlag.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
import os
import unittest
import numpy as np
import logging

from lsst.geom import Point2I, Box2I, Extent2I
from lsst.skymap import TractInfo
from lsst.skymap.patchInfo import PatchInfo
import lsst.afw.image as afwImage
import lsst.utils.tests
from lsst.utils import getPackageDir
from lsst.log import Log
from lsst.pipe.tasks.characterizeImage import CharacterizeImageTask, CharacterizeImageConfig
from lsst.pipe.tasks.calibrate import CalibrateTask, CalibrateConfig
from lsst.meas.algorithms import SourceDetectionTask, SkyObjectsTask
Expand Down Expand Up @@ -160,7 +160,7 @@ def setUp(self):
self.charImResults = charImTask.run(self.exposure)

# set log level so that warnings do not display
Log.getLogger("calibrate").setLevel(Log.ERROR)
logging.getLogger("calibrate").setLevel(logging.ERROR)

def tearDown(self):
del self.exposure
Expand Down
9 changes: 5 additions & 4 deletions tests/test_photoCal.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#
import os
import unittest
import logging

import numpy as np
import astropy.units as u
Expand All @@ -32,14 +33,14 @@
import lsst.afw.image as afwImage
import lsst.utils.tests
from lsst.utils import getPackageDir
from lsst.log import Log
from lsst.pipe.tasks.photoCal import PhotoCalTask, PhotoCalConfig
from lsst.pipe.tasks.colorterms import Colorterm, ColortermDict, ColortermLibrary
from lsst.pipe.base.task_logging import LOG_TRACE

RefCatDir = os.path.join(getPackageDir("pipe_tasks"), "tests", "data", "sdssrefcat")

# Quiet down meas_astrom logging, so we can see PhotoCal logs better
Log.getLogger("LoadIndexedReferenceObjectsTask").setLevel(Log.WARN)
logging.getLogger("LoadIndexedReferenceObjectsTask").setLevel(logging.WARN)

testColorterms = ColortermLibrary(data={
"test*": ColortermDict(data={
Expand Down Expand Up @@ -85,8 +86,8 @@ def setUp(self):
# Make a reference loader
butler = Butler(RefCatDir)
self.refObjLoader = LoadIndexedReferenceObjectsTask(butler=butler)
logLevel = Log.TRACE
self.log = Log.getLogger('testPhotoCal')
logLevel = LOG_TRACE
self.log = logging.getLogger('testPhotoCal')
self.log.setLevel(logLevel)

self.config = PhotoCalConfig()
Expand Down
4 changes: 2 additions & 2 deletions tests/test_psfCandidateSelection.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
#
import os
import unittest
import logging

import lsst.afw.image as afwImage
import lsst.utils.tests
from lsst.utils import getPackageDir
from lsst.log import Log
from lsst.pipe.tasks.characterizeImage import CharacterizeImageTask


Expand All @@ -36,7 +36,7 @@ def setUp(self):
expPath = os.path.join(getPackageDir("pipe_tasks"), "tests", "data", "v695833-e0-c000-a00.sci.fits")
self.exposure = afwImage.ExposureF(expPath)
# set log level so that warnings do not display
Log.getLogger("characterizeImage").setLevel(Log.ERROR)
logging.getLogger("characterizeImage").setLevel(logging.ERROR)

def tearDown(self):
del self.exposure
Expand Down
4 changes: 2 additions & 2 deletions tests/test_skySources.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@

import os
import unittest
import logging

import lsst.afw.image as afwImage
import lsst.utils.tests
from lsst.utils import getPackageDir
from lsst.log import Log
from lsst.pipe.tasks.characterizeImage import CharacterizeImageTask, CharacterizeImageConfig
from lsst.pipe.tasks.calibrate import CalibrateTask, CalibrateConfig

Expand All @@ -37,7 +37,7 @@ def setUp(self):
expPath = os.path.join(getPackageDir("pipe_tasks"), "tests", "data", "v695833-e0-c000-a00.sci.fits")
self.exposure = afwImage.ExposureF(expPath)
# set log level so that warnings do not display
Log.getLogger("calibrate").setLevel(Log.ERROR)
logging.getLogger("calibrate").setLevel(logging.ERROR)

def tearDown(self):
del self.exposure
Expand Down

0 comments on commit a272210

Please sign in to comment.