Ejemplo n.º 1
0
		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 = []
				for n in neigh:
					nnlist.append(set(n[1:-1].split(",")[:-1]))
			pl.setupFromArrays(x, y, s, v)
		else:
			try:
				filep = open(folder+"step"+str(i).zfill(4)+'.cs')
			except EnvironmentError: