示例#1
0
	d = float(re.search("rest length: (.+)\n", params).group(1))
	pt = float(re.search("pressure threshold: (.+)\n", params).group(1))
	mx = float(re.search("max x: (.+)\n", params).group(1))
	my = float(re.search("max y: (.+)\n", params).group(1))
	if args.c:
		steps = int(re.search("ca steps run: (.+)\n", params).group(1))
	else:
		steps = int(re.search("number of ca steps: (.+)\n", params).group(1))
	
	if args.ps > 0 and args.ps <= steps:
		steps = args.ps #plot only until requested frame
	else:
		steps += 1 #plot all states, including final state
			
	pl = Plotter(d, pt, folder)
	pl.setLims(mx, my)
	
	for i in xrange(steps):
		if args.c:
			try:
				filep = open(folder+"state"+str(i).zfill(4)+'.cs')
			except EnvironmentError:
				pl.next()
				continue
			with filep:
				x = np.array(filep.readline().split("; ")[:-1], dtype=float)
				y = np.array(filep.readline().split("; ")[:-1], dtype=float)
				s = np.array(filep.readline().split("; ")[:-1], dtype=float)
				v = np.array(filep.readline().split("; ")[:-1], dtype=float)
				neigh = filep.readline().split("; ")[:-1]
				nnlist = []