新建
Gravitational Wave Open Science Center data analysis¶
wenh@dp.tech
推荐镜像 :Basic Image:bohrium-notebook:2023-04-07
推荐机型 :c2_m4_cpu
赞
目录
Gravitational Wave Open Science Center data analysis
代码
文本
📖 上手指南/Introduction
本文档可在 Bohrium Notebook 上直接运行。你可以点击界面上方按钮 开始连接,选择 bohrium-notebook:2023-04-07 基础镜像及任意节点配置(无需GPU),稍等片刻即可运行。
代码
文本
SET PARAMETERS: Detector and GPS time
代码
文本
[1]
# -- Set a GPS time:
t0 = 1126259462.4 # -- GW150914
#-- Choose detector as H1, L1, or V1
detector = 'H1'
代码
文本
You might try some of these examples times in the H1 detector:
t0 = 1126259462.4 # -- GW150914
t0 = 1187008882.4 # -- GW170817
t0 = 933200215 # -- Loud hardware injection
t0 = 1132401286.33 # -- Koi Fish Glitch
代码
文本
Import some packages
代码
文本
[2]
import requests, os
import matplotlib.pyplot as plt
%config InlineBackend.figure_format = 'retina'
try:
from gwpy.timeseries import TimeSeries
except:
! pip install -q "gwpy==3.0.4"
! pip install -q "matplotlib==3.5.1"
from gwpy.timeseries import TimeSeries
代码
文本
Query and download data file
代码
文本
[3]
from gwosc.locate import get_urls
url = get_urls(detector, t0, t0)[-1]
print('Downloading: ' , url)
fn = os.path.basename(url)
with open(fn,'wb') as strainfile:
straindata = requests.get(url)
strainfile.write(straindata.content)
代码
文本
Plot the raw time-series data
代码
文本
[3]
# -- Read strain data
strain = TimeSeries.read(fn,format='hdf5.gwosc')
center = int(t0)
strain = strain.crop(center-16, center+16)
fig1 = strain.plot()
代码
文本
Plot the ASD
代码
文本
[12]
# -- Plot ASD
fig2 = strain.asd(fftlength=8).plot()
plt.xlim(10,2000)
plt.ylim(1e-24, 1e-19)
代码
文本
Whiten and band-pass the data
代码
文本
[6]
# -- Whiten and bandpass data
white_data = strain.whiten()
bp_data = white_data.bandpass(30, 400)
fig3 = bp_data.plot()
plt.xlim(t0-0.2, t0+0.1)
代码
文本
Plot a q-transform of the data
代码
文本
[9]
dt = 1 #-- Set width of q-transform plot, in seconds
hq = strain.q_transform(outseg=(t0-dt, t0+dt))
fig4 = hq.plot()
ax = fig4.gca(color = 'rainbow')
fig4.colorbar(label="Normalized energy")
ax.grid(False)
ax.set_yscale('log')
代码
文本
点个赞吧
推荐阅读
公开
浙大暑期学校——从 DFT 到 MD|超详细「深度势能」材料计算上手指南Letian
更新于 2024-08-27
5 赞1 转存文件
公开
从 DFT 到 MD|超详细「深度势能」材料计算上手指南MileAway
更新于 2024-07-02
84 赞228 转存文件36 评论