changeset 434:9a714f32fc9f

small updates
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Sat, 30 Nov 2013 18:03:35 -0500
parents d40ad901b272
children 17185fe77316
files python/pavement.py python/utils.py
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/python/pavement.py	Fri Nov 29 02:38:41 2013 -0500
+++ b/python/pavement.py	Sat Nov 30 18:03:35 2013 -0500
@@ -23,9 +23,8 @@
         plot(self.data['jours']/float(dayRatio), 
              self.data[measure], options, **kwargs)
 
-    def getMarkingMeasures(self, measure, ligneNum):
+    def getMarkingMeasures(self, dataLabel):
         from numpy import isnan
-        dataLabel = '{}_{}'.format(measure, ligneNum)
         nonZeroIndices = ~isnan(self.data[dataLabel])
         return self.data[nonZeroIndices]['jours'], self.data[nonZeroIndices][dataLabel]
 
--- a/python/utils.py	Fri Nov 29 02:38:41 2013 -0500
+++ b/python/utils.py	Sat Nov 30 18:03:35 2013 -0500
@@ -195,6 +195,12 @@
     else:
         return 0.
     
+def triangular(center, x, halfwidth):
+    diff = abs(center-x)
+    if diff<halfwidth:
+        return 1.-abs(diff/halfwidth)
+    else:
+        return 0.
 
 def argMaxDict(d):
     return max(d.iterkeys(), key=(lambda key: d[key]))