[Numpy-discussion] help using np.correlate to produce correlograms.
sjm.guzman at gmail.com
Wed Dec 10 15:40:32 EST 2014
thank you very much for your time to correct my notebook and to point me
in the direction of my wrong lag estimation. It has been very useful!
On 09/12/14 17:23, Pierre Haessig wrote:
> Le 08/12/2014 22:02, Jose Guzman a écrit :
>> I'm trying to compute the cross correlation and cross correlograms from
>> some signals. For that, I'm testing first np.correlate with some
>> idealized traces (sine waves) that are exactly 1 ms separated from each
>> other. You can have a look here:
>> Unfortunately I am not able to retrieve the correct lag of 1 ms for the
>> option 'full'. Strange enough, if I perform an autocorrelation of any of
>> the signals,I obtain the correct value for a lags =0 ms. I' think I'm
>> doing something wrong to obtain the lags.
> I looked at your Notebook and I believe that you had an error in the
> definition of the delay. In you first cell, you were creating of delay
> of 20ms instead of 1ms (and because the sine is periodic, this was not
> In addition, to get a good estimation of the delay with cross
> correlation, you need many perdiods.
> Here is a modification of your notebook :
> I've updated the delay definition and the number of periods.
> Finally, you may be able to automate a bit your plot by using
> matplotlib's xcorr (which uses np.correlate)
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
More information about the NumPy-Discussion