soft-matter / trackpy

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

'size' and 'ep' not given per dimension if diameter is the same in all dimensions #716

Open MaartenBransen opened 1 year ago

MaartenBransen commented 1 year ago

When specifying the diameter as integer in trackpy.locate (using characterize=True), the resulting dataframe has one 'size' and one 'ep' column. When specifying the feature_size as tuple the resulting dataframe has columns for the sizes and errors in each dimension ( 'size_x', 'size_y', etc), except when all values in the tuple are the same.

To me there is a semantic difference between

trackpy.locate(data,diameter=15)

and

trackpy.locate(data,diameter=(15,15,15))

and I would the latter to behave identically to for example

trackpy.locate(data,diameter=(15,15,13))

except of course using a smaller size. I usually specify sizes in physical units which are then converted to sizes in pixels for trackpy, and now have to explicitly check that I'm not passing a tuple where all sizes are the same, otherwise my code fails later on because of this edge case. Furthermore, it is now not possible as far as I am aware to calculate sizes per dimension while using a feature size that is the same in all dimensions, forcing me to sometimes use a sub-optimal diameter in one dimension to be able to filter on certain size ratios.

Is this the desired behaviour? It seems to me more logical to always calculate these parameters per dimension when passing a tuple, and for all dimensions simultaneously when passing a single value for diameter.