import numpy as np
from matplotlib import mlab
ts = np.loadtxt('tseries12.txt')
ts0 = ts[0]
ts1 = ts[1]
NFFT = 256;
Fs = 1.0/1;
noverlap = NFFT/2
fxx, f = mlab.csd(ts0,ts0,NFFT=NFFT,Fs=Fs,noverlap=noverlap,
#detrend=mlab.detrend_mean,
scale_by_freq=True)
fxx = fxx.real
np.savetxt('fxx_python.txt',fxx)