Closed hadim closed 10 years ago
true_trajs = data.brownian_trajectories_generator(p_disapear=0.1) #true_trajs = data.brownian_trajs_df() solver = ByFrameSolver.for_brownian_motion(true_trajs, max_speed=5) trajs = solver.track(progress_bar=False)
--------------------------------------------------------------------------- KeyError Traceback (most recent call last) <ipython-input-81-49ddb70622eb> in <module>() 3 4 solver = ByFrameSolver.for_brownian_motion(true_trajs, max_speed=5) ----> 5 trajs = solver.track(progress_bar=False) /home/hadim/Insync/Documents/phd/dev/scikit-tracker/sktracker/tracker/solver/by_frame_solver.py in track(self, progress_bar, progress_bar_out) 96 print_progress(progress, message=message, out=progress_bar_out) 97 ---> 98 self.one_frame(t_in, t_out) 99 100 if progress_bar: /home/hadim/Insync/Documents/phd/dev/scikit-tracker/sktracker/tracker/solver/by_frame_solver.py in one_frame(self, t_in, t_out) 119 pos_out = self.pos_out 120 --> 121 self.link_block = LinkBlock(pos_in, pos_out, self.link_cf) 122 self.birth_block = DiagBlock(pos_out, self.birth_cf) 123 self.death_block = DiagBlock(pos_in, self.death_cf) /home/hadim/Insync/Documents/phd/dev/scikit-tracker/sktracker/tracker/matrices/matrices.py in __init__(self, objects_in, objects_out, cost_function) 244 self.mat = None 245 --> 246 self._build() 247 248 def _build(self): /home/hadim/Insync/Documents/phd/dev/scikit-tracker/sktracker/tracker/matrices/matrices.py in _build(self) 250 """ 251 --> 252 self.mat = self.cost_function.build(self.objects_in, self.objects_out) 253 254 if self.mat.shape != (len(self.objects_in), /home/hadim/Insync/Documents/phd/dev/scikit-tracker/sktracker/tracker/cost_function/brownian.py in build(self, pos_in, pos_out) 62 pos_out[coords].astype(np.float), 63 metric=distance_metric) ---> 64 dt = pos_out['t'][0] - pos_in['t'][0] 65 distances /= dt 66 distances[distances > max_speed] = np.nan /home/hadim/.virtualenvs/st/lib/python3.3/site-packages/pandas/core/series.py in __getitem__(self, key) 489 def __getitem__(self, key): 490 try: --> 491 result = self.index.get_value(self, key) 492 if isinstance(result, np.ndarray): 493 return self._constructor(result,index=[key]*len(result)).__finalize__(self) /home/hadim/.virtualenvs/st/lib/python3.3/site-packages/pandas/core/index.py in get_value(self, series, key) 1030 1031 try: -> 1032 return self._engine.get_value(s, k) 1033 except KeyError as e1: 1034 if len(self) > 0 and self.inferred_type == 'integer': /home/hadim/.virtualenvs/st/lib/python3.3/site-packages/pandas/index.cpython-33m.so in pandas.index.IndexEngine.get_value (pandas/index.c:2661)() /home/hadim/.virtualenvs/st/lib/python3.3/site-packages/pandas/index.cpython-33m.so in pandas.index.IndexEngine.get_value (pandas/index.c:2476)() /home/hadim/.virtualenvs/st/lib/python3.3/site-packages/pandas/index.cpython-33m.so in pandas.index.IndexEngine.get_loc (pandas/index.c:3215)() /home/hadim/.virtualenvs/st/lib/python3.3/site-packages/pandas/hashtable.cpython-33m.so in pandas.hashtable.Int64HashTable.get_item (pandas/hashtable.c:6450)() /home/hadim/.virtualenvs/st/lib/python3.3/site-packages/pandas/hashtable.cpython-33m.so in pandas.hashtable.Int64HashTable.get_item (pandas/hashtable.c:6394)() KeyError: 0
Try to isolate and reproduce the bug. Then ask on stackoverflow what could cause this.