lsst.afw  tickets.DM-23835-g31c64b24f1
backgroundContinued.py
Go to the documentation of this file.
1 # This file is part of afw.
2 #
3 # Developed for the LSST Data Management System.
4 # This product includes software developed by the LSST Project
5 # (https://www.lsst.org).
6 # See the COPYRIGHT file at the top-level directory of this distribution
7 # for details of code ownership.
8 #
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <https://www.gnu.org/licenses/>.
21 
22 import warnings
23 
24 from lsst.utils import continueClass
25 from lsst.utils.deprecated import deprecate_pybind11
26 from .background import Background, BackgroundControl, BackgroundMI
27 from ..interpolate import Interpolate
28 
29 __all__ = [] # import this module only for its side effects
30 
31 
32 @continueClass # noqa: F811
34  _init = BackgroundControl.__init__
35 
36  def __init__(self, *args, **kwargs):
37  # This constructor called dozens of times; warn only for invalid use
38  if (args and (isinstance(args[0], str) or isinstance(args[0], Interpolate.Style))) \
39  or "style" in kwargs:
40  warnings.warn('Call to deprecated method __init__. (Overloads that take a ``style`` parameter '
41  'are deprecated; the style must be passed to `Background.getImageF` instead. '
42  'To be removed after 20.0.0.)',
43  FutureWarning, stacklevel=2)
44  self._init(*args, **kwargs)
45 
46 
47 @continueClass # noqa: F811
48 class Background:
49  def __reduce__(self):
50  """Pickling"""
51  return self.__class__, (self.getImageBBox(), self.getStatsImage())
52 
53  _getImageF = Background.getImageF
54 
55  def getImageF(self, *args, **kwargs):
56  # This method called hundreds of times; warn only for invalid use
57  if not args and not kwargs:
58  warnings.warn('Call to deprecated method getImageF(). (Zero-argument overload is deprecated; '
59  'use one that takes an ``interpStyle`` instead. To be removed after 20.0.0.)',
60  FutureWarning, stacklevel=2)
61  return self._getImageF(*args, **kwargs)
62 
63 
64 BackgroundControl.getInterpStyle = deprecate_pybind11(
65  BackgroundControl.getInterpStyle,
66  reason='Replaced by passing style to `Background.getImageF`. To be removed after 20.0.0.')
67 BackgroundControl.setInterpStyle = deprecate_pybind11(
68  BackgroundControl.setInterpStyle,
69  reason='Replaced by passing style to `Background.getImageF`. To be removed after 20.0.0.')
70 BackgroundMI.getPixel = deprecate_pybind11(
71  BackgroundMI.getPixel,
72  reason='Use `getImageF` instead. To be removed after 20.0.0.')
lsst::afw::math.background.backgroundContinued.BackgroundControl
Definition: backgroundContinued.py:33
lsst::afw::math.background.backgroundContinued.Background.__reduce__
def __reduce__(self)
Definition: backgroundContinued.py:49
lsst::afw::math.background.backgroundContinued.BackgroundControl.__init__
def __init__(self, *args, **kwargs)
Definition: backgroundContinued.py:36
lsst::afw::math.background.backgroundContinued.Background
Definition: backgroundContinued.py:48
lsst::afw::math.background.backgroundContinued.Background._getImageF
_getImageF
Definition: backgroundContinued.py:53
lsst::afw::math.background.backgroundContinued.Background.getImageF
def getImageF(self, *args, **kwargs)
Definition: backgroundContinued.py:55
lsst::afw::math.background.backgroundContinued.BackgroundControl._init
_init
Definition: backgroundContinued.py:34
lsst::utils::deprecated
lsst::utils