Closed NYankee1927 closed 1 year ago
Hi, there is no function implemented in ldparser, but I did that somewhere else. Essentially, you don't need an extra list holding time, you only need the length of the data. If a channel has double the samplerate, it has double the data... So, in order to get channs[1].data with the samplerate of channs[0].data, you can do s.t. like this:
n0 = len(channs[0].data)
n = len(channs[1].data)
x = np.arange(0, n, n / n0)
data = np.interp(x, np.arange(0, n), channs[1].data)
len(channs[0].data) == len(data)
Not sure if it's the best approach though, but it works for me ;)
There are also more 'advanced' methods to resample data, like
from scipy import signal
data = signal.resample(channs[1].data, n0)
but I think, this method is overkill for our kind of data, and it takes quite long ....
This answer is great. I was unsure about the underlying assumption that the data is sync'd and I could use the sample rate to fix it.
Well, don't take my word for it ;) But that's how it appears to be in the data I saw so far. Also, you can check if the assumption holds by doing n/channs[1].freq == n0/channs[0].freq
. This shows that the data covers the same timespan and I guess it's save to assume that the acquisition of the data started in sync...
Hello, This tool is incredibly helpful. I'm struggling with understanding how I can sync multiple channels with different sample rates. I'm thinking of a time based list that is included with each channel. Then I can use that to sync the channels with higher and lower sample rates. I may have missed it, but is there anything like this?