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()
### #TODO if first minute look for past orbits anyways print worthy_targets = [] for ii in range(0, targets[0].CountObjects()): if np.shape(targets[ii].visible)[0] > 0: worthy_targets.append(targets[ii]) ############################################################################ end = time.time() elapsed_time = round((end-start)/60.,2) sys.stdout.write( '\r'*len(message) ) sys.stdout.flush() print "Time needed: %2.2f min" % elapsed_time ### Plot a few things if fancy: figures.set_fancy() ### Plot time line figures.set_fancy() minute_ini = first_minute minute_end = last_minute maxy = len(worthy_targets) print 'Number of star visible in period selected: %d' % maxy size = 2 + maxy/3 figsize = (17.,size) # fig size in inches (width,height) fig = plt.figure(figsize=figsize) ax = plt.subplot(111)
# plt.scatter(target.Coordinates()[0]*180./np.pi,target.Coordinates()[1]*180./np.pi,c=c, cmap=cm.jet, vmin=np.amin(density), vmax=np.amax(density), edgecolor='none', s=50) # plt.xlim([0,360]) # plt.ylim([-90,90]) # plt.grid() # cb=plt.colorbar() # cb.set_label('Probabilty of transit of min. %d hours' % transit_duration) ########################################################################### ### Plotting # transform 0 into no plotting in the data matrix mag_min = np.amin(data_grid[data_grid > 0]) data_grid[data_grid < mag_min] = np.nan if fancy: figures.set_fancy() fig = plt.figure() axes = fig.add_subplot(1, 1, 1, axisbg="black") m = Basemap(projection="moll", lon_0=180, resolution="c") extent = (-np.pi, np.pi, -np.pi / 2.0, np.pi / 2.0) ra_grid *= const.RAD # 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, int((mag_max - mag_min) / mag_sep + 1), cmap=plt.cm.gist_rainbow, latlon=True )
dec_grid = data_ref['dec_grid'] ticks = data_ref['dec_grid'] ref = data_ref['data_grid'] other = data_other['data_grid'] whereAreNaNs = np.isnan(ref) ref[whereAreNaNs] = 0 whereAreNaNs = np.isnan(other) other[whereAreNaNs] = 0 delta = ref - other #delta[delta == 0]=np.nan ### Plotting # transform 0 into no plotting in the data matrix if fancy: figures.set_fancy() fig = plt.figure() ax = plt.subplot(111) #ax.set_aspect(2.) plt.grid() print np.amax(delta) v = np.arange(min_val, max_val + step_scale, step_scale) vl = np.arange(min_val, max_val + step_scale, 2) CS = plt.contour(ra_grid, dec_grid, np.fliplr(delta), colors='k', levels=vl) plt.clabel(CS, inline=1, fmt='%+d', colors='k', fontsize=12, ticks=v) CS = plt.contourf(ra_grid, dec_grid, np.fliplr(delta),
import resources.figures as figures import numpy as np import pylab as plt # WARNING: This is an obselete version of the code... pst = np.loadtxt('straylight_orbitID_p/INPUT/pst.dat') print pst figures.set_fancy() fig = plt.figure() plt.xlabel(r'$\theta$') plt.ylabel('PST') plt.semilogy(pst[:, 0], pst[:, 1], lw=2) plt.plot([35, 35], [np.amin(pst[:, 1]), np.amax(pst[:, 1])], lw=3, color='r') plt.grid() figures.savefig('orbitID_figures/pst', fig, fancy=True) plt.show()