示例#1
0
文件: plotting.py 项目: cdeil/fermipy
    def __init__(self,cmap,roi,**kwargs):
#        super(ROIPlotter,self).__init__(None,**kwargs)
        fermipy.config.Configurable.__init__(self,None,**kwargs)
        
        self._roi = roi
        self._data = cmap.counts.T
        self._wcs = cmap.wcs
        self._erange = self.config['erange']

        if self._erange:
            axes = wcs_to_axes(self._wcs,self._data.shape[::-1])
            i0 = valToEdge(axes[2],self._erange[0])
            i1 = valToEdge(axes[2],self._erange[1])
            imdata = self._data[:,:,i0:i1]
        else:
            imdata = self._data
            
        self._implot = ImagePlotter(imdata,self._wcs)
示例#2
0
文件: plotting.py 项目: cdeil/fermipy
    def get_data_projection(data,axes,iaxis,xmin=-1,xmax=1,erange=None):

        s0 = slice(None,None)
        s1 = slice(None,None)
        s2 = slice(None,None)
        
        if iaxis == 0:
            i0 = valToEdge(axes[iaxis],xmin)
            i1 = valToEdge(axes[iaxis],xmax)
            s1 = slice(i0,i1)
            saxes = [1,2]
        else:
            i0 = valToEdge(axes[iaxis],xmin)
            i1 = valToEdge(axes[iaxis],xmax)
            s0 = slice(i0,i1)
            saxes = [0,2]

        if erange is not None:
            j0 = valToEdge(axes[2],erange[0])
            j1 = valToEdge(axes[2],erange[1])
            s2 = slice(j0,j1)
            
        c = np.apply_over_axes(np.sum,data[s0,s1,s2],axes=saxes)
        c = np.squeeze(c)

        return c