From c1504d4d71afcd0764bfbb51578ebed556f36aec Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@gmail.com>
Date: Tue, 21 Feb 2017 08:54:27 +0000
Subject: [PATCH] Added analysis options and analysis decorator

---
 trisurf/analyses.py |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/trisurf/analyses.py b/trisurf/analyses.py
index 7b061f2..4862867 100644
--- a/trisurf/analyses.py
+++ b/trisurf/analyses.py
@@ -1,6 +1,17 @@
 from . import trisurf
 
 
+def analysis(analysis_name='unnamed_analysis'):
+	"""Decorator for adding the analysis functions to function lists"""
+	def analysis_decorator(analysis_function):
+		trisurf._analysis_list[analysis_name]=analysis_function
+		def wrapper(*args, **kwargs):
+			analysis_function(*args,**kwargs)
+		return wrapper
+	return analysis_decorator
+
+
+@analysis('demo')
 def demo(run, **kwargs):
 	host=kwargs.get('host', None)
 	print("Demo analysis")
@@ -14,6 +25,7 @@
 
 
 # can be wrapped to specify scalar_field)
+@analysis('plotrunningavginteractive')
 def plotrunningavginteractive(run, scalar_field='vertices_idx', **kwargs):
 	import matplotlib.pyplot as plt
 	from trisurf import VTKRendering as vtk
@@ -48,7 +60,7 @@
 # -------------------------------
 # these functions should be wrapped
 # -------------------------------
-
+@analysis('plotColumnFromPostProcess')
 def plotColumnFromPostProcess(run, filename='data_tspoststat.csv', column='hbar', **kwargs):
 	import matplotlib.pyplot as plt
 

--
Gitblit v1.9.3