Skip to content

Commit

Permalink
Use SpherePoint instead of Coord or IcrsCoord
Browse files Browse the repository at this point in the history
  • Loading branch information
r-owen authored and laurenam committed May 11, 2018
1 parent d1896a6 commit 233ef51
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
7 changes: 2 additions & 5 deletions python/lsst/pipe/analysis/coaddAnalysis.py
Expand Up @@ -34,7 +34,6 @@
from .plotUtils import (CosmosLabeller, StarGalaxyLabeller, OverlapsStarGalaxyLabeller,
MatchesStarGalaxyLabeller)

import lsst.afw.coord as afwCoord
import lsst.afw.geom as afwGeom
import lsst.afw.image as afwImage
import lsst.afw.table as afwTable
Expand Down Expand Up @@ -967,10 +966,8 @@ def plotCosmos(self, catalog, filenamer, cosmos, dataId):

def matchCatalog(self, catalog, filterName, astrometryConfig):
refObjLoader = LoadAstrometryNetObjectsTask(self.config.refObjLoaderConfig)
average = sum((afwGeom.Extent3D(src.getCoord().getVector()) for src in catalog),
afwGeom.Extent3D(0, 0, 0))/len(catalog)
center = afwCoord.IcrsCoord(afwGeom.Point3D(average))
radius = max(center.angularSeparation(src.getCoord()) for src in catalog)
center = afwGeom.averageSpherePoint([src.getCoord() for src in catalog])
radius = max(center.separation(src.getCoord()) for src in catalog)
filterName = afwImage.Filter(afwImage.Filter(filterName).getId()).getName() # Get primary name
refs = refObjLoader.loadSkyCircle(center, radius, filterName).refCat
matches = afwTable.matchRaDec(refs, catalog, self.config.matchRadius*afwGeom.arcseconds)
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/pipe/analysis/plotUtils.py
Expand Up @@ -360,7 +360,7 @@ def bboxToRaDec(bbox, wcs):
corners = []
for corner in bbox.getCorners():
p = afwGeom.Point2D(corner.getX(), corner.getY())
coord = wcs.pixelToSky(p).toIcrs()
coord = wcs.pixelToSky(p)
corners.append([coord.getRa().asDegrees(), coord.getDec().asDegrees()])
ra, dec = zip(*corners)
return ra, dec
Expand Down
4 changes: 2 additions & 2 deletions python/lsst/pipe/analysis/utils.py
Expand Up @@ -611,8 +611,8 @@ def addFpPoint(det, catalog, prefix=""):
row.assign(source, mapper)
try:
center = afwGeom.Point2D(source[xCentroidKey], source[yCentroidKey])
posInPix = det.makeCameraPoint(center, cameraGeom.PIXELS)
fpPoint = det.transform(posInPix, cameraGeom.FOCAL_PLANE).getPoint()
pixelsToFocalPlane = det.getTransform(cameraGeom.PIXELS, cameraGeom.FOCAL_PLANE)
fpPoint = pixelsToFocalPlane.applyForward(center)
except Exception:
fpPoint = afwGeom.Point2D(np.nan, np.nan)
row.set(fpFlag, True)
Expand Down

0 comments on commit 233ef51

Please sign in to comment.