Example #1
0
#
# 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 <https://www.gnu.org/licenses/>.

from lsst.utils.deprecated import deprecate_pybind11
from .convolveImage import convolve

__all__ = []  # import this module only for its side effects

convolve = deprecate_pybind11(
    convolve,
    reason=
    'Overloads that do *not* use a ``ConvolutionControl`` are deprecated. '
    'To be removed after 20.0.0.')
Example #2
0
        Parameters
        ----------
        summaryStats : `lsst.afw.image.ExposureSummaryStats`
        """
        self.setComponent(self.KEY_SUMMARY_STATS, summaryStats)

    def hasSummaryStats(self):
        """Check if exposureInfo has a summary statistics component.

        Returns
        -------
        hasSummaryStats : `bool`
            True if exposureInfo has a summary statistics component.
        """
        return self.hasComponent(self.KEY_SUMMARY_STATS)


ExposureInfo.hasFilterLabel = deprecate_pybind11(
    ExposureInfo.hasFilterLabel,
    reason="Replaced by hasFilter. Will be removed after v24.",
    version="v24.0")
ExposureInfo.getFilterLabel = deprecate_pybind11(
    ExposureInfo.getFilterLabel,
    reason="Replaced by getFilter. Will be removed after v24.",
    version="v24.0")
ExposureInfo.setFilterLabel = deprecate_pybind11(
    ExposureInfo.setFilterLabel,
    reason="Replaced by setFilter. Will be removed after v24.",
    version="v24.0")
Example #3
0
# 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 <https://www.gnu.org/licenses/>.

from lsst.utils import continueClass
from lsst.utils.deprecated import deprecate_pybind11
from .background import Background, BackgroundMI

__all__ = []  # import this module only for its side effects


@continueClass  # noqa: F811
class Background:
    def __reduce__(self):
        """Pickling"""
        return self.__class__, (self.getImageBBox(), self.getStatsImage())


BackgroundMI.getPixel = deprecate_pybind11(
    BackgroundMI.getPixel,
    reason='Use `getImageF` instead. To be removed after 20.0.0.')
Example #4
0
                                        padding=padding)

    readFitsWithOptions = classmethod(imageReadFitsWithOptions)

    writeFitsWithOptions = exposureWriteFitsWithOptions


Exposure.register(np.int32, ExposureI)
Exposure.register(np.float32, ExposureF)
Exposure.register(np.float64, ExposureD)
Exposure.register(np.uint16, ExposureU)
Exposure.register(np.uint64, ExposureL)
Exposure.alias("I", ExposureI)
Exposure.alias("F", ExposureF)
Exposure.alias("D", ExposureD)
Exposure.alias("U", ExposureU)
Exposure.alias("L", ExposureL)

for cls in set(Exposure.values()):
    supportSlicing(cls)
    disableImageArithmetic(cls)
    cls.getFilterLabel = deprecate_pybind11(
        cls.getFilterLabel,
        reason="Replaced by getFilter. Will be removed after v24.",
        version="v24.0")
    cls.setFilterLabel = deprecate_pybind11(
        cls.setFilterLabel,
        reason="Replaced by setFilter. Will be removed after v24.",
        version="v24.0")
    # Can't attach deprecation warning to filterLabel property.
Example #5
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 <https://www.gnu.org/licenses/>.

__all__ = []  # import this module only for its side effects

from lsst.utils.deprecated import deprecate_pybind11
from .readMetadata import readMetadata

readMetadata = deprecate_pybind11(
    readMetadata,
    reason="Use `afw.fits.readMetadata` instead. To be removed after 20.0.0.")
Example #6
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 <https://www.gnu.org/licenses/>.

# This file exists only to support deprecation, and can be removed on DM-27811.

from lsst.utils.deprecated import deprecate_pybind11
from ._imageLib import ExposureFitsReader

ExposureFitsReader.readFilterLabel = deprecate_pybind11(
    ExposureFitsReader.readFilterLabel,
    reason="Replaced by readFilter. Will be removed after v24.",
    version="v24.0")
Example #7
0
    Notes
    -----
    This pure python implementation exists as a historical artifact
    related to SWIG limitations. It might be practical to wrap the
    overloaded C++ functions with pybind11, but there didn't seem much
    point.
    """
    schema = Schema()
    outKey1 = schema.addField("first", type=np.int64,
                              doc="ID for first source record in match.")
    outKey2 = schema.addField("second", type=np.int64,
                              doc="ID for second source record in match.")
    keyD = schema.addField("distance", type=np.float64,
                           doc="Distance between matches sources.")
    result = BaseCatalog(schema)
    result.table.preallocate(len(matches))
    for match in matches:
        record = result.addNew()
        record.set(outKey1, match.first.getId())
        record.set(outKey2, match.second.getId())
        record.set(keyD, match.distance)
    return result


matchXy = deprecate_pybind11(
    matchXy,
    reason="Overloads that don't use `MatchControl` are deprecated. To be removed after 20.0.0.")
matchRaDec = deprecate_pybind11(
    matchRaDec,
    reason="Overloads that don't use `MatchControl` are deprecated. To be removed after 20.0.0.")
    def __reduce__(self):
        """Pickling"""
        return self.__class__, (self.getImageBBox(), self.getStatsImage())

    _getImageF = Background.getImageF

    def getImageF(self, *args, **kwargs):
        # This method called hundreds of times; warn only for invalid use
        if not args and not kwargs:
            warnings.warn(
                'Call to deprecated method getImageF(). (Zero-argument overload is deprecated; '
                'use one that takes an ``interpStyle`` instead. To be removed after 20.0.0.)',
                FutureWarning,
                stacklevel=2)
        return self._getImageF(*args, **kwargs)


BackgroundControl.getInterpStyle = deprecate_pybind11(
    BackgroundControl.getInterpStyle,
    reason=
    'Replaced by passing style to `Background.getImageF`. To be removed after 20.0.0.'
)
BackgroundControl.setInterpStyle = deprecate_pybind11(
    BackgroundControl.setInterpStyle,
    reason=
    'Replaced by passing style to `Background.getImageF`. To be removed after 20.0.0.'
)
BackgroundMI.getPixel = deprecate_pybind11(
    BackgroundMI.getPixel,
    reason='Use `getImageF` instead. To be removed after 20.0.0.')
Example #9
0
        return string.format(self.image.array, self.mask.array,
                             self.mask.getMaskPlaneDict(), self.variance.array,
                             self.getBBox())

    def __repr__(self):
        return "{}.{}=({})".format(self.__module__, self.__class__.__name__,
                                   str(self))

    readFitsWithOptions = classmethod(imageReadFitsWithOptions)

    writeFitsWithOptions = exposureWriteFitsWithOptions


MaskedImage.register(np.int32, MaskedImageI)
MaskedImage.register(np.float32, MaskedImageF)
MaskedImage.register(np.float64, MaskedImageD)
MaskedImage.register(np.uint16, MaskedImageU)
MaskedImage.register(np.uint64, MaskedImageL)
MaskedImage.alias("I", MaskedImageI)
MaskedImage.alias("F", MaskedImageF)
MaskedImage.alias("D", MaskedImageD)
MaskedImage.alias("U", MaskedImageU)
MaskedImage.alias("L", MaskedImageL)

for cls in set(MaskedImage.values()):
    supportSlicing(cls)
    disableImageArithmetic(cls)
    cls.__ilshift__ = deprecate_pybind11(
        cls.__ilshift__,
        reason="Use `assign` instead. To be removed after 20.0.0.")
Example #10
0
        children : iterable of `~lsst.afw.table.SourceRecord`
            Children sources.
        """
        if not self.isSorted(SourceTable.getParentKey()):
            raise AssertionError(
                "The table is not sorted by parent, so cannot getChildren")
        s = self.equal_range(parent, SourceTable.getParentKey())
        if args:
            return (self[s], ) + tuple(arg[s] for arg in args)
        else:
            return self[s]


SourceTable.getCentroidDefinition = deprecate_pybind11(
    SourceTable.getCentroidDefinition,
    reason=
    'Use `getSchema().getAliasMap().get("slot_Centroid")` instead. To be removed after 20.0.0.'
)
SourceTable.hasCentroidSlot = deprecate_pybind11(
    SourceTable.hasCentroidSlot,
    reason=
    'Use `getCentroidSlot().isValid()` instead. To be removed after 20.0.0.')
SourceTable.getCentroidKey = deprecate_pybind11(
    SourceTable.getCentroidKey,
    reason=
    'Use `getCentroidSlot().getMeasKey()` instead. To be removed after 20.0.0.'
)
SourceTable.getCentroidErrKey = deprecate_pybind11(
    SourceTable.getCentroidErrKey,
    reason=
    'Use `getCentroidSlot().getErrKey()` instead. To be removed after 20.0.0.')
Example #11
0
# (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.
#
from lsst.utils.deprecated import deprecate_pybind11
from lsst.utils import continueClass

from ._imageLib import ExposureInfo

__all__ = []  # import this module only for its side effects

ExposureInfo.getFilter = deprecate_pybind11(
    ExposureInfo.getFilter,
    reason="Replaced by getFilterLabel. Will be removed after v22.",
    version="v22.0")

ExposureInfo.setFilter = deprecate_pybind11(
    ExposureInfo.setFilter,
    reason="Replaced by setFilterLabel. Will be removed after v22.",
    version="v22.0")


@continueClass
class ExposureInfo:  # noqa: F811
    KEY_SUMMARY_STATS = 'SUMMARY_STATS'

    def getSummaryStats(self):
        """Get exposure summary statistics component.
Example #12
0
# (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 <https://www.gnu.org/licenses/>.

from lsst.utils.deprecated import deprecate_pybind11
from .kernel import Kernel

__all__ = []  # import this module only for its side effects

Kernel.getCtrX = deprecate_pybind11(
    Kernel.getCtrX, reason='Use `getCtr` instead. To be removed after 20.0.0.')
Kernel.getCtrY = deprecate_pybind11(
    Kernel.getCtrY, reason='Use `getCtr` instead. To be removed after 20.0.0.')
Kernel.setCtrX = deprecate_pybind11(
    Kernel.setCtrX, reason='Use `setCtr` instead. To be removed after 20.0.0.')
Kernel.setCtrY = deprecate_pybind11(
    Kernel.setCtrY, reason='Use `setCtr` instead. To be removed after 20.0.0.')
Example #13
0
# (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 <https://www.gnu.org/licenses/>.
"""This file only exists to deprecate the Filter and FilterProperty classes.
"""

from lsst.utils.deprecated import deprecate_pybind11
from ._imageLib import VisitInfo

__all__ = []

VisitInfo.getExposureId = deprecate_pybind11(
    VisitInfo.getExposureId,
    reason=
    "Replaced by VisitInfo.id for full focal plane identifiers and by ExposureInfo.id for "
    "detector-level identifiers. Will be removed after v25.",
    version="v24.0")