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