Esempio n. 1
0
	#loading data points ('N' points for each one of the 'DIM' CVs)
	N=file_lines(args.INPUT)
	DIM=file_cols(args.INPUT)

	P1=load_data(args.INPUT,N,DIM)
	dK1=[]
	dK2=[]
	conv_all=[]

	# estimate the initial string (P2) of size Min
	P2 = string_ini(P1,DIM,args.K)
	Pini=string_ini(P1,DIM,args.K)
	PiniT=zip(*Pini)

	# maximun distances of the data to the images of the string
	maxdistances=maxvec(P1,P2)

	# Estimate the mean of the voronoid cells
	P3, fail, free_energy, allpoints, closeP, closeI = voroid_mean(P1,P2,DIM,maxdistances,0)

	#############################
	if (len(args.CV2plot)==3):
		converg=[]
		for i in range(args.Niter):
			print 'Iteration ', (i+1), 'out of ', args.Niter
			# get voronoid centers
			maxdistances=maxvec(P1,P3)
			Pm, fail, free_energy, allpoints, closeP, closeI = voroid_mean(P1,P3,DIM,maxdistances,0)
			d=np.linalg.norm(np.asarray(Pm)-np.asarray(P3))
			converg.append(d)
			P3=Pm
Esempio n. 2
0
	##########################
	####### MAIN PROGRAM #####
	##########################
	sys.stdout.write("\a")
	#loading the input file ('N' rows 'M' columns or colective variables...CVs)
	N=file_lines(args.INPUT)
	M=file_cols(args.INPUT)
	P1=load_data(args.INPUT,N,M)

	# estimate the initial string (P2) of size Min
	P2 = string_ini(P1,M,args.Min)
	Pini=string_ini(P1,M,args.Min)
	PiniT=zip(*Pini)

	# maximun distances of the data to the images of the string
	maxdistances=maxvec(P1,P2)

	# Estimate the mean of the voronoid cells
	P3, fail, free_energy, allpoints, closeP, closeI = voroid_mean(P1,P2,M,maxdistances, 0)

	# Reparametrization and smoothing of the centers of the voronoid cells
	dist_to_X2, totalD = dm_vec(P3,args.Min)
	Pin=np.asarray(P3)
	Plist=reparam(Pin,M,args.Min,dist_to_X2)

	#smooth
	Ps = smooth_DIM(Plist,args.smooth,M)

	Prep=zip(*Plist)
	PinT=zip(*Pin)
	PsT=zip(*Ps)