import numpy as np
#np.seterr("raise")
import matplotlib.pyplot as plt
import matplotlib as mpl
from pylab import *
filename = 'skycal.20130219.mng'

stuff = np.loadtxt(filename,usecols=(0,1,2),dtype = [('f0','<f8'),('f1','<f8'),('f2','<f8')], unpack = False)
ra = stuff['f0']
dec = stuff['f1']
colorind = stuff['f2']
colorsind = range(len(colorind))
colors = []
for i in xrange(len(colorsind)):
 temp = colorsind[i] 
 if (colorind[i] == 0  ) :
    colors.append('#00FF00')
 elif (colorind[i] == 1  ):
    colors.append('#0033CC')
 elif (colorind[i] == 2  ):
    colors.append('#FF0000')
 else:
    colors.append('#FF0000')
deg2rad = pi/180.

fig=plt.figure()
ax= subplot(111, projection="hammer")
ax.scatter(pi-ra*deg2rad,dec*deg2rad,c=colors,lw = 0, s=1)
ax.set_xlim(0,360*deg2rad)
ax.set_title("addstar : skycal stage")
ax.grid(True)
ax.yaxis.set_ticklabels(['',''])
ax.xaxis.set_ticklabels(['',''])

#ax.xaxis.set_ticklabels(['22h', '20h', '18h','16h','14h','12h','10h','08h','06h','04h','02h'])
plt.savefig('skycal.20130219.png', dpi=100, facecolor="white", edgecolor="white")
