コード例 #1
0
ファイル: findNewStart.py プロジェクト: r-hong/CodeStringOTF
				string.append([xc,yc,zc])
		else:
			a=1
		if (not string):
			a=1
		else:
			allstrings.append(string)

	#get the mean string from a group of strings
	v1,v2,v3=getMeanString(allstrings)
	vecn=[v1,v2,v3]
	vecz=zip(*vecn)
	vec_array=np.asarray(vecz)

	#reparametrize the mean string
	meanD,totD=dm_vec(vecz,args.Mout)
	vecr1=reparam(vec_array,DIM,args.Mout,meanD)
	vecr2=zip(*vecr1)
	#############################################################
	#Saving the reparametrized center of mass (COM) coordinates
	##formating the COMs###
	x=vecr2[0]
	y=vecr2[1]
	z=vecr2[2]
	x1=[]
	y1=[]
	z1=[]
	for i in range(args.Mout):
		a= ("{0:.4f}".format(float(x[i])))
		b= ("{0:.4f}".format(float(y[i])))
		c= ("{0:.4f}".format(float(z[i])))
コード例 #2
0
ファイル: pCurve.py プロジェクト: r-hong/CodeStringOTF
	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)

	# Iterations for N-dimensional case (3D visualization)
	#######################################################
	if (len(args.CV2plot)==3):
		fig = plt.figure()
		ax = fig.add_subplot(111,projection='3d')