24 import lsst.afw.coord
as afwCoord
25 import lsst.afw.geom
as afwGeom
27 __all__ = [
"coordFromVec"]
29 _TinyFloat = numpy.finfo(float).tiny
33 """Convert an ICRS cartesian vector to an ICRS Coord 35 @param[in] vec: an ICRS catesian vector as a sequence of three floats 36 @param[in] defRA: the RA to use if the vector is too near a pole (an afwGeom Angle); 37 ignored if not near a pole 39 @throw RuntimeError if vec too near a pole and defRA is None 41 if abs(vec[0]) < _TinyFloat
and abs(vec[1]) < _TinyFloat:
43 raise RuntimeError(
"At pole and defRA==None")
48 return afwCoord.makeCoord(afwCoord.ICRS, defRA, afwGeom.Angle(dec, afwGeom.degrees))
49 return afwCoord.makeCoord(afwCoord.ICRS, afwGeom.Point3D(*vec))
def coordFromVec(vec, defRA=None)