def process_data(self): origin = parseDateTime(self.data[0][-1]) if not self.real_data: self.real_data.extend(self.data) self.real_data = zip(*self.real_data) self.real_data = [ list(data) for data in self.real_data] if not self.speed : self.real_data = self.real_data[1:] self.real_data[2] = [(origin - parseDateTime(str(date))).seconds/60 for date in self.real_data[-1]] # Lissage de la courbe self.real_data[0] = sg_filter.smooth(self.real_data[0],self.coeff) self.real_data[1] = sg_filter.smooth(self.real_data[1],self.coeff)
def positionToSpeed(self): """ Calcule une liste de vitesse depuis une liste de positions """ self.real_data = [] self.speed = True origin = parseDateTime(self.data[0][-1]) for i in xrange(1, len(self.data)): d = self.data[i-1] if d[1] < self.data[i][1] or d[2] < self.data[i][2]: continue date1 = parseDateTime(str(d[3])) date2 = parseDateTime(str(self.data[i][3])) times = (date1-date2).seconds self.real_data.append([ (d[1] - self.data[i][1])/times, (d[2] - self.data[i][2])/times, (origin-date1).seconds/60 ])