I have an array of traces that are look like this :
Really small low part then a big High part and ended with low part again.
I want to be able to align all those traces ... as close as I can (so the changes from low to high and the opposite will be at the same indexes).
I tried to use cross-correlation but that gave me 0 offset ... I don't know why.
def give_offset(y,y2):
# limit your signal length to speed things up
lim = 2000
# do the actual correlation
corr = scipy.signal.correlate(y[:lim], y2[:lim], mode='full')
# The offset is the maximum of your correlation array,
# itself being offset by (lim - 1):
offset = np.argmax(corr) - (lim - 1)
return offset
I didn't find anything over the internet and I'm so confused since it seems like a common problem that many faced before.