changeset 313:43e62b9cb652

solved issues to make the files importable (caution with getDLCSS)
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Thu, 11 Apr 2013 22:50:04 -0400
parents 6c068047edbf
children c5518a35df5f
files python/indicators.py
diffstat 1 files changed, 10 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/python/indicators.py	Thu Apr 11 22:46:33 2013 -0400
+++ b/python/indicators.py	Thu Apr 11 22:50:04 2013 -0400
@@ -105,17 +105,18 @@
         return values
 
     @staticmethod
-	def getDLCSS(TemporalIndicator1,TemporalIndicator2, threshold, delta= np.inf , method='min' ):
+    def getDLCSS(indic1, indic2, threshold, delta = float('inf') , method ='min' ):
 	''' compute the distance between two indicators using LCSS
 	two common methods are used: min or mean of the indicators length'''
-        l1= TemporalIndicator1.valueSorted
-		l2= TemporalIndicator2.valueSorted
-		if method = 'min':
-			DLCSS= 1- (LCSS(l1,l2, threshold, delta, distance))/min(len(l1),len(l2)))
-		if method = 'mean':
-			average= len(l1)+len(l2))/2
-			DLCSS= 1- ((LCSS(l1,l2, threshold, delta, distance))/average)
-		return DLCSS
+        l1 = indic1.valueSorted
+        l2 = indic2.valueSorted
+        DLCSS = None
+        if method == 'min':
+            DLCSS = 1- (LCSS(l1,l2, threshold, delta, distance))/min(len(l1),len(l2))
+        if method == 'mean':
+            average = len(l1)+len(l2)/2
+            DLCSS = 1- ((LCSS(l1,l2, threshold, delta, distance))/average)
+        return DLCSS
 		
 
 def computeDLCSS(indicator1, indicator2, threshold, delta = float('inf'), method= 'min'):