本文整理匯總了Python中Filter.generate_template方法的典型用法代碼示例。如果您正苦於以下問題:Python Filter.generate_template方法的具體用法?Python Filter.generate_template怎麽用?Python Filter.generate_template使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Filter
的用法示例。
在下文中一共展示了Filter.generate_template方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: tesana
# 需要導入模塊: import Filter [as 別名]
# 或者: from Filter import generate_template [as 別名]
#.........這裏部分代碼省略.........
np.savetxt('%s-avgpulse-power.dat' % session, np.vstack((np.arange(len(avgps))*df, avgps)).T,
header='Frequency (Hz), Average Pulse Power (%s/srHz)' % ('R' if Rspace else ('A' if gain else 'V')), delimiter='\t')
if plotting:
avgps[0] = 0 # for better plot
figure()
plot(np.arange(len(avgps))*df, avgps)
loglog()
xlabel('Frequency$\quad$(Hz)')
ylabel('Average Pulse Power$\quad$(%s/Hz)' % ('R' if Rspace else ('A' if gain else 'V')))
tight_layout()
savefig('%s-avgpulse-power.pdf' % session)
if n.size > 0:
# Plot noise spectrum
avgns = np.sqrt(Filter.average_noise(n) / df)
if savedat:
np.savetxt('%s-noise.dat' % session, np.vstack((np.arange(len(avgns))*df, avgns)).T,
header='Frequency (Hz), Noise (%s/srHz)' % ('R' if Rspace else ('A' if gain else 'V')), delimiter='\t')
if plotting:
avgns[0] = 0 # for better plot
figure()
plot(np.arange(len(avgns))*df, avgns)
loglog()
xlabel('Frequency$\quad$(Hz)')
ylabel('Noise$\quad$(%s/$\sqrt{\mathrm{Hz}}$)' % ('R' if Rspace else ('A' if gain else 'V')))
tight_layout()
savefig('%s-noise.pdf' % session)
if p.size > 0 and n.size > 0:
# Generate template
tmpl, sn = Filter.generate_template(p, n, lpfc=lpfc, hpfc=hpfc, nulldc=nulldc, max_shift=max_shift)
if savedat:
np.savetxt('%s-template.dat' % session, np.vstack((t, tmpl)).T,
header='Time (s), Template (A.U.)', delimiter='\t')
np.savetxt('%s-sn.dat' % session, np.vstack((np.arange(len(sn))*df, sn/np.sqrt(df))).T,
header='Frequency (Hz), S/N (/srHz)', delimiter='\t')
if plotting:
# Plot template
figure()
plot(t, tmpl)
xlabel('Time$\quad$(s)')
ylabel('Template$\quad$(A.U.)')
tight_layout()
savefig('%s-template.pdf' % session)
# Plot SNR
figure()
plot(np.arange(len(sn))*df, sn/np.sqrt(df))
loglog()
xlabel('Frequency$\quad$(Hz)')
ylabel('S/N$\quad$(/$\sqrt{\mathrm{Hz}}$)')
tight_layout()
savefig('%s-sn.pdf' % session)
# Calculate baseline resolution
print "Resolving power: %.2f (%.2f eV @ 5.9 keV)" % (np.sqrt((sn**2).sum()*2), Analysis.baseline(sn))
# Perform optimal filtering
pha_p = Filter.optimal_filter(p, tmpl, max_shift=max_shift)
pha_n = Filter.optimal_filter(n, tmpl, max_shift=0)