Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

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 

22import warnings 

23 

24from lsst.utils import continueClass 

25from lsst.utils.deprecated import deprecate_pybind11 

26from .background import Background, BackgroundControl, BackgroundMI 

27from ..interpolate import Interpolate 

28 

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

30 

31 

32@continueClass # noqa: F811 

33class BackgroundControl: 

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 

48class 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 

64BackgroundControl.getInterpStyle = deprecate_pybind11( 

65 BackgroundControl.getInterpStyle, 

66 reason='Replaced by passing style to `Background.getImageF`. To be removed after 20.0.0.') 

67BackgroundControl.setInterpStyle = deprecate_pybind11( 

68 BackgroundControl.setInterpStyle, 

69 reason='Replaced by passing style to `Background.getImageF`. To be removed after 20.0.0.') 

70BackgroundMI.getPixel = deprecate_pybind11( 

71 BackgroundMI.getPixel, 

72 reason='Use `getImageF` instead. To be removed after 20.0.0.')