24from lsst.utils
import continueClass
26from ._geom
import SpherePoint, _toUnitX, _toUnitY, _toUnitZ
30 if a
is None and b
is not None:
32 if a
is not None and b
is None:
34 raise ValueError(message)
45 argList = [
"%r*degrees" % (pos.asDegrees(),)
for pos
in self]
46 return "SpherePoint(%s)" % (
", ".join(argList))
49 def toUnitXYZ(*, longitude=None, latitude=None, ra=None, dec=None, units):
50 """Compute the unit 3-vectors (as separate arrays) corresponding to
51 arrays of longitude and latitude.
55 longitude : `float`
or `numpy.ndarray`
56 Longitude coordinate of input points.
57 latitude : `float`
or `numpy.ndarray`
58 Latitude coordinate of input points.
59 ra : `float`
or `numpy.ndarray`
60 Synonym
for `longitude`.
61 dec : `float`
or `numpy.ndarray`
62 Synonym
for `latitude`.
64 Angle unit
for inputs.
68 x : `float`
or numpy.ndarray`
69 X coordinates of unit 3-vectors.
70 y : `float`
or numpy.ndarray`
71 Y coordinates of unit 3-vectors.
72 z : `float`
or numpy.ndarray`
73 Z coordinates of unit 3-vectors.
77 The returned Cartesian coordinate values are
not guaranteed to be
79 are nevertheless compatible
with the various vectorized `contains`
80 methods
in `sphgeom` because those apply that normalization
83 factor = (1.0*units).asRadians()
84 lon = factor*_pickExactlyOne(longitude, ra, "Exactly one of ra and longitude must be provided.")
85 lat = factor*
_pickExactlyOne(latitude, dec,
"Exactly one of dec and latitude must be provided.")
86 return _toUnitX(lon, lat), _toUnitY(lon, lat), _toUnitZ(lon, lat)
toUnitXYZ(*longitude=None, latitude=None, ra=None, dec=None, units)
_pickExactlyOne(a, b, message)