Пример #1
0
    def view_colmap(self,  arrs, layout="simple", device="png", opt="colz", palette="simple", serial=False):
        from modules.graph_utils.root_util.root_util import root_util
        r = root_util()
        layoutdic = {"single": r.single_layout,
                     "dual": r.dual_layout,
                     "sextuple" : r.sextuple_layout}
        palettedic = {"simple": r.mypalette1,
                      "simple3": r.mypalette3,
                      "simple4": r.mypalette4,
                      "rainbow": r.palette_rainbow,
                      "r2b": r.palette_red2blue}

        arrs = self.get_data()
        x,y,z = arrs
        
        if serial:
            bin_xtpl = tuple(x[0]) if x[0][1] != x[0][0] else tuple(x.transpose()[0]) # check the greater direction.
            bin_ytpl = tuple(y[0]) if y[0][1] != y[0][0] else tuple(y.transpose()[0])
            r.set_xyzdata(tuple(x.reshape(x.size).tolist()),  tuple(y.reshape(y.size).tolist()), tuple(z.reshape(z.size).tolist()), bin_xtpl, bin_ytpl, 0, 0)
        else:
            r.set_xyzdata_tgraph(tuple(x.reshape(x.size).tolist()),  tuple(y.reshape(y.size).tolist()), tuple(z.reshape(z.size).tolist()), 0, 0)
        xlim = self.root.get_xlim(0)
        ylim = self.root.get_ylim(0)
        zlim = self.root.get_zlim(0)
        if type(xlim) != type(None): r.set_xlim(xlim[0], xlim[1], 0)
        if type(ylim) != type(None): r.set_ylim(ylim[0], ylim[1], 0)
        if type(zlim) != type(None): r.set_zlim(zlim[0], zlim[1], 0)
        r.set_xname(self.root.get_xname(0), 0)
        r.set_yname(self.root.get_yname(0), 0)
        r.set_zname(self.root.get_zname(0), 0)
        layoutdic[layout](opt)
        palettedic[palette]()
        r.view_graph()
Пример #2
0
    def view_col(self,  layout="single", T=None, axtpl=(0,2,1), xlim=None, ylim=None, zlim=None, device="png", opt="colz", palette="simple"):
        from modules.graph_utils.root_util.root_util import root_util
        self.T_align(T)
        r = root_util()
        layoutdic = {"single": r.single_layout,
                     "dual": r.dual_layout,
                     "sextuple" : r.sextuple_layout,
                     "1logz" : r.layout1_logz}
        palettedic = {"simple": r.mypalette1,
                      "simple3": r.mypalette3,
                      "simple4": r.mypalette4,
                      "rainbow": r.palette_rainbow,
                      "r2b": r.palette_red2blue}
        if type(T) != type(None) and T != self.T: self.transpose()
        for i, obj in enumerate(self.datlst):

            arrs = obj.get_data()
            x = arrs[axtpl[0]]
            y = arrs[axtpl[1]]
            z = arrs[axtpl[2]]
        
            bin_xtpl = tuple(x[0]) if x[0][1] != x[0][0] else tuple(x.transpose()[0]) # check the greater direction for multiarray.
            bin_ytpl = tuple(y[0]) if y[0][1] != y[0][0] else tuple(y.transpose()[0])
            if bin_xtpl[1] - bin_xtpl[0] < 0: bin_xtpl = bin_xtpl[::-1]  # check the greater direction for array.
            if bin_ytpl[1] - bin_ytpl[0] < 0: bin_ytpl = bin_ytpl[::-1] 

            r.set_xyzdata(tuple(x.reshape(x.size).tolist()),  tuple(y.reshape(y.size).tolist()), tuple(z.reshape(z.size).tolist()), bin_xtpl, bin_ytpl, i, 0)
            #r.show_prop()
            #r.dump_fig(fcnt(dirpath, filename, device))
            xlim = self.root.get_xlim(i)
            ylim = self.root.get_ylim(i)
            zlim = self.root.get_zlim(i)
            if type(xlim) != type(None): r.set_xlim(xlim[0], xlim[1], i)
            if type(ylim) != type(None): r.set_ylim(ylim[0], ylim[1], i)
            if type(zlim) != type(None): r.set_zlim(zlim[0], zlim[1], i)
            r.set_xname(self.root.get_xname(i), i)
            r.set_yname(self.root.get_yname(i), i)
            r.set_zname(self.root.get_zname(i), i)
        layoutdic[layout](opt)
        palettedic[palette]()
        for i in range(len(self.datlst)):
            for lst in self.root.get_box(i):
                #input(lst)
                #input(lst)
                r.set_box(*lst)
        r.view_graph()
Пример #3
0
    def tevo_col(self, layout="single", palette="simple",dirname="tmpdir", filename="tmp", T=(0,1,2), axtpl=(0,2,1), device="png", opt="colz", show=False):
        from modules.graph_utils.root_util.root_util import root_util
        self.transpose(T)
        dirpath = fcnt(self.dumppath+"/"+dirname)       
        os.mkdir(dirpath)
        #seqlst = self.get_seq()
        #for x,y,z,a in zip(self.x, self.y, self.z, self.a):
        
        arrs = self.get_data()
        xarr = arrs[axtpl[0]]
        yarr = arrs[axtpl[1]]
        zarr = arrs[6-array(axtpl).sum()] 
        aarr = arrs[axtpl[2]] if not arrs[axtpl[2]] is None else None

        seq = self.get_seq()
        
        xseq = [0,0,0]; xseq[seq[axtpl[0]]] = ":"; xseq = "[%s,%s,%s]" %tuple(xseq)
        
        exec "bin_xtpl = tuple(xarr%s)" %xseq
        yseq = [0,0,0]; yseq[seq[axtpl[1]]] = ":"; yseq = "[%s,%s,%s]" %tuple(yseq)
        exec "bin_ytpl = tuple(yarr%s)" %yseq
        #bin_xtpl = tuple(xarr[0][0] if xarr[0][0][0] != xarr[0][0][1] else xarr.transpose(0,2,1)[0][0])
        #bin_ytpl = tuple(yarr[0][0] if yarr[0][0][0] != yarr[0][0][1] else yarr.transpose(0,2,1)[0][0])
        i = 0
        n = len(arrs[0])
        while i < n:
            x = xarr[i]
            y = yarr[i]
            z = zarr[i]
            if not aarr is None: a = aarr[i]
            #input(x)
            #input(y)
            #input(z)
            #input(a)
            
            r = root_util()
            layoutdic = {"single": r.single_layout,
                         "dual": r.dual_layout,
                         "sextuple" : r.sextuple_layout,
                         "1logz" : r.layout1_logz}
            palettedic = {"simple": r.mypalette1,
                      "simple3": r.mypalette3,
                      "simple4": r.mypalette4,
                      "rainbow": r.palette_rainbow,
                      "r2b": r.palette_red2blue}
            #r.root_init()
            #r.set_xlim(0)
            #bin_xtpl = (1,2,3)
            #bin_ytpl = (1,2,3)
            #input(bin_xtpl)
            #input(bin_ytpl)
            #input(shape(x))
            #input(shape(a))
            xtpl = tuple(x.reshape(x.size).tolist())
            ytpl = tuple(y.reshape(y.size).tolist())
            ztpl = tuple(z.reshape(z.size).tolist())
            if not(len(xtpl) == len(ytpl) == len(ztpl)):
                raise ValueError, "Not mutch for data size between x, y and z (x = %s, y = %s and z = %s)." %(len(xtpl), len(ytpl), len(ztpl))
            
            r.set_xyzdata(tuple(x.reshape(x.size).tolist()),  tuple(y.reshape(y.size).tolist()), tuple(z.reshape(z.size).tolist()), bin_xtpl, bin_ytpl, 0, 0)
            xlim = self.root.get_xlim(0)
            ylim = self.root.get_ylim(0)
            zlim = self.root.get_zlim(0)
            if type(xlim) != type(None): r.set_xlim(xlim[0], xlim[1], 0)
            if type(ylim) != type(None): r.set_ylim(ylim[0], ylim[1], 0)
            if type(zlim) != type(None): r.set_zlim(zlim[0], zlim[1], 0)
            r.set_xname(self.root.get_xname(0), 0)
            r.set_yname(self.root.get_yname(0), 0)
            r.set_zname(self.root.get_zname(0), 0)

            #r.set_xlim(bin_xtpl[0], bin_xtpl[-1], 0)
            #r.set_ylim(bin_ytpl[0], bin_ytpl[-1], 0)
            #r.set_zlim(0, 1e-18, 0)
            #input(fcnt(dirpath, filename, device))
            layoutdic[layout](opt)
            palettedic[palette]()
            r.dump_fig(fcnt(dirpath, filename, device))
            if show: r.view_graph()
            i += 1