当前位置: 首页>>代码示例>>Python>>正文


Python TimeSeries.spectrogram2方法代码示例

本文整理汇总了Python中gwpy.timeseries.TimeSeries.spectrogram2方法的典型用法代码示例。如果您正苦于以下问题:Python TimeSeries.spectrogram2方法的具体用法?Python TimeSeries.spectrogram2怎么用?Python TimeSeries.spectrogram2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gwpy.timeseries.TimeSeries的用法示例。


在下文中一共展示了TimeSeries.spectrogram2方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: zip

# 需要导入模块: from gwpy.timeseries import TimeSeries [as 别名]
# 或者: from gwpy.timeseries.TimeSeries import spectrogram2 [as 别名]
 new_freqs = []
 for time, snr, freq in zip(times, snrs, freqs):
     if time > st and time < st + t:
         new_times.append(time)
         new_freqs.append(freq)
 if len(new_times) == 0:
     st += t
     continue
 connection = datafind.GWDataFindHTTPConnection()
 cache = connection.find_frame_urls(
     'L', 'L1_C', st, st + t, urltype='file')
 data = TimeSeries.read(cache, channel, st, st + t)
 data2 = detrend(data)
 data = TimeSeries(
     data2, dx=data.dx, sample_rate=data.sample_rate, x0=data.x0)
 specgram = data.spectrogram2(fftlength=.1, overlap=0.1 * 0.9)
 specgram = specgram.ratio('median')
 plot = specgram.plot(vmin=1, vmax=10, norm='log')
 plot.add_colorbar(label='amplitude relative to median')
 ax = plot.gca()
 ax.set_ylim(40, 7e4)
 ax.set_yscale('log')
 # ax.scatter(new_times,new_freqs,'x',color='r')
 for time, freq in zip(new_times, new_freqs):
     ax.scatter(time, freq, marker='x', color='r', s=160)
 ax.set_title('expect %d triggers' % (len(new_times)))
 plotfile = '%s/%s/%s/%d/%d' % (dir2, extra_dir,
                                channel.replace(':', '/'), st, et)
 plot.savefig(plotfile)
 print 'saved specgrams/%s-SPEC-%d-%d' % (channel.replace(':', '-'),
                                          st, et)
开发者ID:pmeyers279,项目名称:online_whistle_monitor,代码行数:33,代码来源:plot_specgrams.py


注:本文中的gwpy.timeseries.TimeSeries.spectrogram2方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。