Extraction of non-sinusiodal repetition rates
You are right that the repetition is around 650 by how exactly do I compute that automatically? Seems like a peak-picking problem to me? Or is there some other methods that can be used?


Yes, it's just peak-picking.  Your period is the x value of the first strong peak:



Your peaks are all similar in height, probably because you're doing the autocorrelation using the FFT?  So it's a circular autocorrelation.  You can 


make it non-circular by zero-padding before doing the FFT, or 
could skew the plot you currently have by adding a linear function that emphasizes the peaks close to 0 and reduce the height of the farther ones.


It depends on what you're specifically looking for.  In either case you then have to pick the highest peak that's not at 0 lag.  

I adapted my script from here and it (surprisingly) worked without any tweaking:



raw1 x = 709.23



raw2 x = 710.77

from pylab import *

# Import matlab files
import scipy.io
#sig = scipy.io.loadmat('raw1.mat')['raw1'][0]
sig = scipy.io.loadmat('raw2.mat')['raw2'][0]

# Calculate autocorrelation (same thing as convolution, but with
# one input reversed in time)
corr = fftconvolve(sig, sig[::-1], mode='full')

# throw away the negative lags, so x = 0 means 0 lag
corr = corr[len(corr)/2:]

# Find the first low point from derivative
d = diff(corr)
start = find(d &gt; 0)[0]

# Starting at the first low point, find the highest peak
peak = argmax(corr[start:]) + start

# Fit parabola to estimate more precise location of peak
px, py = parabolic(corr, peak)

plot(corr)
axvline(px, color='r')

print px


The variable peak is the integer x value at the peak (709).  Then the parabolic function fits a parabola to the peak and tries to get a more precise estimate (709.232...), which may or may not be relevant to what you're doing.

The python fftconvolve() function does zero-padding internally to produce a linear convolution, like convolve() does