10101-00001 / sync_ident

Time series methods to identify synchronization intervals
5 stars 0 forks source link

Time lags after sync_ident all positive (mixture of positive and negative expected) #2

Open thekryz opened 3 years ago

thekryz commented 3 years ago

After applying sync_ident (WCLC) to my MEA files I end up with a number of *.mat files which - if I understand correctly - represent all found synchrony intervals. Each line contains time lag, start, endand mean R^2. What surprised me: All the time lag values are positive. I expected them to be partially positive (one person "leading" in the synchronous movement), and partially negative (the other person "leading"). Am I mistaken in my understanding or is this an error?

thekryz commented 3 years ago

Since I got no reply thus far, I went into debugging the issue. Apparently, the correlations for both lag directions (positive lag and negative lag) are calculated in compute_WCLC as R2_1 and R2_2. They are then merged into R2 with the duplicate row (at 0 lag) being purged from R2_1 by simply appending one to the other. The issue is as follows: Matlab now outputs the lag not as the actual lag, but as a number from 1 to 2*max_lag+1.

Here's an example for video with 60fps (which means a max_lag of 300 equals 5s of video): If the given max_lag is 300, R2 ranges from 1 to 601. The correct range, however, would be defined as -max_lag to +max_lag (e.g. -300 to +300). During the sync_ident process, the range doesn't seem to be corrected anywhere, which is why I end up with lag-values between 1 and 601. If I am not mistaken, I'll have to manually correct the lag by subtracting max_lag+1 (e.g. 301) for now when further dealing with the extracted synchrony data.