diff --git a/python/lsst/afw/detection/multiband.py b/python/lsst/afw/detection/multiband.py index b726a6b389..87dd8d8a75 100644 --- a/python/lsst/afw/detection/multiband.py +++ b/python/lsst/afw/detection/multiband.py @@ -25,8 +25,11 @@ from lsst.geom import Point2I from lsst.afw.geom import SpanSet -from lsst.afw.image.image import Mask, Image, MultibandImage, MultibandMaskedImage -from lsst.afw.image.maskedImage import MaskedImage + +# Need to use the private name of the package for imports here because +# lsst.afw.image itself imports lsst.afw.detection +from lsst.afw.image._image import Mask, Image, MultibandImage, MultibandMaskedImage +from lsst.afw.image._maskedImage import MaskedImage from lsst.afw.multiband import MultibandBase from . import Footprint, makeHeavyFootprint diff --git a/python/lsst/afw/image/__init__.py b/python/lsst/afw/image/__init__.py index 204dfcc473..4fb853daf2 100644 --- a/python/lsst/afw/image/__init__.py +++ b/python/lsst/afw/image/__init__.py @@ -20,13 +20,13 @@ # along with this program. If not, see . from ._imageLib import * from . import pixel -from .image import * -from .apCorrMap import * -from .maskedImage import * +from ._image import * +from ._apCorrMap import * +from ._maskedImage import * from ._visitInfo import * # just here to support deprecation -from .exposure import * +from ._exposure import * from ._exposureInfoContinued import * from ._exposureSummaryStats import * -from .basicUtils import * +from ._basicUtils import * from .testUtils import * from ._photoCalibContinued import * diff --git a/python/lsst/afw/image/apCorrMap/SConscript b/python/lsst/afw/image/_apCorrMap/SConscript similarity index 100% rename from python/lsst/afw/image/apCorrMap/SConscript rename to python/lsst/afw/image/_apCorrMap/SConscript diff --git a/python/lsst/afw/image/apCorrMap/__init__.py b/python/lsst/afw/image/_apCorrMap/__init__.py similarity index 100% rename from python/lsst/afw/image/apCorrMap/__init__.py rename to python/lsst/afw/image/_apCorrMap/__init__.py diff --git a/python/lsst/afw/image/apCorrMap/_apCorrMap.cc b/python/lsst/afw/image/_apCorrMap/_apCorrMap.cc similarity index 99% rename from python/lsst/afw/image/apCorrMap/_apCorrMap.cc rename to python/lsst/afw/image/_apCorrMap/_apCorrMap.cc index 77b584c386..09d244a697 100644 --- a/python/lsst/afw/image/apCorrMap/_apCorrMap.cc +++ b/python/lsst/afw/image/_apCorrMap/_apCorrMap.cc @@ -69,7 +69,7 @@ void wrapApCorrMap(lsst::utils::python::WrapperCollection &wrappers) { } PYBIND11_MODULE(_apCorrMap, mod) { - lsst::utils::python::WrapperCollection wrappers(mod, "lsst.afw.image.apCorrMap"); + lsst::utils::python::WrapperCollection wrappers(mod, "lsst.afw.image._apCorrMap"); wrappers.addInheritanceDependency("lsst.afw.table.io"); wrappers.addInheritanceDependency("lsst.afw.typehandling"); wrapApCorrMap(wrappers); diff --git a/python/lsst/afw/image/apCorrMap/_apCorrMapContinued.py b/python/lsst/afw/image/_apCorrMap/_apCorrMapContinued.py similarity index 100% rename from python/lsst/afw/image/apCorrMap/_apCorrMapContinued.py rename to python/lsst/afw/image/_apCorrMap/_apCorrMapContinued.py diff --git a/python/lsst/afw/image/basicUtils.py b/python/lsst/afw/image/_basicUtils.py similarity index 96% rename from python/lsst/afw/image/basicUtils.py rename to python/lsst/afw/image/_basicUtils.py index c586e876c0..690e7dfddb 100644 --- a/python/lsst/afw/image/basicUtils.py +++ b/python/lsst/afw/image/_basicUtils.py @@ -21,8 +21,8 @@ __all__ = ["makeImageFromArray", "makeMaskFromArray", "makeMaskedImageFromArrays"] -from .image import Image, Mask -from .maskedImage import MaskedImage +from ._image import Image, Mask +from ._maskedImage import MaskedImage def makeImageFromArray(array): diff --git a/python/lsst/afw/image/exposure/SConscript b/python/lsst/afw/image/_exposure/SConscript similarity index 100% rename from python/lsst/afw/image/exposure/SConscript rename to python/lsst/afw/image/_exposure/SConscript diff --git a/python/lsst/afw/image/_exposure/__init__.py b/python/lsst/afw/image/_exposure/__init__.py new file mode 100644 index 0000000000..3057f10757 --- /dev/null +++ b/python/lsst/afw/image/_exposure/__init__.py @@ -0,0 +1,24 @@ +# This file is part of afw. +# +# Developed for the LSST Data Management System. +# This product includes software developed by the LSST Project +# (https://www.lsst.org). +# See the COPYRIGHT file at the top-level directory of this distribution +# for details of code ownership. +# +# 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 GNU General Public License +# along with this program. If not, see . + +from ._exposure import * +from ._exposureContinued import * +from ._multiband import * diff --git a/python/lsst/afw/image/exposure/_exposure.cc b/python/lsst/afw/image/_exposure/_exposure.cc similarity index 98% rename from python/lsst/afw/image/exposure/_exposure.cc rename to python/lsst/afw/image/_exposure/_exposure.cc index 0317247f2d..0c7c0e60e7 100644 --- a/python/lsst/afw/image/exposure/_exposure.cc +++ b/python/lsst/afw/image/_exposure/_exposure.cc @@ -177,11 +177,11 @@ PyExposure declareExposure(lsst::utils::python::WrapperCollection &wrapp } } // namespace PYBIND11_MODULE(_exposure, mod) { - lsst::utils::python::WrapperCollection wrappers(mod, "lsst.afw.image.exposure"); - wrappers.addSignatureDependency("lsst.afw.image.apCorrMap"); + lsst::utils::python::WrapperCollection wrappers(mod, "lsst.afw.image._exposure"); + wrappers.addSignatureDependency("lsst.afw.image._apCorrMap"); wrappers.addSignatureDependency("lsst.afw.geom"); wrappers.addSignatureDependency("lsst.afw.detection"); - wrappers.addSignatureDependency("lsst.afw.image.maskedImage"); + wrappers.addSignatureDependency("lsst.afw.image._maskedImage"); auto clsExposureF = declareExposure(wrappers, "F"); auto clsExposureD = declareExposure(wrappers, "D"); diff --git a/python/lsst/afw/image/exposure/_exposureContinued.py b/python/lsst/afw/image/_exposure/_exposureContinued.py similarity index 95% rename from python/lsst/afw/image/exposure/_exposureContinued.py rename to python/lsst/afw/image/_exposure/_exposureContinued.py index c0fa34b01c..e08bef1d4f 100644 --- a/python/lsst/afw/image/exposure/_exposureContinued.py +++ b/python/lsst/afw/image/_exposure/_exposureContinued.py @@ -25,11 +25,11 @@ from lsst.utils import TemplateMeta -from ..image._slicing import supportSlicing -from ..image._disableArithmetic import disableImageArithmetic -from ..image._fitsIoWithOptions import imageReadFitsWithOptions, exposureWriteFitsWithOptions +from .._image._slicing import supportSlicing +from .._image._disableArithmetic import disableImageArithmetic +from .._image._fitsIoWithOptions import imageReadFitsWithOptions, exposureWriteFitsWithOptions from ._exposure import ExposureI, ExposureF, ExposureD, ExposureU, ExposureL -from .exposureUtils import bbox_to_convex_polygon, bbox_contains_sky_coords +from ..exposure.exposureUtils import bbox_to_convex_polygon, bbox_contains_sky_coords class Exposure(metaclass=TemplateMeta): diff --git a/python/lsst/afw/image/exposure/_multiband.py b/python/lsst/afw/image/_exposure/_multiband.py similarity index 98% rename from python/lsst/afw/image/exposure/_multiband.py rename to python/lsst/afw/image/_exposure/_multiband.py index 69ff501cac..c624857947 100644 --- a/python/lsst/afw/image/exposure/_multiband.py +++ b/python/lsst/afw/image/_exposure/_multiband.py @@ -27,9 +27,9 @@ from lsst.pex.exceptions import InvalidParameterError from . import Exposure, ExposureF from ..utils import projectImage -from ..image._multiband import MultibandTripleBase, MultibandPixel -from ..image._multiband import tripleFromSingles, tripleFromArrays, makeTripleFromKwargs -from ..maskedImage import MaskedImage +from .._image._multiband import MultibandTripleBase, MultibandPixel +from .._image._multiband import tripleFromSingles, tripleFromArrays, makeTripleFromKwargs +from .._maskedImage import MaskedImage class IncompleteDataError(Exception): diff --git a/python/lsst/afw/image/image/SConscript b/python/lsst/afw/image/_image/SConscript similarity index 100% rename from python/lsst/afw/image/image/SConscript rename to python/lsst/afw/image/_image/SConscript diff --git a/python/lsst/afw/image/image/__init__.py b/python/lsst/afw/image/_image/__init__.py similarity index 100% rename from python/lsst/afw/image/image/__init__.py rename to python/lsst/afw/image/_image/__init__.py diff --git a/python/lsst/afw/image/image/_disableArithmetic.py b/python/lsst/afw/image/_image/_disableArithmetic.py similarity index 100% rename from python/lsst/afw/image/image/_disableArithmetic.py rename to python/lsst/afw/image/_image/_disableArithmetic.py diff --git a/python/lsst/afw/image/image/_fitsIoWithOptions.py b/python/lsst/afw/image/_image/_fitsIoWithOptions.py similarity index 100% rename from python/lsst/afw/image/image/_fitsIoWithOptions.py rename to python/lsst/afw/image/_image/_fitsIoWithOptions.py diff --git a/python/lsst/afw/image/image/_image.cc b/python/lsst/afw/image/_image/_image.cc similarity index 100% rename from python/lsst/afw/image/image/_image.cc rename to python/lsst/afw/image/_image/_image.cc diff --git a/python/lsst/afw/image/image/_image.py b/python/lsst/afw/image/_image/_image.py similarity index 100% rename from python/lsst/afw/image/image/_image.py rename to python/lsst/afw/image/_image/_image.py diff --git a/python/lsst/afw/image/image/_imageLib.cc b/python/lsst/afw/image/_image/_imageLib.cc similarity index 98% rename from python/lsst/afw/image/image/_imageLib.cc rename to python/lsst/afw/image/_image/_imageLib.cc index 226ef98686..17e160cf3e 100644 --- a/python/lsst/afw/image/image/_imageLib.cc +++ b/python/lsst/afw/image/_image/_imageLib.cc @@ -32,7 +32,7 @@ void wrapImage(lsst::utils::python::WrapperCollection &); void wrapImageSlice(lsst::utils::python::WrapperCollection &); PYBIND11_MODULE(_imageLib, mod) { - lsst::utils::python::WrapperCollection wrappers(mod, "lsst.afw.image.image"); + lsst::utils::python::WrapperCollection wrappers(mod, "lsst.afw.image._image"); wrapImage(wrappers); wrapImageSlice(wrappers); wrappers.finish(); diff --git a/python/lsst/afw/image/image/_imageSlice.cc b/python/lsst/afw/image/_image/_imageSlice.cc similarity index 100% rename from python/lsst/afw/image/image/_imageSlice.cc rename to python/lsst/afw/image/_image/_imageSlice.cc diff --git a/python/lsst/afw/image/image/_mask.py b/python/lsst/afw/image/_image/_mask.py similarity index 100% rename from python/lsst/afw/image/image/_mask.py rename to python/lsst/afw/image/_image/_mask.py diff --git a/python/lsst/afw/image/image/_multiband.py b/python/lsst/afw/image/_image/_multiband.py similarity index 99% rename from python/lsst/afw/image/image/_multiband.py rename to python/lsst/afw/image/_image/_multiband.py index 270e13d01a..8fe63aaf75 100644 --- a/python/lsst/afw/image/image/_multiband.py +++ b/python/lsst/afw/image/_image/_multiband.py @@ -25,7 +25,7 @@ from lsst.geom import Point2I, Box2I, Extent2I from . import Image, ImageF, Mask, MaskPixel, PARENT, LOCAL -from ..maskedImage import MaskedImage, MaskedImageF +from .._maskedImage import MaskedImage, MaskedImageF from ._slicing import imageIndicesToNumpy from ...multiband import MultibandBase diff --git a/python/lsst/afw/image/image/_slicing.py b/python/lsst/afw/image/_image/_slicing.py similarity index 100% rename from python/lsst/afw/image/image/_slicing.py rename to python/lsst/afw/image/_image/_slicing.py diff --git a/python/lsst/afw/image/maskedImage/SConscript b/python/lsst/afw/image/_maskedImage/SConscript similarity index 100% rename from python/lsst/afw/image/maskedImage/SConscript rename to python/lsst/afw/image/_maskedImage/SConscript diff --git a/python/lsst/afw/image/maskedImage/__init__.py b/python/lsst/afw/image/_maskedImage/__init__.py similarity index 100% rename from python/lsst/afw/image/maskedImage/__init__.py rename to python/lsst/afw/image/_maskedImage/__init__.py diff --git a/python/lsst/afw/image/maskedImage/_maskedImage.cc b/python/lsst/afw/image/_maskedImage/_maskedImage.cc similarity index 99% rename from python/lsst/afw/image/maskedImage/_maskedImage.cc rename to python/lsst/afw/image/_maskedImage/_maskedImage.cc index b9b7afc835..b320fdd69f 100644 --- a/python/lsst/afw/image/maskedImage/_maskedImage.cc +++ b/python/lsst/afw/image/_maskedImage/_maskedImage.cc @@ -242,8 +242,8 @@ void declareImagesOverlap(lsst::utils::python::WrapperCollection &wrappers) { } // namespace PYBIND11_MODULE(_maskedImage, mod) { - lsst::utils::python::WrapperCollection wrappers(mod, "lsst.afw.image.maskedImage"); - wrappers.addSignatureDependency("lsst.afw.image.image"); + lsst::utils::python::WrapperCollection wrappers(mod, "lsst.afw.image._maskedImage"); + wrappers.addSignatureDependency("lsst.afw.image._image"); wrappers.addInheritanceDependency("lsst.daf.base"); auto clsMaskedImageF = declareMaskedImage(wrappers, "F"); diff --git a/python/lsst/afw/image/maskedImage/_maskedImageContinued.py b/python/lsst/afw/image/_maskedImage/_maskedImageContinued.py similarity index 95% rename from python/lsst/afw/image/maskedImage/_maskedImageContinued.py rename to python/lsst/afw/image/_maskedImage/_maskedImageContinued.py index ad8068efa6..cda1baa89a 100644 --- a/python/lsst/afw/image/maskedImage/_maskedImageContinued.py +++ b/python/lsst/afw/image/_maskedImage/_maskedImageContinued.py @@ -23,9 +23,9 @@ from lsst.utils import TemplateMeta from ._maskedImage import MaskedImageI, MaskedImageF, MaskedImageD, MaskedImageU, MaskedImageL -from ..image._fitsIoWithOptions import imageReadFitsWithOptions, exposureWriteFitsWithOptions -from ..image._slicing import supportSlicing -from ..image._disableArithmetic import disableImageArithmetic +from .._image._fitsIoWithOptions import imageReadFitsWithOptions, exposureWriteFitsWithOptions +from .._image._slicing import supportSlicing +from .._image._disableArithmetic import disableImageArithmetic __all__ = ["MaskedImage", "VariancePixel"] diff --git a/python/lsst/afw/image/_readers.cc b/python/lsst/afw/image/_readers.cc index 20c064ed8c..1f9183970c 100644 --- a/python/lsst/afw/image/_readers.cc +++ b/python/lsst/afw/image/_readers.cc @@ -338,9 +338,9 @@ void declareExposureFitsReader(lsst::utils::python::WrapperCollection &wrappers) void wrapReaders(lsst::utils::python::WrapperCollection &wrappers) { // wrappers.addInheritanceDependency("lsst.daf.base"); wrappers.addSignatureDependency("lsst.geom"); - wrappers.addSignatureDependency("lsst.afw.image.image"); - wrappers.addSignatureDependency("lsst.afw.image.maskedImage"); - wrappers.addSignatureDependency("lsst.afw.image.exposure"); + wrappers.addSignatureDependency("lsst.afw.image._image"); + wrappers.addSignatureDependency("lsst.afw.image._maskedImage"); + wrappers.addSignatureDependency("lsst.afw.image._exposure"); declareImageFitsReader(wrappers); declareMaskFitsReader(wrappers); declareMaskedImageFitsReader(wrappers); diff --git a/python/lsst/afw/image/exposure/__init__.py b/python/lsst/afw/image/exposure/__init__.py index 3057f10757..e69de29bb2 100644 --- a/python/lsst/afw/image/exposure/__init__.py +++ b/python/lsst/afw/image/exposure/__init__.py @@ -1,24 +0,0 @@ -# This file is part of afw. -# -# Developed for the LSST Data Management System. -# This product includes software developed by the LSST Project -# (https://www.lsst.org). -# See the COPYRIGHT file at the top-level directory of this distribution -# for details of code ownership. -# -# 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 GNU General Public License -# along with this program. If not, see . - -from ._exposure import * -from ._exposureContinued import * -from ._multiband import * diff --git a/python/lsst/afw/image/testUtils.py b/python/lsst/afw/image/testUtils.py index 09c9eb159f..e46a761d18 100755 --- a/python/lsst/afw/image/testUtils.py +++ b/python/lsst/afw/image/testUtils.py @@ -27,8 +27,8 @@ import numpy as np import lsst.utils.tests -from .image import ImageF -from .basicUtils import makeMaskedImageFromArrays +from ._image import ImageF +from ._basicUtils import makeMaskedImageFromArrays def makeGaussianNoiseMaskedImage(dimensions, sigma, variance=1.0): diff --git a/python/lsst/afw/image/utils.py b/python/lsst/afw/image/utils.py index 2ee3e5a8db..dcb2829f0d 100644 --- a/python/lsst/afw/image/utils.py +++ b/python/lsst/afw/image/utils.py @@ -22,8 +22,8 @@ __all__ = ["clipImage", "projectImage", "getProjectionIndices"] import lsst.afw.detection as afwDetect -from .maskedImage import MaskedImage, makeMaskedImage -from .image import Mask +from ._maskedImage import MaskedImage, makeMaskedImage +from ._image import Mask def clipImage(im, minClip, maxClip): diff --git a/python/lsst/afw/math/_background.cc b/python/lsst/afw/math/_background.cc index 81f39e9826..3ec357bf27 100644 --- a/python/lsst/afw/math/_background.cc +++ b/python/lsst/afw/math/_background.cc @@ -161,7 +161,7 @@ void declareBackground(lsst::utils::python::WrapperCollection &wrappers) { } void wrapBackground(lsst::utils::python::WrapperCollection &wrappers) { // FIXME: review when lsst.afw.image is converted to python wrappers - wrappers.addInheritanceDependency("lsst.afw.image.image"); + wrappers.addInheritanceDependency("lsst.afw.image"); declareBackground(wrappers); declareMakeBackground>(wrappers); declareMakeBackground>(wrappers); diff --git a/tests/test_photoCalib.py b/tests/test_photoCalib.py index 6912580f29..2bffdde7b7 100644 --- a/tests/test_photoCalib.py +++ b/tests/test_photoCalib.py @@ -580,7 +580,7 @@ def setupImage(self): image = np.random.normal(loc=1000.0, scale=sigma, size=npDim).astype(np.float32) mask = np.zeros(npDim, dtype=np.int32) variance = (np.random.normal(loc=0.0, scale=sigma, size=npDim).astype(np.float32))**2 - maskedImage = lsst.afw.image.basicUtils.makeMaskedImageFromArrays(image, mask, variance) + maskedImage = lsst.afw.image.makeMaskedImageFromArrays(image, mask, variance) maskedImage.mask[0, 0] = True # set one mask bit to check propagation of mask bits. return npDim, maskedImage, image, mask, variance