Skip to content

Commit

Permalink
Merge pull request #89 from lsst/u/jchiang/silence_afw.geom_deprecati…
Browse files Browse the repository at this point in the history
…on_warnings

silence afw.geom deprecation warnings
  • Loading branch information
danielsf authored Sep 17, 2019
2 parents ebdc50b + 0eed2e8 commit 4a3cf5e
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 19 deletions.
6 changes: 3 additions & 3 deletions python/lsst/sims/GalSimInterface/galSimCameraWrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class that inherits from GalSimCameraWrapper. This class will
import numpy as np
from lsst.afw.cameraGeom import FOCAL_PLANE, PIXELS, TAN_PIXELS
from lsst.afw.cameraGeom import FIELD_ANGLE
import lsst.afw.geom as afwGeom
import lsst.geom as LsstGeom
import lsst.sims.coordUtils as coordUtils
import lsst.sims.utils as simsUtils

Expand Down Expand Up @@ -113,7 +113,7 @@ def getCenterPixel(self, detector_name):
def getCenterPupil(self, detector_name):
"""
Return the pupil coordinates of the center of the named detector
as an afwGeom.Point2D
as an LsstGeom.Point2D
"""
if not hasattr(self, '_center_pupil_cache'):
self._center_pupil_cache = {}
Expand All @@ -129,7 +129,7 @@ def getCenterPupil(self, detector_name):
def getCornerPupilList(self, detector_name):
"""
Return a list of the pupil coordinates of the corners of the named
detector as a list of afwGeom.Point2D objects
detector as a list of LsstGeom.Point2D objects
"""
if not hasattr(self, '_corner_pupil_cache'):
self._corner_pupil_cache = {}
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/sims/GalSimInterface/galSimCatalogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from lsst.sims.photUtils import (Sed, Bandpass, BandpassDict,
PhotometricParameters)
import lsst.afw.cameraGeom.testUtils as camTestUtils
import lsst.afw.geom as afwGeom
import lsst.geom as LsstGeom
from lsst.afw.cameraGeom import FIELD_ANGLE, PIXELS, FOCAL_PLANE
from lsst.afw.cameraGeom import WAVEFRONT, GUIDER

Expand Down
10 changes: 5 additions & 5 deletions python/lsst/sims/GalSimInterface/galSimDetector.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from astropy._erfa import ErfaWarning
import galsim
import numpy as np
import lsst.afw.geom as afwGeom
import lsst.geom as LsstGeom
from lsst.afw.cameraGeom import FIELD_ANGLE, PIXELS, FOCAL_PLANE
from lsst.afw.cameraGeom import WAVEFRONT, GUIDER
from lsst.obs.lsstSim import LsstSimMapper
Expand All @@ -23,7 +23,7 @@

class GalSim_afw_TanSipWCS(galsim.wcs.CelestialWCS):
"""
This class uses methods from afw.geom and meas_astrom to
This class uses methods from lsst.geom and meas_astrom to
fit a TAN-SIP WCS to an afw.cameraGeom.Detector and then wrap
that WCS into something that GalSim can parse.
Expand Down Expand Up @@ -264,7 +264,7 @@ def __init__(self, detectorName, cameraWrapper, obs_metadata, epoch, photParams=
self._yMinPix = bbox.getMinY()
self._yMaxPix = bbox.getMaxY()

self._bbox = afwGeom.Box2D(bbox)
self._bbox = LsstGeom.Box2D(bbox)

centerPupil = self._cameraWrapper.getCenterPupil(self._name)
self._xCenterArcsec = arcsecFromRadians(centerPupil.getX())
Expand Down Expand Up @@ -374,7 +374,7 @@ def containsRaDec(self, ra, dec):
"""

xPix, yPix = self.pixelCoordinatesFromRaDec(ra, dec)
points = [afwGeom.Point2D(xx, yy) for xx, yy in zip(xPix, yPix)]
points = [LsstGeom.Point2D(xx, yy) for xx, yy in zip(xPix, yPix)]
answer = [self._bbox.contains(pp) for pp in points]
return answer

Expand All @@ -392,7 +392,7 @@ def containsPupilCoordinates(self, xPupil, yPupil):
the corresponding RA, Dec pair falls on this detector
"""
xPix, yPix = self.pixelCoordinatesFromPupilCoordinates(xPupil, yPupil)
points = [afwGeom.Point2D(xx, yy) for xx, yy in zip(xPix, yPix)]
points = [LsstGeom.Point2D(xx, yy) for xx, yy in zip(xPix, yPix)]
answer = [self._bbox.contains(pp) for pp in points]
return answer

Expand Down
9 changes: 4 additions & 5 deletions python/lsst/sims/GalSimInterface/wcsUtils/ApproximateWCS.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import numpy as np
import lsst.afw.image as afwImage
import lsst.afw.table as afwTable
import lsst.afw.geom as afwGeom
import lsst.geom as LsstGeom
from lsst.meas.base import SingleFrameMeasurementTask
from lsst.meas.astrom.sip import makeCreateWcsWithSip
Expand All @@ -40,7 +39,7 @@

def approximateWcs(wcs, camera_wrapper=None, detector_name=None, obs_metadata=None,
order=3, nx=20, ny=20, iterations=3,
skyTolerance=0.001*afwGeom.arcseconds, pixelTolerance=0.02):
skyTolerance=0.001*LsstGeom.arcseconds, pixelTolerance=0.02):
"""Approximate an existing WCS as a TAN-SIP WCS
The fit is performed by evaluating the WCS at a uniform grid of points within a bounding box.
Expand Down Expand Up @@ -81,19 +80,19 @@ def approximateWcs(wcs, camera_wrapper=None, detector_name=None, obs_metadata=No
matchList = []

bbox = camera_wrapper.getBBox(detector_name)
bboxd = afwGeom.Box2D(bbox)
bboxd = LsstGeom.Box2D(bbox)

for x in np.linspace(bboxd.getMinX(), bboxd.getMaxX(), nx):
for y in np.linspace(bboxd.getMinY(), bboxd.getMaxY(), ny):
pixelPos = afwGeom.Point2D(x, y)
pixelPos = LsstGeom.Point2D(x, y)

ra, dec = camera_wrapper.raDecFromPixelCoords(np.array([x]), np.array([y]),
detector_name,
obs_metadata=obs_metadata,
epoch=2000.0,
includeDistortion=True)

skyCoord = afwGeom.SpherePoint(ra[0], dec[0], LsstGeom.degrees)
skyCoord = LsstGeom.SpherePoint(ra[0], dec[0], LsstGeom.degrees)

refObj = refCat.addNew()
refObj.set(refCoordKey, skyCoord)
Expand Down
3 changes: 2 additions & 1 deletion python/lsst/sims/GalSimInterface/wcsUtils/WcsUtils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import numpy as np
from lsst.afw.cameraGeom import TAN_PIXELS, FOCAL_PLANE
import lsst.afw.geom as afwGeom
import lsst.geom as LsstGeom
import lsst.afw.image as afwImage
import lsst.afw.image.utils as afwImageUtils
import lsst.daf.base as dafBase
Expand Down Expand Up @@ -169,7 +170,7 @@ def tanSipWcsFromDetector(detector_name, camera_wrapper, obs_metadata, epoch,

tanSipWcs = approximateWcs(tanWcs,
order=order,
skyTolerance=skyToleranceArcSec*afwGeom.arcseconds,
skyTolerance=skyToleranceArcSec*LsstGeom.arcseconds,
pixelTolerance=pixelTolerance,
detector_name=detector_name,
camera_wrapper=camera_wrapper,
Expand Down
3 changes: 1 addition & 2 deletions tests/testOutputWcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import lsst.utils.tests
from lsst.utils import getPackageDir
import lsst.afw.image as afwImage
import lsst.afw.geom as afwGeom
import lsst.geom as LsstGeom
from lsst.sims.utils.CodeUtilities import sims_clean_up
from lsst.sims.utils import ObservationMetaData, arcsecFromRadians
Expand Down Expand Up @@ -132,7 +131,7 @@ def testOutputWcsOfImage(self):
xxTestList.append(xx)
yyTestList.append(yy)

pt = afwGeom.Point2D(xx, yy)
pt = LsstGeom.Point2D(xx, yy)
skyPt = wcs.pixelToSky(pt).getPosition(LsstGeom.degrees)
raImage.append(skyPt.getX())
decImage.append(skyPt.getY())
Expand Down
3 changes: 1 addition & 2 deletions tests/testWcsUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import os
import numpy as np
import lsst.utils.tests
import lsst.afw.geom as afwGeom
import lsst.geom as LsstGeom
from lsst.utils import getPackageDir
from lsst.sims.utils.CodeUtilities import sims_clean_up
Expand Down Expand Up @@ -76,7 +75,7 @@ def testTanSipWcs(self):
xPixList.append(xx)
yPixList.append(yy)

pt = afwGeom.Point2D(xx, yy)
pt = LsstGeom.Point2D(xx, yy)
skyPt = tanWcs.pixelToSky(pt).getPosition(LsstGeom.degrees)
tanWcsRa.append(skyPt.getX())
tanWcsDec.append(skyPt.getY())
Expand Down

0 comments on commit 4a3cf5e

Please sign in to comment.