Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-11162: Replace all use of Coord and subclasses with SpherePoint #12

Merged
merged 2 commits into from
Mar 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.cache
.sconsign.dblite
config.log
.sconf_temp
config.log

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to change where config.log appears in the file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer having the .scons* files together

*.o
*.os
*.so
Expand All @@ -9,6 +10,7 @@ config.log
*_wrap.cc
*Lib.py
doc/html
doc/xml
doc/*.tag
doc/*.inc
doc/doxygen.conf
Expand Down
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a lovely example of how SpherePoint makes our lives better! 💯

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