def hsvoffsets(self, TT, rad, apply=False):
print 'hsv offsets plot'
plt.clf()
for ix,X in enumerate(self.edges):
X = self.get_edge_dradec_arcsec(ix, corrected=apply, goodonly=True)
(matchRA, matchDec, dra, ddec) = X
print 'matchRA,Dec:', len(matchRA), len(matchDec)
print 'dra,dec:', len(dra), len(ddec)
for ra,dec,dr,dd in zip(matchRA, matchDec, dra, ddec):
angle = arctan2(dd, dr) / (2.*pi)
angle = fmod(angle + 1, 1.)
mag = hypot(dd, dr)
mag = min(1, mag/(0.5*rad))
rgb = colorsys.hsv_to_rgb(angle, mag, 0.5)
plt.plot([ra], [dec], '.', color=rgb, alpha=0.5)
# legend in top-right corner.
ax=plt.axis()
xlo,xhi = plt.gca().get_xlim()
ylo,yhi = plt.gca().get_ylim()
# fraction
keycx = xlo + 0.90 * (xhi-xlo)
keycy = ylo + 0.90 * (yhi-ylo)
keyrx = 0.1 * (xhi-xlo) / 1.4 # HACK
keyry = 0.1 * (yhi-ylo)
nrings = 5
for i,(rx,ry) in enumerate(zip(np.linspace(0, keyrx, nrings), np.linspace(0, keyry, nrings))):
nspokes = ceil(i / float(nrings-1) * 30)
angles = np.linspace(0, 2.*pi, nspokes, endpoint=False)
for a in angles:
rgb = colorsys.hsv_to_rgb(a/(2.*pi), float(i)/(nrings-1), 0.5)
plt.plot([keycx + rx*sin(a)], [keycy + ry*cos(a)], '.', color=rgb, alpha=1.)
plt.axis(ax)
plt.xlabel('RA (deg)')
plt.ylabel('Dec (deg)')
评论列表
文章目录