Пример #1
0
    def berezovska2012(self,window=None,ksi=0.5,granularity=1.2,bins=20,segment=None,delta=None,clusters=True,verbose=False):

        ref_max=self.traj.max()
        ref_min=self.traj.min()
        rv_min=0
        rv_max=0

        if segment==None:
            opt_range=0
            mmx=ref_max
            mmn=ref_min
        else:
            opt_range=1
            mmn=segment[0]
            mmx=segment[1]
            if mmn>ref_min:
                rv_min=1
            if mmx<ref_max:
                rv_max=1

        if delta!=None:
            opt=1
        else:
            delta=1.0 # Its given by gannas function
            opt=2

        if self.dimensions!=1:
            print '# Method not implemented yet for more than 1D.'
            return

        if verbose:
            if rv_min:
                print '# Extra node for x <', mmn
            if rv_max:
                print '# Extra node for x >', mmx

        self.traj_nodes=f_kin_anal.ganna(opt_range,opt,bins,mmn,mmx,delta,rv_min,rv_max,self.traj,ksi,window,self.particles,self.frames)
        self.__offset__=window

        self.network=kinetic_network(self.traj_nodes,ranges=[self.traj_nodes.min(),self.traj_nodes.max()],verbose=False)
        
        if clusters:

            self.network.symmetrize(new=False,verbose=verbose)

            self.network.mcl(granularity=granularity,pruning=True,verbose=verbose)

            num_nodes=self.network.num_nodes
            aux_list=numpy.empty(num_nodes,dtype=int,order='F')
            for ii in range(num_nodes):
                aux_list[ii]=self.network.node[ii].cluster

            new_num_frames=self.traj_nodes.shape[0]
            self.traj_clusters=f_kin_anal.trajnodes2trajclusters(aux_list,self.traj_nodes,num_nodes,new_num_frames,self.particles)

            del(num_nodes,new_num_frames,aux_list)

            self.__type_clusters__='berezovska2012'
Пример #2
0
    def build_traj_clusters(self):

        num_nodes=self.network.num_nodes
        aux_list=numpy.empty(num_nodes,dtype=int,order='F')
        for ii in range(num_nodes):
            aux_list[ii]=self.network.node[ii].cluster

        new_num_frames=self.traj_nodes.shape[0]
        self.traj_clusters=f_kin_anal.trajnodes2trajclusters(aux_list,self.traj_nodes,num_nodes,new_num_frames,self.particles)
        del(num_nodes,new_num_frames,aux_list)
Пример #3
0
    def prada1(self,window=None,granularity=1.2,bins=20,ybins=10,segment=None,delta=None,clusters=True,verbose=False):

        if self.dimensions!=1:
            print '# Method not implemented yet for more than 1D.'
            return

        bins,mmx,mmn,delta=pyn_math.parameters_bins(self.traj,bins,segment,delta)

        rv_min=0
        rv_max=0

        if mmn>self.traj.min():
            rv_min=1
            bins+=1
        if mmx<self.traj.max():
            rv_max=1
            bins+=1

        if verbose:
            if rv_min:
                print '# Extra node for x <', mmn
            if rv_max:
                print '# Extra node for x >', mmx

        traj_aux=f_kin_anal.prada1(ybins,bins,mmn,mmx,delta,rv_min,rv_max,self.traj,window,self.particles,self.frames)

        ranges=pyn_math.build_ranges(traj_aux)

        self.network,self.traj_nodes=kinetic_network(traj_aux,ranges=ranges,traj_out=True,verbose=verbose)
         
        del(traj_aux)
         
        self.__offset__=window
         
        if clusters:
         
            self.network.symmetrize(new=False,verbose=verbose)
         
            self.network.mcl(granularity=granularity,pruning=True,verbose=verbose)
         
            num_nodes=self.network.num_nodes
            aux_list=numpy.empty(num_nodes,dtype=int,order='F')
            for ii in range(num_nodes):
                aux_list[ii]=self.network.node[ii].cluster
         
            new_num_frames=self.traj_nodes.shape[0]
            self.traj_clusters=f_kin_anal.trajnodes2trajclusters(aux_list,self.traj_nodes,num_nodes,new_num_frames,self.particles)
            
            del(num_nodes,new_num_frames,aux_list)
         
            self.__type_clusters__='prada1'
Пример #4
0
    def prada2(self,window=None,granularity=1.2,bins=10,ybins=10,sbins=10,segment=None,delta=None,clusters=True,verbose=False):

        ref_max=self.traj.max()
        ref_min=self.traj.min()

        if segment==None:
            opt_range=0
            mmx=ref_max
            mmn=ref_min
        else:
            opt_range=1
            mmn=segment[0]
            mmx=segment[1]

        if delta!=None:
            opt=1
        else:
            delta=1.0 # Its given by gannas function
            opt=2

        bins,mmx,mmn,delta=pyn_math.parameters_bins(opt_range,opt,bins,mmn,mmx,delta)

        traj_aux=f_kin_anal.prada2(ybins,sbins,bins,mmn,mmx,delta,self.traj,window,self.particles,self.frames)

        ranges=pyn_math.build_ranges(traj_aux)
         
        self.network,self.traj_nodes=kinetic_network(traj_aux,ranges=ranges,traj_out=True,verbose=False)
         
        del(traj_aux)
         
        self.__offset__=window
         
        if clusters:
         
            self.network.symmetrize(new=False,verbose=verbose)
         
            self.network.mcl(granularity=granularity,pruning=True,verbose=verbose)
         
            num_nodes=self.network.num_nodes
            aux_list=numpy.empty(num_nodes,dtype=int,order='F')
            for ii in range(num_nodes):
                aux_list[ii]=self.network.node[ii].cluster
         
            new_num_frames=self.traj_nodes.shape[0]
            self.traj_clusters=f_kin_anal.trajnodes2trajclusters(aux_list,self.traj_nodes,num_nodes,new_num_frames,self.particles,self.dimensions)
         
            del(num_nodes,new_num_frames,aux_list)
         
            self.__type_clusters__='prada2'