本文整理汇总了Python中Filter.average_noise方法的典型用法代码示例。如果您正苦于以下问题:Python Filter.average_noise方法的具体用法?Python Filter.average_noise怎么用?Python Filter.average_noise使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Filter
的用法示例。
在下文中一共展示了Filter.average_noise方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tesana
# 需要导入模块: import Filter [as 别名]
# 或者: from Filter import average_noise [as 别名]
#.........这里部分代码省略.........
avgp = Filter.average_pulse(p, max_shift=max_shift)
if savedat:
np.savetxt('%s-averagepulse.dat' % session, np.vstack((t, avgp)).T,
header='Time (s), Averaged Pulse (%s)' % ('R' if Rspace else ('A' if gain else 'V')), delimiter='\t')
if plotting:
figure()
plot(t, avgp)
xlabel('Time$\quad$(s)')
ylabel('Averaged Pulse$\quad$(%s)' % ('R' if Rspace else ('A' if gain else 'V')))
tight_layout()
savefig('%s-averagepulse.pdf' % session)
# Calculate averaged pulse spectrum
avgps = np.sqrt(Filter.power(avgp)) / df
if savedat:
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()