comparison python/moving.py @ 682:fbe29be25501 dev

corrected bug
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Fri, 05 Jun 2015 02:35:29 +0200
parents da1352b89d02
children 94b291a5f933
comparison
equal deleted inserted replaced
681:acce61a1edc8 682:fbe29be25501
1127 else: 1127 else:
1128 print('Object {} has no features loaded.'.format(self.getNum())) 1128 print('Object {} has no features loaded.'.format(self.getNum()))
1129 return None 1129 return None
1130 1130
1131 def getSpeeds(self, nInstantsIgnoredAtEnds = 0): 1131 def getSpeeds(self, nInstantsIgnoredAtEnds = 0):
1132 n = min(nInstantsIgnoredAtEnds, int(floor(self.length()/2.))) 1132 speeds = self.getVelocities().norm()
1133 return self.getVelocities().norm()[n:-n] 1133 if nInstantsIgnoredAtEnds > 0:
1134 n = min(nInstantsIgnoredAtEnds, int(floor(self.length()/2.)))
1135 return speeds[n:-n]
1136 else:
1137 return speeds
1134 1138
1135 def getSpeedIndicator(self): 1139 def getSpeedIndicator(self):
1136 from indicators import SeverityIndicator 1140 from indicators import SeverityIndicator
1137 return SeverityIndicator('Speed', {t:self.getVelocityAtInstant(t).norm2() for t in self.getTimeInterval()}) 1141 return SeverityIndicator('Speed', {t:self.getVelocityAtInstant(t).norm2() for t in self.getTimeInterval()})
1138 1142