def show(self, proj='moll', lon_0=180, tmap=None, coord=None):
     from mpl_toolkits.basemap import Basemap
     import pylab as plt
     import resources.figures as figures
     figures.set_fancy()
     if coord==None:
         ra = np.rad2deg(self.grid['points'][:,0])
         dec = np.rad2deg(self.grid['points'][:,1])
     else:
         ra = np.rad2deg(coord[:,0])
         dec = np.rad2deg(coord[:,1])
     
     fig = plt.figure()
     m = Basemap(projection=proj,lon_0=lon_0)#,celestial=True) # celestial=True inverses alpha (East towards the right)
     m.drawparallels(np.arange(-60.,90.,30.),labels=[1,0,0,0])
     m.drawmeridians(np.arange(0.,360.,30.))
     
     ra__ = np.arange(0., 360., 30.)
     x, y = m(ra__,ra__*0)
     for x,y,t in zip(x,y,ra__):
         plt.text(x, y, figures.format_degree(t), color='black', ha='center', weight='black', size='small') ##93c6ed
     if tmap==None:
         m.scatter(ra,dec,latlon=True,marker='x',s=20,cmap=plt.cm.binary)
     else:
         m.scatter(ra,dec,c=tmap,latlon=True,marker='x',s=20,cmap=plt.cm.binary)
     plt.show()
    def show(self, proj='moll', lon_0=180, tmap=None, coord=None):
        from mpl_toolkits.basemap import Basemap
        import pylab as plt
        import resources.figures as figures
        figures.set_fancy()
        if coord == None:
            ra = np.rad2deg(self.grid['points'][:, 0])
            dec = np.rad2deg(self.grid['points'][:, 1])
        else:
            ra = np.rad2deg(coord[:, 0])
            dec = np.rad2deg(coord[:, 1])

        fig = plt.figure()
        m = Basemap(
            projection=proj, lon_0=lon_0
        )  #,celestial=True) # celestial=True inverses alpha (East towards the right)
        m.drawparallels(np.arange(-60., 90., 30.), labels=[1, 0, 0, 0])
        m.drawmeridians(np.arange(0., 360., 30.))

        ra__ = np.arange(0., 360., 30.)
        x, y = m(ra__, ra__ * 0)
        for x, y, t in zip(x, y, ra__):
            plt.text(x,
                     y,
                     figures.format_degree(t),
                     color='black',
                     ha='center',
                     weight='black',
                     size='small')  ##93c6ed
        if tmap == None:
            m.scatter(ra,
                      dec,
                      latlon=True,
                      marker='x',
                      s=20,
                      cmap=plt.cm.binary)
        else:
            m.scatter(ra,
                      dec,
                      c=tmap,
                      latlon=True,
                      marker='x',
                      s=20,
                      cmap=plt.cm.binary)
        plt.show()
m.contour(ra_grid, dec_grid, data_grid, 10, colors="k", latlon=True)
CS = m.contourf(
    ra_grid, dec_grid, data_grid, int((mag_max - mag_min) / mag_sep + 1), cmap=plt.cm.gist_rainbow, latlon=True
)
# m.fillcontinents(color='coral',lake_color='aqua')
# draw parallels and meridians.
m.drawparallels(np.arange(-60.0, 90.0, 30.0), labels=[1, 0, 0, 0])
m.drawmeridians(np.arange(0.0, 360.0, 30.0))


ra__ = np.arange(0.0, 360.0, 30.0)
# print ra__
x, y = m(ra__, ra__ * 0)
for x, y, ra in zip(x, y, ra__):
    plt.text(x, y, figures.format_degree(ra), color="black", ha="center", weight="black", size="small")  ##93c6ed
v = np.linspace(mag_min, mag_max, (mag_max - mag_min + 1), endpoint=True)
t = map(figures.format_mag, v)

cbar = plt.colorbar(CS, ticks=v, orientation="horizontal", shrink=0.8)
cbar.set_ticklabels(t)

# cbar = plt.colorbar(CS, orientation='horizontal',shrink=.8, ticks=t)
# cbar.ax.set_xticklabels(labels)
l, b, w, h = plt.gca().get_position().bounds
ll, bb, ww, hh = cbar.ax.get_position().bounds
cbar.ax.set_position([ll, bb + 0.1, ww, hh])
cbar.set_label(r"$\mathrm{faintest}\ V\ \mathrm{magnitude\ for\ %s\ (%d\%%\ detection)}$" % (typep, min_detection_rate))

if stars:
    x, y = m(ra_stars, dec_stars)
Esempio n. 4
0
                data_grid,
                int((mag_max - mag_min) / mag_sep + 1),
                cmap=plt.cm.gist_rainbow,
                latlon=True)
#m.fillcontinents(color='coral',lake_color='aqua')
# draw parallels and meridians.
m.drawparallels(np.arange(-60., 90., 30.), labels=[1, 0, 0, 0])
m.drawmeridians(np.arange(0., 360., 30.))

ra__ = np.arange(0., 360., 30.)
#print ra__
x, y = m(ra__, ra__ * 0)
for x, y, ra in zip(x, y, ra__):
    plt.text(x,
             y,
             figures.format_degree(ra),
             color='black',
             ha='center',
             weight='black',
             size='small')  ##93c6ed
v = np.linspace(mag_min, mag_max, (mag_max - mag_min + 1), endpoint=True)
t = map(figures.format_mag, v)

cbar = plt.colorbar(CS, ticks=v, orientation='horizontal', shrink=.8)
cbar.set_ticklabels(t)

#cbar = plt.colorbar(CS, orientation='horizontal',shrink=.8, ticks=t)
#cbar.ax.set_xticklabels(labels)
l, b, w, h = plt.gca().get_position().bounds
ll, bb, ww, hh = cbar.ax.get_position().bounds
cbar.ax.set_position([ll, bb + 0.1, ww, hh])
#ra_grid -= 180.
#ra_grid = ra_grid - 180 #= (ra_grid-np.pi)  #*180. / np.pi
dec_grid *= const.RAD
m.contour( ra_grid,dec_grid,data_grid,10,colors='k',latlon=True)
CS = m.contourf( ra_grid ,dec_grid,data_grid,100,cmap=plt.cm.gist_stern,latlon=True,vmin=0)
#m.fillcontinents(color='coral',lake_color='aqua')
# draw parallels and meridians.
m.drawparallels(np.arange(-60.,90.,30.),labels=[1,0,0,0])
m.drawmeridians(np.arange(0.,360.,30.))


ra__ = np.arange(0., 360., 30.)
#print ra__
x, y = m(ra__,ra__*0)
for x,y,ra in zip(x,y,ra__):
	plt.text(x, y, figures.format_degree(ra), color='black', ha='center', weight='black', size='small') ##93c6ed


t = np.linspace(0., np.amax(density),5)
labels = ['%3.1f\%%' % a for a in t]
cbar = plt.colorbar(CS, orientation='horizontal',shrink=.8, ticks=t)
cbar.ax.set_xticklabels(labels)
l,b,w,h = plt.gca().get_position().bounds
ll,bb,ww,hh = cbar.ax.get_position().bounds
cbar.ax.set_position([ll, bb+0.1, ww, hh])
cbar.set_label('Probabilty of seeing a transit of %d hours for V=%3.1f' % (transit_duration,mag_max))

if stars:
	x,y = m(ra_stars, dec_stars)
	m.plot(x,y, 'w*', markersize=10)