def fpt (self, node_origin, node_sink, num_runs=200, option='mean', bins=20, segment=None, delta_x=None,norm=None): """option=['mean','distribution','both','raw']""" if self.Ts==False : self.build_Ts() scratch=[] for ii in range(num_runs): iseed=numpy.random.random_integers(0,4094,4) iseed[3]=(iseed[3]/2)*2+1 aa=f_net.brownian_run_fpt(self.T_start,self.T_ind,self.T_wl,iseed,node_origin,node_sink,self.num_nodes,self.k_total) scratch.append(aa) if option in ['distribution','both']: xx,yy=pyn_math.histogram(scratch,bins,segment,delta_x,None,norm,plot=False) if option in ['mean','both']: yy_av,yy_sigma=pyn_math.average(scratch) if option=='distribution': return xx,yy if option=='mean': return yy_av, yy_sigma if option=='both': return yy_av, yy_sigma, xx,yy if option=='raw': return scratch pass
def k_distribution (self, option='out', bins=20, segment=None, delta_x=None,norm=None): """ option=['total','in','out']""" for ii in self.node: ii.k_out=len(ii.link) scratch=[] if option=='out': for ii in self.node: scratch.append(ii.k_out) xx,yy=pyn_math.histogram(scratch,bins,segment,delta_x,None,norm,plot=False) return xx, yy
def histogram(self,dimension=None,node=None,cluster=None,bins=20,segment=None,delta=None,select_dim=0,norm=False,cumul=False): if cluster==None and node==None: return pyn_math.histogram(self.traj,bins=bins,segment=segment,delta=delta,select_dim=select_dim,norm=norm,cumul=cumul) if cluster!=None: xx,yy=pyn_math.histogram_mask(self.traj,bins=bins,segment=segment,delta=delta,select_dim=select_dim,\ traj_mask=self.traj_clusters,select_mask=cluster,offset_mask=self.__offset__,\ norm=norm,cumul=cumul) return xx,yy if node!=None: xx,yy=pyn_math.histogram_mask(self.traj,bins=bins,segment=segment,delta=delta,select_dim=select_dim,\ traj_mask=self.traj_nodes,select_mask=node,offset_mask=self.__offset__,\ norm=norm,cumul=cumul) return xx,yy
def weight_distribution (self, option='all', bins=20, segment=None, delta_x=None,norm=None): """option=['all','self_links','all-self_links','links'] (I have to do the same for the links of a node)""" scratch=[] if option=='all': for ii in self.node: scratch.append(ii.weight) if option=='self_links': for ii in range(self.num_nodes): scratch.append(self.node[ii].link[ii]) if option=='all-self_links': for ii in range(self.num_nodes): scratch.append(self.node[ii].weight-self.node[ii].link[ii]) xx,yy=pyn_math.histogram(scratch,bins,segment,delta_x,None,norm,plot=False) return xx, yy
def histogram( self, dimension=None, node=None, cluster=None, bins=20, segment=None, delta=None, select_dim=0, norm=False, cumul=False, ): if cluster == None and node == None: if self.__tr_mode_in_file__: return pyn_math.histogram( self.traj, bins=bins, segment=segment, delta=delta, select_dim=select_dim, norm=norm, cumul=cumul, in_file=self.file_traj, by_frame=self.__tr_mode_by_frame__, ) else: return pyn_math.histogram( self.traj, bins=bins, segment=segment, delta=delta, select_dim=select_dim, norm=norm, cumul=cumul, in_file=False, by_frame=self.__tr_mode_by_frame__, ) if cluster != None: return pyn_math.histogram_mask( self.traj, bins=bins, segment=segment, delta=delta, select_dim=select_dim, traj_mask=self.traj_clusters, select_mask=cluster, offset_mask=self.__offset__, norm=norm, cumul=cumul, ) if node != None: return pyn_math.histogram_mask( self.traj, bins=bins, segment=segment, delta=delta, select_dim=select_dim, traj_mask=self.traj_nodes, select_mask=node, offset_mask=self.__offset__, norm=norm, cumul=cumul, )