Skip to content

Commit

Permalink
Merge pull request #103 from lsst/tickets/DM-35917
Browse files Browse the repository at this point in the history
DM-35917: Allow gen3 SkyCorrectionTask to be imported without gen2
  • Loading branch information
timj committed Aug 25, 2022
2 parents 1ca1189 + fa2e20a commit 96f01af
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 6 deletions.
25 changes: 22 additions & 3 deletions python/lsst/pipe/drivers/skyCorrection.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,35 @@
import lsst.afw.image as afwImage
import lsst.pipe.base as pipeBase

from lsst.pipe.base import ArgumentParser, ConfigDatasetType
from lsst.daf.butler import DimensionGraph
from lsst.pex.config import Config, Field, ConfigurableField, ConfigField
from lsst.ctrl.pool.pool import Pool
from lsst.ctrl.pool.parallel import BatchPoolTask
from lsst.pipe.drivers.background import (SkyMeasurementTask, FocalPlaneBackground,
FocalPlaneBackgroundConfig, MaskObjectsTask)
import lsst.pipe.drivers.visualizeVisit as visualizeVisit
import lsst.pipe.base.connectionTypes as cT

try:
from lsst.pipe.base import ArgumentParser
from lsst.pipe.base import ConfigDatasetType

except ImportError:
from argparse import ArgumentParser

class ConfigDatasetType:
def __init__(**kwargs):
raise NotImplementedError()

try:
from lsst.ctrl.pool.pool import Pool
except ImportError:
class Pool:
pass

try:
from lsst.ctrl.pool.parallel import BatchPoolTask
except ImportError:
from lsst.pipe.base import Task as BatchPoolTask

__all__ = ["SkyCorrectionConfig", "SkyCorrectionTask"]

DEBUG = False # Debugging outputs?
Expand Down
21 changes: 18 additions & 3 deletions python/lsst/pipe/drivers/visualizeVisit.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,25 @@
import lsst.afw.image as afwImage

from lsst.afw.cameraGeom.utils import makeImageFromCamera
from lsst.pipe.base import ArgumentParser

from lsst.pex.config import Config, Field
from lsst.ctrl.pool.pool import Pool
from lsst.ctrl.pool.parallel import BatchPoolTask

# Allow imports for gen3 code paths.
try:
from lsst.pipe.base import ArgumentParser
except ImportError:
from argparse import ArgumentParser

try:
from lsst.ctrl.pool.pool import Pool
except ImportError:
class Pool:
pass

try:
from lsst.ctrl.pool.parallel import BatchPoolTask
except ImportError:
from lsst.pipe.base import Task as BatchPoolTask


def makeCameraImage(camera, exposures, binning):
Expand Down

0 comments on commit 96f01af

Please sign in to comment.