soft-matter / trackpy

Python particle tracking toolkit
http://soft-matter.github.io/trackpy
Other
441 stars 131 forks source link

link_strategy explanation #712

Closed Ciro1990 closed 1 year ago

Ciro1990 commented 1 year ago

Hi there,

I have tried to find an explanation for the different link_strategy options, however I have managed to find only this:

link_strategy : {'recursive', 'nonrecursive', 'hybrid', 'numba', 'drop', 'auto'}
    algorithm used to resolve subnetworks of nearby particles
    'auto' uses hybrid (numba+recursive) if available
    'drop' causes particles in subnetworks to go unlinked

Could you help me find the right documentation for such feature or explain me what effect has each option?

One more question. I have found on Wikipedia the theory behind K-tree and B-tree. However, it is not clear when it is more convenient to adopt the first or the latter method. Could you clarify this, please?

Thanks a lot for the support! Ciro

nkeim commented 1 year ago

Look at the "Advanced Linking" and "Performance" tutorials to understand what subnetworks are and how we try to speed them up. All of the link_strategy options except 'drop' implement the same algorithm and are tested to have the same results; they are just implemented/optimized differently. Avoid drop unless you want trackpy to throw out subnetworks instead of trying to solve them.

With few exceptions, you should use a K-tree even if you suspect a B-tree may be more appropriate for your data. The reason is that scipy's K-tree implementation is highly optimized (and written in C). Of course you can always try each and see which one is faster for you.

Ciro1990 commented 1 year ago

Thanks a lot for the explanation!