def drawStellarDensity(self,ax=None):
if not ax: ax = plt.gca()
# Stellar Catalog
self._create_catalog()
catalog = self.catalog
#catalog=ugali.observation.catalog.Catalog(self.config,roi=self.roi)
pix = ang2pix(self.nside, catalog.lon, catalog.lat)
counts = collections.Counter(pix)
pixels, number = numpy.array(sorted(counts.items())).T
star_map = healpy.UNSEEN * numpy.ones(healpy.nside2npix(self.nside))
star_map[pixels] = number
star_map = numpy.where(star_map == 0, healpy.UNSEEN, star_map)
#im = healpy.gnomview(star_map,**self.gnom_kwargs)
#healpy.graticule(dpar=1,dmer=1,color='0.5',verbose=False)
#pylab.close()
im = drawHealpixMap(star_map,self.glon,self.glat,self.radius,coord=self.coord)
#im = ax.imshow(im,origin='bottom')
try: ax.cax.colorbar(im)
except: pylab.colorbar(im,ax=ax)
ax.annotate("Stars",**self.label_kwargs)
return im
评论列表
文章目录