示例#1
0
    0.40020915
])

#C
#fqL = np.array([0.0049999999, 0.018619375, 0.044733049,
#                0.069336227, 0.10747115, 0.16658029,
#                0.25819945, 0.40020915])

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, color="black")

ref_psd = p1
ref_psd_err = p1e

t2, l2, l2e = np.loadtxt(echo_file).T
# errorbar(t1, l1, yerr=l1e, fmt='o', color="green")
# errorbar(t2, l2, yerr=l2e, fmt='o', color="black")

P2 = clag.clag('psd10r', [t2], [l2], [l2e], dt, fqL)
p2 = np.ones(nfq)
p2, p2e = clag.optimize(P2, p2)
nfq = len(fqL) - 1
fqd = 10**(np.log10((fqL[:-1] * fqL[1:])) / 2.)

## load the first light curve
lc1_time, lc1_strength, lc1_strength_err = np.loadtxt(args[0], skiprows=1).T

# for pylab: errorbar(t1,l1,yerr=l1e,fmt='o')

# Used throughout

## initialize the psd class for multiple light curves ##
P1 = clag.clag('psd10r', [lc1_time], [lc1_strength], [lc1_strength_err], dt,
               fqL)
ref_psd = np.ones(nfq)
ref_psd, ref_psd_err = clag.optimize(P1, ref_psd)
ref_psd, ref_psd_err = clag.errors(P1, ref_psd, ref_psd_err)

## plot ##
#xscale('log'); ylim(-4,2)
#errorbar(fqd, ref_psd, yerr=ref_psd_err, fmt='o', ms=10)

# Load second light curve
lc2_time, lc2_strength, lc2_strength_err = np.loadtxt(args[1], skiprows=1).T
P2 = clag.clag('psd10r', [lc2_time], [lc2_strength], [lc2_strength_err], dt,
               fqL)
echo_psd = np.ones(nfq)
echo_psd, echo_psd_err = clag.optimize(P2, echo_psd)
echo_psd, echo_psd_err = clag.errors(P2, echo_psd, echo_psd_err)

### Now the cross spectrum ###
### We also give it the calculated psd values as input ###