opensim-org / opensim-core

SimTK OpenSim C++ libraries and command-line applications, and Java/Python wrapping.
https://opensim.stanford.edu
Apache License 2.0
800 stars 323 forks source link

IIR filter triggers a resample even if file is uniformly sampled #3919

Open tkevinbest opened 1 month ago

tkevinbest commented 1 month ago

When selecting "filter input coordinates" in the ID tool, my IK data gets resampled even though it was output at a fixed frequency from the IK tool. The code here says it should only resample if the sampling is not uniform: https://github.com/opensim-org/opensim-core/blob/cbf9c74c065194dd4ac2d350bbd580a09a575848/OpenSim/Common/Storage.cpp#L2370. There appears to be something wrong with the machine precision check and determining whether or not the sampling is uniform.

I know that my data was resampled because it is a very long file, beyond the max size of the resampling function and thus my sampling rate drops substantially when resampling.

Version 4.5-2024-01-10-3b63585

nickbianco commented 1 month ago

@tkevinbest, thanks for reporting this issue. Would you mind posting a sample data file so we can create a minimum working example?

tkevinbest commented 1 month ago

The file is too big to upload, but I've shared it here: https://www.dropbox.com/scl/fi/7q9lcho6imbx7mbypurne/OpensimResampleTestCase.zip?rlkey=ajt3fxqzzw7w4t4ra31qq08hd&st=7x6w9uks&dl=0

mrrezaie commented 3 weeks ago

Hi @nickbianco, just wanted to say that I tested the files and received two warnings in addition to the machine precision check reported by @tkevinbest:

Hope this helps.