def _spin_fields(self, lon=None, lat=None):
"""Spin the field tesselation
"""
if lon is None:
lon = np.random.rand()*np.pi*2
if lat is None:
lat = np.random.rand()*np.pi*2
# rotate longitude
ra = (self.fields['RA'] + lon) % (2.*np.pi)
dec = self.fields['dec'] + 0
# Now to rotate ra and dec about the x-axis
x, y, z = thetaphi2xyz(self.fields['RA'], self.fields['dec']+np.pi/2.)
xp, yp, zp = rotx(lat, x, y, z)
theta, phi = xyz2thetaphi(xp, yp, zp)
dec = phi - np.pi/2
ra = theta + np.pi
self.fields['RA'] = ra
self.fields['dec'] = dec
# Rebuild the kdtree with the new positions
# XXX-may be doing some ra,dec to conversions xyz more than needed.
self._hp2fieldsetup(ra, dec)
评论列表
文章目录