(self,field)
| 88 | # Calculate interpolated value of a given field based on |
| 89 | # current time |
| 90 | def interpolate(self,field): |
| 91 | first = self.history[self.index][field] |
| 92 | next = self.history[self.index+1][field] |
| 93 | first_t = self.history[self.index][3] |
| 94 | next_t = self.history[self.index+1][3] |
| 95 | try: |
| 96 | slope = (next - first)/(next_t-first_t) |
| 97 | return first + slope*(self.time - first_t) |
| 98 | except ZeroDivisionError: |
| 99 | return first |
| 100 | |
| 101 | # Update all computed values |
| 102 | def update(self): |