簡體   English   中英

使用 Obspy 和 Spectrogram 功能,如何限制我的 Y 軸

[英]Using Obspy and the Spectrogram function, how can I limit my Y axis

我正在使用 obspy 來查看一些水聲數據,我需要將數據視為頻譜圖。 頻譜圖似乎還可以,但我想在 y=100 標記附近切斷我的情節的頂部(靠近奈奎斯特)。 我在弄清楚如何限制 y 軸時遇到了很多麻煩。 有人可以提供一些見解嗎?

我的代碼在下面,倒數第二個: fig.axes[0].set_ylim(0,100)我覺得應該可以工作,但我收到一條錯誤消息,說“list”對象沒有屬性“axes”。

import obspy
from obspy.clients.fdsn import Client
from obspy.imaging.spectrogram import spectrogram
client = Client("IRIS")
from obspy import UTCDateTime
import numpy as np
import matplotlib.pyplot as plt



# Retrieve waveform data
t1 = UTCDateTime("2020-02-13T09:02:00.000")
t2 = UTCDateTime("2020-02-13T09:28:00.000")

# get_waveforms expects (network, station, location, channel, start_time, end_time)
# One station/channel
st = client.get_waveforms("IM","H11S1","","EDH",t1,t2)

""" Plot the timeseries waveform """
st.plot()


""" Plot the spectrogram """
fig = st.spectrogram(log=False, dbscale=True, axes=None, title='Spectrogram', cmap='inferno', show=False)
fig.axes[0].set_ylim(0,100)
plt.show()

我不知道如何設置圖形的新 y 軸限制。 但是,要截斷數據的頻率范圍,您可以先對數據進行下采樣,然后再進行頻譜圖。 有 obspy resample fct ( https://docs.obspy.org/packages/autogen/obspy.core.stream.Stream.resample.html ) 可以完成這項工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM