Skip to content

Commit

Permalink
avoid dependency on lsst.geom
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-slac committed Mar 26, 2024
1 parent 19d76a6 commit 8f2c9ce
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
3 changes: 0 additions & 3 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ ignore_missing_imports = True
[mypy-lsst.sphgeom]
ignore_missing_imports = True

[mypy-lsst.geom]
ignore_missing_imports = True

[mypy-testing.*]
ignore_missing_imports = True

Expand Down
9 changes: 4 additions & 5 deletions python/lsst/dax/apdb/tests/data_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@
import astropy.time
import numpy
import pandas
from lsst.geom import SpherePoint
from lsst.sphgeom import LonLat, Region, UnitVector3d


def _genPointsInRegion(region: Region, count: int) -> Iterator[SpherePoint]:
def _genPointsInRegion(region: Region, count: int) -> Iterator[LonLat]:
"""Generate bunch of SpherePoints inside given region.
Parameters
Expand All @@ -58,7 +57,7 @@ def _genPointsInRegion(region: Region, count: int) -> Iterator[SpherePoint]:
lonlat = LonLat.fromRadians(lon, lat)
uv3d = UnitVector3d(lonlat)
if region.contains(uv3d):
yield SpherePoint(lonlat)
yield lonlat
count -= 1


Expand Down Expand Up @@ -94,8 +93,8 @@ def makeObjectCatalog(
# diaObjectId=0 may be used in some code for DiaSource foreign key to mean
# the same as ``None``.
ids = numpy.arange(start_id, len(points) + start_id, dtype=numpy.int64)
ras = numpy.array([sp.getRa().asDegrees() for sp in points], dtype=numpy.float64)
decs = numpy.array([sp.getDec().asDegrees() for sp in points], dtype=numpy.float64)
ras = numpy.array([lonlat.getLon().asDegrees() for lonlat in points], dtype=numpy.float64)
decs = numpy.array([lonlat.getLat().asDegrees() for lonlat in points], dtype=numpy.float64)
nDiaSources = numpy.ones(len(points), dtype=numpy.int32)
dt = visit_time.datetime
data = dict(
Expand Down
6 changes: 3 additions & 3 deletions tests/test_ap_verify_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from typing import Any

import astropy.time
import lsst.geom as geom
import lsst.utils.tests
import numpy
import pandas
Expand Down Expand Up @@ -53,10 +52,11 @@ def createTestObjects(
sources : `pandas.DataFrame`
Tests sources with filled values.
"""
one_degree = numpy.pi / 180
data = {
id_column_name: numpy.arange(n_objects, dtype=numpy.int64),
"ra": numpy.full(n_objects, 1 * geom.degrees, dtype=numpy.float64),
"dec": numpy.full(n_objects, 1 * geom.degrees, dtype=numpy.float64),
"ra": numpy.full(n_objects, one_degree, dtype=numpy.float64),
"dec": numpy.full(n_objects, one_degree, dtype=numpy.float64),
}
for field, type in extra_fields.items():
data[field] = numpy.ones(n_objects, dtype=type)
Expand Down

0 comments on commit 8f2c9ce

Please sign in to comment.