soft-matter / trackpy

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

Fix Issue #772, alternative that doesn't affect imsd() but still correctly calculates weighted average for emsd() #774

Open vivarose opened 3 months ago

vivarose commented 3 months ago

My previous pull-request, https://github.com/soft-matter/trackpy/pull/773 included NaN output, which was intentional (and I believe it was correct!) but caused some tests to fail. [Edit: No, that is not what caused some tests to fail. They are still failing.]

This is a new version intended to calculate the emsd correctly in cases of particle gaps (missing data), but to avoid the NaN output. The trick is to set the number of effective measurements N to 0 in cases where there are zero effective measurements.