Beispiel #1
0
	def csv_text(self):
		path = cp_data.join_data_dir(self.orig_filename())
		try:
			f = open(path)
		except:
			f = open(path,'w')
			tf = File(f)
			f = open(path)

		return f.read()
Beispiel #2
0
	def estimate(self):
		try:
			# load in as CSV
			data = numpy.genfromtxt(cp_data.join_data_dir(self.orig_filename()), delimiter = ',', skip_header=1)
			# run estimator
			ns, est = cp_data.run_estimator(data[:,0],data[:,1])
			# write the zipped results to output file
			cp_data.write_output_file(self.est_filename(),zip(ns,est))

			self.status = "E"
		except Exception, e:
			print e
			self.status = "PE"
Beispiel #3
0
	def set_csv_from_upload(self,data):
		static_file_path = cp_data.join_data_dir(self.orig_filename())
		with open(static_file_path, 'wb+') as destination:
			for chunk in data.chunks():
				destination.write(chunk)
		self.estimate()
Beispiel #4
0
	def set_csv_text(self, text):
		path = cp_data.join_data_dir(self.orig_filename())
		f = file(path,'w')
		f.write(text)
		f.flush()
		self.estimate()