Skip to content

Commit

Permalink
Merge pull request #478 from lsst/tickets/DM-20546
Browse files Browse the repository at this point in the history
DM-20546: Add some formal deprecations
  • Loading branch information
timj committed Jul 24, 2019
2 parents 01e196b + 2db57e3 commit a83fda3
Show file tree
Hide file tree
Showing 14 changed files with 170 additions and 129 deletions.
21 changes: 4 additions & 17 deletions python/lsst/afw/cameraGeom/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

import math
import numpy
import warnings

import lsst.geom
from lsst.afw.fits import FitsError
Expand Down Expand Up @@ -736,7 +735,7 @@ def showAmp(amp, imageSource=FakeImageDataSource(isTrimmed=False), display=None,
bbox, borderWidth=borderWidth, ctype=ctype, display=display)


def showCcd(ccd, imageSource=FakeImageDataSource(), display=None, frame=None, overlay=True,
def showCcd(ccd, imageSource=FakeImageDataSource(), display=None, overlay=True,
imageFactory=afwImage.ImageF, binSize=1, inCameraCoords=False):
"""Show a CCD on display.
Expand All @@ -748,8 +747,6 @@ def showCcd(ccd, imageSource=FakeImageDataSource(), display=None, frame=None, ov
Source to get ccd images. Must have a ``getCcdImage()`` method.
display : `lsst.afw.display.Display`
image display to use.
frame : `None`
frame ID on which to display. **Deprecated** in v12.
overlay : `bool`
Show amp bounding boxes on the displayed image?
imageFactory : callable like `lsst.afw.image.Image`
Expand All @@ -759,11 +756,7 @@ def showCcd(ccd, imageSource=FakeImageDataSource(), display=None, frame=None, ov
inCameraCoords : `bool`
Show the Detector in camera coordinates?
"""
if frame is not None:
warnings.warn("The frame kwarg is deprecated; use the `lsst.afw.display` system instead.",
DeprecationWarning)

display = _getDisplayFromDisplayOrFrame(display, frame)
display = _getDisplayFromDisplayOrFrame(display)

ccdOrigin = lsst.geom.Point2I(0, 0)
nQuarter = 0
Expand Down Expand Up @@ -935,7 +928,7 @@ def makeImageFromCamera(camera, detectorNameList=None, background=numpy.nan, buf


def showCamera(camera, imageSource=FakeImageDataSource(), imageFactory=afwImage.ImageF,
detectorNameList=None, binSize=10, bufferSize=10, frame=None, overlay=True, title="",
detectorNameList=None, binSize=10, bufferSize=10, overlay=True, title="",
showWcs=None, ctype=afwDisplay.GREEN, textSize=1.25, originAtCenter=True, display=None,
**kwargs):
"""Show a Camera on display, with the specified display.
Expand All @@ -960,8 +953,6 @@ def showCamera(camera, imageSource=FakeImageDataSource(), imageFactory=afwImage.
Bin the image by this factor in both dimensions.
bufferSize : `int`
Size of border in binned pixels to make around the camera image.
frame : `None`
specify image display. **Deprecated** in v12.
overlay : `bool`
Overlay Detector IDs and boundaries?
title : `str`
Expand All @@ -985,11 +976,7 @@ def showCamera(camera, imageSource=FakeImageDataSource(), imageFactory=afwImage.
image : `lsst.afw.image.Image`
The mosaic image.
"""
if frame is not None:
warnings.warn("The frame kwarg is deprecated; use the `lsst.afw.display` system instead.",
DeprecationWarning)

display = _getDisplayFromDisplayOrFrame(display, frame)
display = _getDisplayFromDisplayOrFrame(display)

if binSize < 1:
binSize = 1
Expand Down
6 changes: 3 additions & 3 deletions python/lsst/afw/display/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,12 @@ def append(self, image, label=None, ctype=None):
return len(self.images)

def makeMosaic(self, images=None, display="deferToFrame", mode=None,
background=None, title="", frame=None):
background=None, title=""):
"""Return a mosaic of all the images provided.
If none are specified, use the list accumulated with `Mosaic.append()`.
If display or frame (deprecated) is specified, display the mosaic
If display is specified, display the mosaic
"""

if images:
Expand Down Expand Up @@ -244,7 +244,7 @@ def makeMosaic(self, images=None, display="deferToFrame", mode=None,

smosaic[:] = im

display = _getDisplayFromDisplayOrFrame(display, frame)
display = _getDisplayFromDisplayOrFrame(display)
if display:
display.mtv(mosaic, title=title)

Expand Down
93 changes: 93 additions & 0 deletions python/lsst/afw/geom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,102 @@
"""Application Framework geometry code including Point, Extent, and ellipses
"""

from lsst.utils import deprecate_pybind11

# for backwards compatibility make lsst.geom public symbols available in lsst.afw.geom
from lsst.geom import *

# But we deprecate the usages of these aliases
# Constants (like geom.PI) and units (geom.arcseconds) can not be wrapped
# by deprecate_pybind11.
AffineTransform = deprecate_pybind11(AffineTransform,
reason="Replaced by lsst.geom.AffineTransform (will be removed before the release of v20.0)")
Angle = deprecate_pybind11(Angle,
reason="Replaced by lsst.geom.Angle (will be removed before the release of v20.0)")
AngleUnit = deprecate_pybind11(AngleUnit,
reason="Replaced by lsst.geom.AngleUnit (will be removed before the release of v20.0)")
Box2D = deprecate_pybind11(Box2D,
reason="Replaced by lsst.geom.Box2D (will be removed before the release of v20.0)")
Box2I = deprecate_pybind11(Box2I,
reason="Replaced by lsst.geom.Box2I (will be removed before the release of v20.0)")
BoxD = deprecate_pybind11(BoxD,
reason="Replaced by lsst.geom.BoxD (will be removed before the release of v20.0)")
BoxI = deprecate_pybind11(BoxI,
reason="Replaced by lsst.geom.BoxI (will be removed before the release of v20.0)")

CoordinateExpr = deprecate_pybind11(CoordinateExpr,
reason="Replaced by lsst.geom.CoordinateExpr (will be removed before the release of v20.0)")
CoordinateExpr2 = deprecate_pybind11(CoordinateExpr2,
reason="Replaced by lsst.geom.CoordinateExpr2 (will be removed before the release of v20.0)")
CoordinateExpr3 = deprecate_pybind11(CoordinateExpr3,
reason="Replaced by lsst.geom.CoordinateExpr3 (will be removed before the release of v20.0)")
Extent = deprecate_pybind11(Extent,
reason="Replaced by lsst.geom.Extent (will be removed before the release of v20.0)")
Extent2D = deprecate_pybind11(Extent2D,
reason="Replaced by lsst.geom.Extent2D (will be removed before the release of v20.0)")
Extent2I = deprecate_pybind11(Extent2I,
reason="Replaced by lsst.geom.Extent2I (will be removed before the release of v20.0)")
Extent3D = deprecate_pybind11(Extent3D,
reason="Replaced by lsst.geom.Extent3D (will be removed before the release of v20.0)")
Extent3I = deprecate_pybind11(Extent3I,
reason="Replaced by lsst.geom.Extent3I (will be removed before the release of v20.0)")
ExtentBase2D = deprecate_pybind11(ExtentBase2D,
reason="Replaced by lsst.geom.ExtentBase2D (will be removed before the release of v20.0)")
ExtentBase2I = deprecate_pybind11(ExtentBase2I,
reason="Replaced by lsst.geom.ExtentBase2I (will be removed before the release of v20.0)")
ExtentBase3D = deprecate_pybind11(ExtentBase3D,
reason="Replaced by lsst.geom.ExtentBase3D (will be removed before the release of v20.0)")
ExtentBase3I = deprecate_pybind11(ExtentBase3I, reason="Replaced by lsst.geom.ExtentBase3I (will be removed before the release of v20.0)")
ExtentD = deprecate_pybind11(ExtentD,
reason="Replaced by lsst.geom.ExtentD (will be removed before the release of v20.0)")
ExtentI = deprecate_pybind11(ExtentI,
reason="Replaced by lsst.geom.ExtentI (will be removed before the release of v20.0)")
LinearTransform = deprecate_pybind11(LinearTransform,
reason="Replaced by lsst.geom.LinearTransform (will be removed before the release of v20.0)")
Point = deprecate_pybind11(Point,
reason="Replaced by lsst.geom.Point (will be removed before the release of v20.0)")
Point2D = deprecate_pybind11(Point2D,
reason="Replaced by lsst.geom.Point2D (will be removed before the release of v20.0)")
Point2I = deprecate_pybind11(Point2I,
reason="Replaced by lsst.geom.Point2I (will be removed before the release of v20.0)")
Point3D = deprecate_pybind11(Point3D,
reason="Replaced by lsst.geom.Point3D (will be removed before the release of v20.0)")
Point3I = deprecate_pybind11(Point3I,
reason="Replaced by lsst.geom.Point3I (will be removed before the release of v20.0)")
PointBase2D = deprecate_pybind11(PointBase2D,
reason="Replaced by lsst.geom.PointBase2D (will be removed before the release of v20.0)")
PointBase2I = deprecate_pybind11(PointBase2I,
reason="Replaced by lsst.geom.PointBase2I (will be removed before the release of v20.0)")
PointBase3D = deprecate_pybind11(PointBase3D, reason="Replaced by lsst.geom.PointBase3D (will be removed before the release of v20.0)")
PointBase3I = deprecate_pybind11(PointBase3I,
reason="Replaced by lsst.geom.PointBase3I (will be removed before the release of v20.0)")
PointD = deprecate_pybind11(PointD,
reason="Replaced by lsst.geom.PointD (will be removed before the release of v20.0)")
PointI = deprecate_pybind11(PointI,
reason="Replaced by lsst.geom.PointI (will be removed before the release of v20.0)")
SpherePoint = deprecate_pybind11(SpherePoint,
reason="Replaced by lsst.geom.SpherePoint (will be removed before the release of v20.0)")
arcsecToRad = deprecate_pybind11(arcsecToRad,
reason="Replaced by lsst.geom.arcsecToRad (will be removed before the release of v20.0)")
averageSpherePoint = deprecate_pybind11(averageSpherePoint,
reason="Replaced by lsst.geom.averageSpherePoint (will be removed before the release of v20.0)")
degToRad = deprecate_pybind11(degToRad,
reason="Replaced by lsst.geom.degToRad (will be removed before the release of v20.0)")
isAngle = deprecate_pybind11(isAngle,
reason="Replaced by lsst.geom.isAngle (will be removed before the release of v20.0)")
makeAffineTransformFromTriple = deprecate_pybind11(makeAffineTransformFromTriple,
reason="Replaced by lsst.geom.makeAffineTransformFromTriple (will be removed before the release of v20.0)")
masToRad = deprecate_pybind11(masToRad,
reason="Replaced by lsst.geom.masToRad (will be removed before the release of v20.0)")
radToArcsec = deprecate_pybind11(radToArcsec,
reason="Replaced by lsst.geom.radToArcsec (will be removed before the release of v20.0)")
radToDeg = deprecate_pybind11(radToDeg,
reason="Replaced by lsst.geom.radToDeg (will be removed before the release of v20.0)")
radToMas = deprecate_pybind11(radToMas,
reason="Replaced by lsst.geom.radToMas (will be removed before the release of v20.0)")

del deprecate_pybind11

from .ellipses import Ellipse, Quadrupole
from .polygon import *
from .span import *
Expand Down
1 change: 0 additions & 1 deletion python/lsst/afw/image/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,5 @@

from .basicUtils import *
from .testUtils import *
from .makeVisitInfo import makeVisitInfo

from .readers import *
63 changes: 0 additions & 63 deletions python/lsst/afw/image/makeVisitInfo.py

This file was deleted.

4 changes: 2 additions & 2 deletions tests/test_exposureTable.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
import lsst.geom
import lsst.afw.table
from lsst.afw.coord import Observatory, Weather
from lsst.afw.geom import arcseconds, degrees, radians, Point2D, Extent2D, Box2D, \
makeSkyWcs, Polygon, SpherePoint
from lsst.geom import arcseconds, degrees, radians, Point2D, Extent2D, Box2D, SpherePoint
from lsst.afw.geom import Polygon, makeSkyWcs
import lsst.afw.image
import lsst.afw.detection
from lsst.afw.cameraGeom.testUtils import DetectorWrapper
Expand Down
6 changes: 3 additions & 3 deletions tests/test_fitsCompression.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ def setUp(self):
self.highValue = 789 # Value for high pixel
self.lowValue = 123 # Value for low pixel
self.maskedValue = 12345 # Value for masked pixel (to throw off statistics)
self.highPixel = lsst.afw.geom.Point2I(1, 1) # Location of high pixel
self.lowPixel = lsst.afw.geom.Point2I(2, 2) # Location of low pixel
self.maskedPixel = lsst.afw.geom.Point2I(3, 3) # Location of masked pixel
self.highPixel = lsst.geom.Point2I(1, 1) # Location of high pixel
self.lowPixel = lsst.geom.Point2I(2, 2) # Location of low pixel
self.maskedPixel = lsst.geom.Point2I(3, 3) # Location of masked pixel
self.badMask = "BAD" # Mask plane to set for masked pixel
self.stdev = 5.0 # Noise stdev to add to image

Expand Down
3 changes: 2 additions & 1 deletion tests/test_frameSetUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
from astropy.coordinates import SkyCoord

import astshim as ast
from lsst.afw.geom import arcseconds, degrees, radians, Point2D, SpherePoint, makeCdMatrix
from lsst.geom import arcseconds, degrees, radians, Point2D, SpherePoint
from lsst.afw.geom import makeCdMatrix
from lsst.afw.geom.detail import readFitsWcs, readLsstSkyWcs, getPropertyListFromFitsChan
from lsst.afw.geom.wcsUtils import makeSimpleWcsMetadata
import lsst.utils.tests
Expand Down

0 comments on commit a83fda3

Please sign in to comment.