コード例 #1
0
    def plot(self, title='', axes=None, fignum=30, ait_kw={}, **kwargs):
        """ make an AIT skyplot from the array 
        title : string
            set the figure title
        ait_kw : dict
            to set kwargs for image.AIT, perhaps pixelsize
        
        Other args passed to imshow, for example norm: to make a log plot,
            from matplotlib.colors import LogNorm
            plot(norm=LogNorm(vmin=1,vmax=10))
        It returns a image.AIT object, which has a colorbar member that can be adjusted.
        """
        cbtext = kwargs.pop('cbtext', '')
        ait_kw.update(cbtext=cbtext)
        band = Band(self.nside)

        def skyplotfun(v):
            skydir = SkyDir(Hep3Vector(v[0], v[1], v[2]))
            return self(skydir)

        if axes is None:
            plt.close(fignum)
            fig = plt.figure(fignum, figsize=(12, 6))
            axes = plt.gca()
        ait = image.AIT(PySkyFunction(skyplotfun), axes=axes, **ait_kw)
        ait.imshow(title=title, **kwargs)
        return ait
コード例 #2
0
ファイル: display_map.py プロジェクト: tburnett/pointlike
def skyplot(crec, title='', axes=None, fignum=30, ait_kw={}, **kwargs):
    """ make an AIT skyplot of a HEALpix array
    crec : array
        must be sorted according to the HEALpix index
    title : string
        set the figure title
    ait_kw : dict
        to set kwargs for image.AIT, perhaps pixelsize
    
    Other args passed to imshow
    """
    n = len(crec)
    nside = int(np.sqrt(n/12))
    assert n==12*nside**2, 'wrong length to be healpix array'
    band = Band(nside)
    def skyplotfun(v):
        skydir = SkyDir(Hep3Vector(v[0],v[1],v[2]))
        index = band.index(skydir)
        return crec[index]
    if axes is None:
        plt.close(fignum)
        fig = plt.figure(fignum, figsize=(12,6))
    ait=image.AIT(PySkyFunction(skyplotfun) ,axes=axes, **ait_kw)
    ait.imshow(title=title, **kwargs)
    return ait
コード例 #3
0
ファイル: display_map.py プロジェクト: Areustle/fermi-glast
    def fill_ait(self,
                 fignum=11,
                 axes=None,
                 show_kw={},
                 source_kw={},
                 figwidth=12,
                 margin=0.15,
                 **kwargs):
        if axes is None:
            # set up a figure for 2x1 image with equal margins
            plt.close(fignum)
            figheight = figwidth * (1. + 2 * margin) / (1 + margin) / 2.
            fig = plt.figure(fignum, figsize=(figwidth, figheight))
            axes = plt.gca()
            plt.subplots_adjust(left=0.05,
                                right=0.95)  #gives reasonable equal margins
        pixelsize = kwargs.pop('pixelsize', 0.25)
        ait = image.AIT(self.get_pyskyfun(),
                        axes=axes,
                        pixelsize=pixelsize,
                        **kwargs)
        self.imgplot = ait.imshow(**show_kw)
        ait.axes.set_autoscale_on(False)

        if self.sources is not None:
            sdirs = map(SkyDir, self.sources.ra, self.sources.dec)
            ait.plot(sdirs, **source_kw)
            print 'found %d sources to plot' % len(sdirs)
        plt.draw_if_interactive()
        return ait
コード例 #4
0
ファイル: diffuse.py プロジェクト: kerrm/pointlike
 def show(self, title=None, scale='log', **kwargs):
     """make an AIT image for testing
     """
     from uw.utilities import image
     vmin = kwargs.pop('vmin', None)
     vmax = kwargs.pop('vmax', None)
     ait = image.AIT(self, **kwargs)
     ait.imshow(title=self.name if title is None else title, scale=scale, vmin=vmin, vmax=vmax)
     return ait.axes.figure
コード例 #5
0
ファイル: healpix_map.py プロジェクト: tburnett/pointlike
 def fill_ait(self, fignum=11, axes=None, show_kw={}, **kwargs):
     if axes is None:
         plt.close(fignum)
         fig=plt.figure(fignum, figsize=(12,8));
         axes=fig.gca()
     pixelsize = kwargs.pop('pixelsize', 0.25)
     ait = image.AIT(self.get_pyskyfun(),axes=axes, pixelsize=pixelsize, **kwargs)
     self.imgplot=ait.imshow(**show_kw)
     return ait