obspy / obspy

ObsPy: A Python Toolbox for seismology/seismological observatories.

Home Page:https://www.obspy.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question about ppsd.plot_temporal

Tinyu0000 opened this issue · comments

Hello,
I want to draw the psd by using the ppsd.plot_temporal,but the picture I make is wrong.
How should I modify my code?
Below is the code I wrote:

from obspy import read
from obspy.signal import PPSD
from obspy.imaging.cm import pqlx
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
stn = pd.read_csv("station.txt",index_col = False)
stn_pd = np.array(stn.iloc[:,0])
stn_pd = stn_pd.reshape(stn_pd.shape[0],1)
for i in range(len(stn_pd)):
file_path = f"/media/tinyu/18tinyu/data/CL/sac_raw_25Hz/{stn_pd[i][0]}"
txt = f"/media/tinyu/18tinyu/data/CL/sac_raw_25Hz/{stn_pd[i][0]}/file.txt"
f = pd.read_csv(txt,index_col = False)
f_pd = np.array(f.iloc[:,0])
l = len(f)
#l = 3
for j in range(len(f_pd)):
if j == 0:
st = read(f"/media/tinyu/18tinyu/data/CL/sac_raw_25Hz/{stn_pd[i][0]}/{f_pd[j]}")
tr = st.select(component="Z")[0]
paz = {'gain': 1.,
'poles': [-21.991+22.435j, -21.991-22.435j],
'sensitivity': 257362500,
'zeros': [0j, 0j]}
ppsd = PPSD(tr.stats, metadata=paz)
ppsd.add(st)
else:
st = read(f"/media/tinyu/18tinyu/data/CL/sac_raw_25Hz/{stn_pd[i][0]}/{f_pd[j]}")
tr = st.select(component="Z")[0]
paz = {'gain': 1.,
'poles': [-21.991+22.435j, -21.991-22.435j],
'sensitivity': 257362500,
'zeros': [0j, 0j]}
ppsd.add(st)
if j == l - 1:
ppsd.plot()
ppsd.plot_temporal([0.1,1,10],color=None,grid=True)

output

Please take usage questions to our forum: https://discourse.obspy.org/

Oh,thank you.I find the answer in https://discourse.obspy.org/ now.