-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Investigate behaviour of .mat
logger saving
#406
Comments
Yes, this behaviour is defined by setting the
Concerning this behavior, before investigating if its something specific of the logger device implemented in |
Maybe what is happening is that the autosave happens while the data is being added to the buffer in https://github.com/robotology/wearables/blob/f80dd5078d467535d01563dd9a41e2955e6b43b2/wrappers/IWearLogger/src/IWearLogger.cpp#L262-L792 If the |
Thanks @S-Dafarra, this is definitively something that can happen if there is nothing that force the channels to have the same amount of data (and for a general usage of Following this assumption, however, I would expect the difference to be a single data sample. However, in @claudia-lat dataset the difference seems to be of multiple samples. Am I correct @claudia-lat? |
Yes @lrapetti. I would go for a practical example. In an acquisition in which |
How different? |
Having multiple .mat files is not an ideal solution, in the past, we started investigating the possibility of implementing a collector/daemon, but we didn't do much in that sense: It is a while that I don't touch the |
@S-Dafarra very few samples (around maximum 10) |
Can you specify the exact number of data points for a couple of channels in two consecutive files? |
Ok @S-Dafarra . For the sake of simplicity I'm now considering an acquisition example with 2
and please note that even between the same node values are not equal. |
I checked the code of Let's suppose we have 5 channels and we push in the order 1, 2, 3, 4, 5. At the same time, we save in a different order, let's say 4, 3, 1, 5, 2. Let's also assume that as soon as one mutex gets unlocked, the other channels can be pushed before another mutex gets locked. Let's suppose we start saving when each channel has 10 elements. We would have the following Cycle 11: push -> 11 Cycle 21: push -> 12 Cycle 31: save (12) Cycle 41: push -> 1 Cycle 51: push -> 2 This might explain the difference between channels. I would expect a difference between channels at most equal to the number of channels. If less, it means that two channels get saved in the same push loop. If more, it could indicate that the thread that saves to file goes in starvation, i.e. the What is the maximum difference of data points compared to the number of channels? Thinking about it, this could lead to data loss if we reach the limit of the circular buffer we use to save channels (old data get overwritten), specified in https://github.com/robotology/wearables/blob/f80dd5078d467535d01563dd9a41e2955e6b43b2/wrappers/IWearLogger/src/IWearLogger.cpp#L918-L925 |
Recently I found a strange behaviour in the
.mat
logger. If the acquisition is longer than a fixed interval (probably hardcoded in the code with an autosaving function), the logger split into several.mat
files the acquisitions. Actually the problem doesn't lie on this aspect. The problem lies on the fact that all the fields inside the.mat
struct are consistent only in the case in which the acquisition consists of one file, i.e, all the elements are the same number of samples and the same timestamp. When the acquisition is split into two or more.mat
, elements inside each struct are no longer consistent, i.e., they have different number of samples and timestamps do no coincide.A patch solution for me was to concatenate all the
.mat
files and I've verified that, after concatenation, both number of samples and timestamps coincide.The text was updated successfully, but these errors were encountered: