Mercurial Hosting > traffic-intelligence
comparison python/moving.py @ 727:c6d4ea05a2d0
adding ability to deal with multivariate indicators
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Mon, 10 Aug 2015 01:06:59 -0400 |
parents | 43ae3a1af290 |
children | 15ddc8715236 |
comparison
equal
deleted
inserted
replaced
726:43ae3a1af290 | 727:c6d4ea05a2d0 |
---|---|
76 elif self.last < interval2.first: | 76 elif self.last < interval2.first: |
77 return interval2.first - self.last | 77 return interval2.first - self.last |
78 else: | 78 else: |
79 return None | 79 return None |
80 | 80 |
81 def unionIntervals(intervals): | 81 @classmethod |
82 'returns the smallest interval containing all intervals' | 82 def unionIntervals(cls, intervals): |
83 inter = intervals[0] | 83 'returns the smallest interval containing all intervals' |
84 for i in intervals[1:]: | 84 inter = cls(intervals[0].first, intervals[0].last) |
85 inter = Interval.union(inter, i) | 85 for i in intervals[1:]: |
86 return inter | 86 inter = cls.union(inter, i) |
87 return inter | |
87 | 88 |
88 | 89 |
89 class TimeInterval(Interval): | 90 class TimeInterval(Interval): |
90 '''Temporal interval: set of instants at fixed time step, between first and last, included | 91 '''Temporal interval: set of instants at fixed time step, between first and last, included |
91 | 92 |