[SciPy-User] calculate xcorr/acorr without plotting?

josef.pktd@gmai... josef.pktd@gmai...
Wed Jun 23 17:42:29 CDT 2010

On Wed, Jun 23, 2010 at 4:57 PM, David Ho <itsdho@ucla.edu> wrote:
> Hi all!
> Is there a way to calculate a cross-correlation (xcorr) or autocorrelation
> (acorr) without actually plotting a figure?
> For example, for histograms, I can use matplotlib.pyplot.hist() to plot a
> histogram, but I can also use numpy.histogram() if I just want to compute
> the values without plotting a figure.
> I'd like to do something similar for cross-correlations.

not directly, but it's just a few lines, that can be copied from the
source of matplotlib or statsmodels or several other packages

acov = numpy.correlate(x,x)/len(x)

see the thread "Autocorrelation function: Convolution vs FFT"  from
the last two days.

same works with xcorr


> Thanks for your help!
> --David Ho
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user

More information about the SciPy-User mailing list