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


Python TimeSeries.save_to_wav方法代码示例

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


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

示例1: highpass_fir

# 需要导入模块: from pycbc.types import TimeSeries [as 别名]
# 或者: from pycbc.types.TimeSeries import save_to_wav [as 别名]
from pycbc.frame import read_frame
from pycbc.filter import highpass_fir, lowpass_fir
from pycbc.psd import welch, interpolate
from pycbc.types import TimeSeries
import urllib

# Read data and remove low frequency content
fname = 'H-H1_LOSC_4_V2-1126259446-32.gwf'
url = "https://losc.ligo.org/s/events/GW150914/" + fname
urllib.urlretrieve(url, filename=fname)
h1 = highpass_fir(read_frame(fname, 'H1:LOSC-STRAIN'), 15.0, 8)

# Calculate the noise spectrum and whiten
psd = interpolate(welch(h1), 1.0 / 32)
white_strain = (h1.to_frequencyseries() / psd ** 0.5 * psd.delta_f).to_timeseries()

# remove some of the high and low frequencies
smooth = highpass_fir(white_strain, 25, 8)
smooth = lowpass_fir(white_strain, 250, 8)

#strech out and shift the frequency upwards to aid human hearing
fdata = smooth.to_frequencyseries()
fdata.roll(int(1200 / fdata.delta_f))
smooth = TimeSeries(fdata.to_timeseries(), delta_t=1.0/1024)

#Take slice around signal
smooth = smooth[len(smooth)/2 - 1500:len(smooth)/2 + 3000]
smooth.save_to_wav('gw150914_h1_chirp.wav')

开发者ID:a-r-williamson,项目名称:pycbc,代码行数:30,代码来源:audio.py


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