# How to normalize output of $\tt scipy.signal.correlate$

I have 2 different signals and I'm trying to cross-correlate then using Python 2.7 and scipy.signal.correlate. How do I normalize my results (such that the max amplitude is 1.0? I tried the following:

import numpy as np
import matplotlib.pyplot as plt

t = np.linspace(0,2*np.pi,num=1000)
x1 = 10*np.sin(2*np.pi*t)
x2 = np.sin(2*np.pi*t+np.pi/2)
x12 = scipy.signal.correlate(x1,x2,'full')
plt.plot(x12)


results in the following plot

• x12 / np.max(x12) ? – Pier-Yves Lessard May 25 '17 at 2:40
• – Trevor Boyd Smith Jan 4 '19 at 16:20

When you say normalized cross-correlation I guess you mean the Pearson correlation. Anyways you just divide the cross correlation by the multiplication of the std(standard deviation) of both signal, or more conveniently: $\rho_{xy} =\frac{<x,y>}{\sigma_x\sigma_y}$
x1 = x1/x1.std()