PPSD problem: provided data too short with default `ppsd_length` which works on 1-hour long data slices

Hii, i want to compute the ppsd of a waveform.I write the code after following obspy documentations.

My code
`
import matplotlib.pyplot as plt
plt.style.use(“bmh”)
plt.rcParams[‘figure.figsize’] = 10, 6

from obspy import read, read_inventory

st = read(“1607.QHD”)
inv = read_inventory("/home/dk/Downloads/stationxml-seed-converter-master/dataless.G.HYB.seed")

print(st)
print(inv)
inv.plot(projection=“ortho”);

from obspy.signal import PPSD

tr = st[0]
ppsd = PPSD(stats=tr.stats, metadata=inv)

ppsd.add(tr)
ppsd.plot()
However, i get error Exception: No data accumulated` in ppsd.plot() step.As i am new to obspy i am unable to find out where error raise.Please help experts.Thanks in advance.

seems I replied to this already in gitter. The issue was a combo of a non-standard seed ID waveform + a too long ppsd_duration value.

1 Like

I too, am struggling with this error. When I attempt to attach my data segment to the ppsd, it reports back as false. This is a 120 second, 100 s/sec digitized analog seismogram for which I want to analyze within the frequency domain.

What is a non-standard seed ID ?
I need some help in figuring out the error.

infile = "D:/seismo/Kaitlyn/LM.BEAM.20.EHZ.1987.10.23.05.00.00.mseed"
st = read(infile)
print(st,"\n\n")
inv = read_inventory("D:\\Seismo\\kaitlyn\\dataless.LM_BEAM_EHZ_20.seed")
st.attach_response(inv)
tr = st[0]
print(tr.stats,"\n\n")
ppsd = PPSD(tr.stats, metadata=inv)
print(ppsd.add(st),"\n")

ppsd.plot(show_mean=True,max_percentage = 15,period_lim = [0.1,20], xaxis_frequency=True,show_noise_models=True,show_percentiles=False,show_histogram=False)

Code above results in:

1 Trace(s) in Stream:
LM.BEAM.20.EHZ | 1987-10-23T05:00:00.000000Z - 1987-10-23T05:01:59.990000Z | 100.0 Hz, 12000 samples 


         network: LM
         station: BEAM
        location: 20
         channel: EHZ
       starttime: 1987-10-23T05:00:00.000000Z
         endtime: 1987-10-23T05:01:59.990000Z
   sampling_rate: 100.0
           delta: 0.01
            npts: 12000
           calib: 1.0
         _format: MSEED
           mseed: AttribDict({'dataquality': 'D', 'number_of_records': 12, 'encoding': 'FLOAT32', 'byteorder': '>', 'record_length': 4096, 'filesize': 49152})
        response: Channel Response
	From M (displacement in meters) to CM (Centimeters displacement on seismogram)
	Overall Sensitivity: 4023 defined at 1.000 Hz
	3 stages:
		Stage 1: PolesZerosResponseStage from M to M, gain: 40230
		Stage 2: ResponseStage from M to M, gain: 1
		Stage 3: CoefficientsTypeResponseStage from M to CM, gain: 100 


False 

---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
<ipython-input-166-b658ea40d4a2> in <module>
     10 
     11 # %matplotlib
---> 12 ppsd.plot(show_mean=True,max_percentage = 15,period_lim = [0.1,20], xaxis_frequency=True,show_noise_models=True,show_percentiles=False,show_histogram=False)

~\AppData\Local\conda\conda\envs\obspy3.7\lib\site-packages\obspy\signal\spectral_estimation.py in plot(self, filename, show_coverage, show_histogram, show_percentiles, percentiles, show_noise_models, grid, show, max_percentage, period_lim, show_mode, show_mean, cmap, cumulative, cumulative_number_of_colors, xaxis_frequency, show_earthquakes)
   1903         """
   1904         import matplotlib.pyplot as plt
-> 1905         self.__check_histogram()
   1906         fig = plt.figure()
   1907         fig.ppsd = AttribDict()

~\AppData\Local\conda\conda\envs\obspy3.7\lib\site-packages\obspy\signal\spectral_estimation.py in __check_histogram(self)
    814             else:
    815                 msg = 'No data accumulated'
--> 816                 raise Exception(msg)
    817 
    818     def __invalidate_histogram(self):

Exception: No data accumulated

Same as above. PPSD by default is working on slices of 1 hour of data, so your input of 2 minutes gets disregarded. If you really aren’t interested in low frequencies and want to work on short signal windows, you can set a lower ppsd_length on PPSD init