绘制引力波

本文通过使用Python中的NumPy和Matplotlib等库,读取并绘制了来自两个不同探测器(H1和L1)的引力波数据。同时,还展示了预定义的引力波模板信号。通过对这些信号进行可视化,可以直观地比较不同来源引力波的特点。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

(本文是北理工嵩天老师MOOK课程笔记之一)

# -*- coding:utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
from scipy.io import wavfile

rate_h,hstrain=wavfile.read(r"H1_Strain.wav","rb")
rate_l,lstrain=wavfile.read(r"L1_Strain.wav","rb")
reftime,ref_H1=np.genfromtxt('wf_template.txt').transpose()
hi=1/rate_h
li=1/rate_l

htime_len=hstrain.shape[0]/rate_h
htime=np.arange(-htime_len/2,htime_len/2,hi)
ltime_len=lstrain.shape[0]/rate_l
ltime=np.arange(-ltime_len/2,ltime_len/2,li)
fig=plt.figure(figsize=(12,6))

plth=fig.add_subplot(221)
plth.plot(htime,hstrain,'y')

pltl=fig.add_subplot(222)
pltl.plot(ltime,lstrain,'g')

pltt=fig.add_subplot(212)
pltt.plot(reftime,ref_H1)

fig.tight_layout()
plt.show()
plt.close(fig)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值