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 committed Mar 20, 2018
1 parent 1bdbead commit 4768d6a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion python/lsst/ap/association/assoc_db_sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def load(self, expMd):
"""
ctr_coord = expMd.wcs.pixelToSky(expMd.bbox.getCenter())
max_radius = max(
ctr_coord.angularSeparation(expMd.wcs.pixelToSky(pp))
ctr_coord.separation(expMd.wcs.pixelToSky(pp))
for pp in expMd.bbox.getCorners())

indexer_indices, on_boundry = self.indexer.get_pixel_ids(
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ap/association/dia_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def coord(self):
Return
------
A lsst.afw.coord._coord.IcrsCoord
A lsst.afw.geom.SpherePoint
"""
return self._dia_object_record.getCoord()

Expand Down
6 changes: 2 additions & 4 deletions tests/test_association_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import tempfile
import unittest

from lsst.afw.coord import Coord
import lsst.afw.geom as afwGeom
import lsst.afw.image as afwImage
import lsst.afw.table as afwTable
Expand Down Expand Up @@ -106,10 +105,9 @@ def create_test_dia_sources(n_sources=5,
for src_idx in range(n_sources):
src = sources.addNew()
src['id'] = src_idx + start_id
coord = Coord(source_locs_deg[src_idx][0] * afwGeom.degrees,
source_locs_deg[src_idx][1] * afwGeom.degrees)
coord = afwGeom.SpherePoint(source_locs_deg[src_idx][0], source_locs_deg[src_idx][1], afwGeom.degrees)
if scatter_arcsec > 0.0:
coord.offset(
coord = coord.offset(
np.random.rand() * 360 * afwGeom.degrees,
np.random.rand() * scatter_arcsec * afwGeom.arcseconds)
src.setCoord(coord)
Expand Down
11 changes: 4 additions & 7 deletions tests/test_dia_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import unittest

from lsst.ap.association import DIAObject, DIAObjectCollection
from lsst.afw.coord import Coord
import lsst.afw.geom as afwGeom
import lsst.utils.tests
from test_dia_object import create_test_dia_sources
Expand Down Expand Up @@ -90,13 +89,11 @@ def edit_and_offset_source_record(src, src_id, ra_degrees, dec_degrees,
scatter_arcsec : float
Arcsecond scatter to add to the position of the source record coord.
"""
coord = Coord(afwGeom.Angle(ra_degrees, units=afwGeom.degrees),
afwGeom.Angle(dec_degrees, units=afwGeom.degrees))
coord = lsst.afw.geom.SpherePoint(ra_degrees, dec_degrees, afwGeom.degrees)
if scatter_arcsec > 0.0:
coord.offset(
afwGeom.Angle(np.random.rand() * 360, units=afwGeom.degrees),
afwGeom.Angle(np.random.rand() * scatter_arcsec,
units=afwGeom.arcseconds))
coord = coord.offset(
np.random.rand() * 360 * afwGeom.degrees,
np.random.rand() * scatter_arcsec * afwGeom.arcseconds)
src.setCoord(coord)
src['id'] = src_id

Expand Down

0 comments on commit 4768d6a

Please sign in to comment.