# The normalized cross-correlation of two signals

I wanted to calculate the normalized cross-correlation function of two signals.

I use the command corr = signal.correlate((s1['Strain']-s1['Strain'].mean())/s1['Strain'].std(), (s2['Strain']-s2['Strain'].mean())/s2['Strain'].std(), mode='full') / len(s1['Strain'])

Both signals have the same length, 30 seconds length and 4096 Hz sampling. s1 and s2 are the GW150914 enter link description here

Here is example data

s1:

Strain
0        -1.587702e-22
1        -1.425868e-22
2        -1.174897e-22
3        -8.559119e-23
4        -4.949480e-23
.             .
.             .
.             .


I didn't get the normalized cross-correlation, the maximum value is 0.04 in range $$[-1;1]$$. Where is mistake?

• Do you get a value of 1 when you correlate a signal with (a scales version of) itself? Then your normalization is correct and the 0.04 just means that s1 and s2 are not very correlated. – Florian Aug 6 at 7:24
• On the page 6, Fig. 3 there is a cross-correlation (blue one). It's written that it is whitened. I filtered the signal but not whitened. How to whiten using scipy? – Malum Wolfram Aug 7 at 1:06