import numpy as np
import clag
%pylab inline
dt = 0.01
t1, l1, l1e = np.loadtxt('1367A.dat').T
errorbar(t1, l1, yerr=l1e, fmt='o')
A general rules for fqL is as follows:
fqd is the bin center
fqL = np.array([0.0049999999, 0.018619375, 0.044733049, 0.069336227, 0.10747115, 0.16658029,
0.25819945, 0.40020915, 0.62032418])
nfq = len(fqL) - 1
fqd = 10**(np.log10( (fqL[:-1]*fqL[1:]) )/2.)
P1 = clag.clag('psd10r', [t1], [l1], [l1e], dt, fqL)
p1 = np.ones(nfq)
p1, p1e = clag.optimize(P1, p1)
p1, p1e = clag.errors(P1, p1, p1e)
xscale('log'); ylim(-4,2)
errorbar(fqd, p1, yerr=p1e, fmt='o', ms=10)
t2, l2, l2e = np.loadtxt('3465A.dat').T
errorbar(t1, l1, yerr=l1e, fmt='o')
errorbar(t2, l2, yerr=l2e, fmt='o')
P2 = clag.clag('psd10r', [t2], [l2], [l2e], dt, fqL)
p2 = np.ones(nfq)
p2, p2e = clag.optimize(P2, p2)
xscale('log'); ylim(-6,2)
errorbar(fqd, p1, yerr=p1e, fmt='o', ms=10)
errorbar(fqd, p2, yerr=p2e, fmt='o', ms=10)
p2, p2e = clag.errors(P2, p2, p2e)
Cx = clag.clag('cxd10r', [[t1,t2]], [[l1,l2]], [[l1e,l2e]], dt, fqL, p1, p2)
p = np.concatenate( ((p1+p2)*0.5-0.3,p1*0+0.1) ) # a good starting point generally
p, pe = clag.optimize(Cx, p)
%autoreload
p, pe = clag.errors(Cx, p, pe)
phi, phie = p[nfq:], pe[nfq:]
lag, lage = phi/(2*np.pi*fqd), phie/(2*np.pi*fqd)
cx, cxe = p[:nfq], pe[:nfq]
xscale('log'); ylim(-10,10)
errorbar(fqd, lag, yerr=lage, fmt='o', ms=10)