soft-matter / trackpy-examples

sample images, examples, and speed tests for trackpy
Other
21 stars 42 forks source link

Error in bubble tracking example #41

Open fayazr opened 7 years ago

fayazr commented 7 years ago

When I use:

tp.annotate(features[features.frame==id_example], img_example)

I get the following error:

AttributeError Traceback (most recent call last)

in () ----> 1 tp.annotate(features[features.frame==id_example], img_example) C:\Users\Fayaz\AppData\Local\Enthought\Canopy\User\lib\site-packages\pandas\core\generic.pyc in **getattr**(self, name) 2667 if name in self._info_axis: 2668 return self[name] -> 2669 return object.__getattribute__(self, name) 2670 2671 def **setattr**(self, name, value): AttributeError: 'DataFrame' object has no attribute 'frame'
tacaswell commented 7 years ago

In cell 7 the 'frame' column is added to the features.

https://github.com/soft-matter/trackpy-examples/blob/master/notebooks/custom-feature-detection.ipynb

What are the columns in your data frame?

charlesreid1 commented 6 years ago

(I know this question is a bit old, but hopefully this answer helps anyone running into this in the future.)

If the features dataframe is empty, you'll see this exception. This happened to me when I was trying to update the scikit-image interface; when I implemented the scikit-image method calls incorrectly, no features were detected, and the dataframe was empty. If you try

print(features)

and see that the dataframe is empty, that's what's causing the error. The fix is to make sure you're detecting features in each image. You can modify the loop over each frame to show the labeled features in the frame, to check what's going on.