class AveragesCollector:

	def __init__(self, env, constants, grid):
		self._unc = UncertaintyMeter(env, constants, grid)
		self.times = []
		self.n1 = []
		self.n2 = []
		self.i = []

	def prepare(self, **kwds):
		self._unc.prepare(components=kwds['components'],
			ensembles=kwds['ensembles'], psi_type=kwds['psi_type'])

	def __call__(self, t, dt, psi):
		self.times.append(t)

		i, n = self._unc.getEnsembleSums(psi)

		self.i.append(i)
		self.n1.append(n[0])
		self.n2.append(n[1])

	def getData(self):
		return numpy.array(self.times), self.i, self.n1, self.n2
	def __init__(self, env, constants, grid):
		self._unc = UncertaintyMeter(env, constants, grid)
		self.times = []
		self.n1 = []
		self.n2 = []
		self.i = []