27from ._python
import reduceTransform
28from ._geom
import (SkyWcs, makeCdMatrix, makeFlippedWcs, makeModifiedWcs,
29 makeSkyWcs, makeTanSipWcs, makeWcsPairTransform,
30 getIntermediateWorldCoordsToSky, getPixelToIntermediateWorldCoords)
31from ._hpxUtils
import makeHpxWcs
33__all__ = [
"SkyWcs",
"makeCdMatrix",
"makeFlippedWcs",
"makeSkyWcs",
34 "makeModifiedWcs",
"makeTanSipWcs",
"makeWcsPairTransform",
35 "getIntermediateWorldCoordsToSky",
"getPixelToIntermediateWorldCoords",
43 Convert numpy array pixels (x, y) to numpy array sky (ra, dec)
52 degrees : `bool`, optional
53 Return ra, dec arrays in degrees
if True.
58 Array of Right Ascension. Units are radians unless
61 Array of Declination. Units are radians unless
64 xy = np.vstack((x, y))
65 ra, dec = np.vsplit(self.getTransform().getMapping().applyForward(xy), 2)
69 return np.rad2deg(ra.ravel()), np.rad2deg(dec.ravel())
71 return ra.ravel(), dec.ravel()
75 Convert numpy array sky (ra, dec) positions to numpy array
81 Array of Right Ascension. Units are radians unless
84 Array of Declination. Units are radians unless
86 degrees : `bool`, optional
87 Input ra, dec arrays are degrees
if True.
96 radec = np.vstack((ra, dec))
98 radec = np.deg2rad(radec)
100 x, y = np.vsplit(self.getTransform().getMapping().applyInverse(radec), 2)
102 return x.ravel(), y.ravel()
105 """Get the difference in sky rotation angle to the specified wcs.
107 Ignoring location on the sky, if another wcs were atop this one,
108 what would the difference
in rotation be? i.e.
for
110 otherWcs = createInitialSkyWcsFromBoresight(radec, rotation, detector)
112 what
is the value that needs to be added to ``self.rotation`` (
or
113 subtracted
from `other.rotation``) to align them?
118 The wcs to calculate the angle to.
123 The angle between this
and the supplied wcs,
124 over the half-open range [0, 2pi).
131 m1 = self.getCdMatrix()
132 m2 = otherWcs.getCdMatrix()
134 svd1 = scipy.linalg.svd(m1)
135 svd2 = scipy.linalg.svd(m2)
137 m1rot = np.matmul(svd1[0], svd1[2])
138 m2rot = np.matmul(svd2[0], svd2[2])
142 v_rot = np.matmul(v_rot, m1rot)
143 v_rot = np.matmul(v_rot, m2rot.T)
145 rotation = np.arctan2(v_rot[1], v_rot[0])
146 rotation = rotation % (2*np.pi)
150SkyWcs.__reduce__ = reduceTransform
A 2-dimensional celestial WCS that transform pixels to ICRS RA/Dec, using the LSST standard for pixel...
def getRelativeRotationToWcs(self, otherWcs)
def skyToPixelArray(self, ra, dec, degrees=False)
def pixelToSkyArray(self, x, y, degrees=False)