Size: 3751
Comment:
|
Size: 3891
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 6: | Line 6: |
GUIで拡大等をしたとき、他のaxesも一緒に動く。<<BR>> | |
Line 10: | Line 11: |
plot = Plot(l1hoft, h1hoft) | |
Line 73: | Line 73: |
[[https://qiita.com/simonritchie/items/da54ff0879ad8155f441|プロットの複雑なレイアウトはGridSpecが便利かも、という話]] [[https://bunseki-train.com/axvspan-and-axhspan/|matplotlibで一定区間に背景色をつける方法]] |
* [[https://qiita.com/simonritchie/items/da54ff0879ad8155f441|プロットの複雑なレイアウトはGridSpecが便利かも、という話]] * [[https://bunseki-train.com/axvspan-and-axhspan/|matplotlibで一定区間に背景色をつける方法]] * [[https://qiita.com/nkay/items/d1eb91e33b9d6469ef51|matplotlibのめっちゃまとめ]] |
Plotの描画関連
複数の時系列を縦に並べてplotする
ここに書いてある、gwpy.plotのPlot()がオススメ。
GUIで拡大等をしたとき、他のaxesも一緒に動く。
注意点は、TimeSeriesのlistやTimeSeriesDictを引数にしてまとめて渡した場合は separate=True をしても分割されないという謎仕様。面倒だが1つ1つ手で並べる必要がある。
戻り値 (ここでは plot)は、matplotlibのfigureだと思ってしまってよい。
なので、それぞれのy軸ラベルや全体のタイトルを付けるには以下のようにする。
時刻の基準を手で設定する
ここを参照
DQ Flagを添える
.add_segments_bar() を使う(ここを参照)。
他にも .add_state_segments() や .add_dataqualityflag() といった似たものがある。詳細はPlotting APIを参照。
スペクトルのパーセンタイル/σバンドを付ける
ここを参照。手順としては、
まずTimeSeriesからspectrogram2()を使ってnon-averaged power Spectrogramを作る。
- .percentile() でパーセンタイルのスペクトルを3つ作る。
- plot_mmm() で描画するとバンド付きでplotされる。
1 from gwpy.timeseries import TimeSeries
2 from gwpy.plot import Plot
3
4 hoft = TimeSeries. ...
5 sg = hoft.spectrogram2(fftlength=4, overlap=2, window='hanning') ** (1/2.)
6 median = sg.percentile(50)
7 low = sg.percentile(5)
8 high = sg.percentile(95)
9
10 plot = Plot()
11 ax = plot.gca(xscale='log', xlim=(10, 1500), xlabel='Frequency [Hz]', yscale='log', ylim=(3e-24, 2e-20), ylabel=r'Strain noise [1/$\sqrt{\mathrm{Hz}}$]')
12 ax.plot_mmm(median, low, high, color='gwpy:ligo-hanford')
13 ax.set_title('LIGO-Hanford strain noise variation around GW170817', fontsize=16)
14 plot.show()
パーセンタイルではなくmeanとσで表したい場合は、Spectrogramの2次元配列に対して時間軸(0軸)方向にmean, stdを取ればよい。