Class to compile probabilistic power spectral densities for one combination of network/station/location/channel/sampling_rate.
Calculations are based on the routine used by [McNamara2004]. For information on New High/Low Noise Model see [Peterson2003].
Basic Usage
>>> from obspy import read
>>> from obspy.signal import PPSD
>>> st = read()
>>> tr = st.select(channel="EHZ")[0]
>>> paz = {'gain': 60077000.0,
... 'poles': [-0.037004+0.037016j, -0.037004-0.037016j,
... -251.33+0j, -131.04-467.29j, -131.04+467.29j],
... 'sensitivity': 2516778400.0,
... 'zeros': [0j, 0j]}
>>> ppsd = PPSD(tr.stats, paz)
>>> print ppsd.id
BW.RJOB..EHZ
>>> print ppsd.times
[]
Now we could add data to the probabilistic psd (all processing like demeaning, tapering and so on is done internally) and plot it like ...
>>> ppsd.add(st)
>>> print ppsd.times
>>> ppsd.plot()
... but the example stream is too short and does not contain enough data.
And/or we could save the ppsd data in a pickled file ...
>>> ppsd.save("myfile.pkl")
... that later can be loaded again using the pickle module in the Python Standard Library, e.g. to add more data or plot it again.
>>> import pickle
>>> ppsd = pickle.load("myfile.pkl")
For a real world example see the ObsPy Tutorial.
Note
It is safer (but a bit slower) to provide a Parser instance with information from e.g. a Dataless SEED than to just provide a static PAZ dictionary.
Attributes
__doc__ | str(object) -> string |
__module__ | str(object) -> string |
Public Methods
add | Process all traces with compatible information and add their spectral estimates to the histogram containg the probabilistic psd. |
get_percentile | Returns periods and approximate psd values for given percentile value. |
plot | Plot the 2D histogram of the current PPSD. |
plot_coverage | Plot the data coverage of the histogram of the current PPSD. |
save | Saves PPSD instance as a pickled file that can be loaded again using |
Private Methods
_PPSD__check_time_present | Checks if the given UTCDateTime is already part of the current PPSD |
_PPSD__get_normalized_cumulative_histogram | Returns the current histogram in a cumulative version normalized per period column, i.e. |
_PPSD__insert_data_times | Gets gap information of stream and adds the encountered gaps to the gap |
_PPSD__insert_gap_times | Gets gap information of stream and adds the encountered gaps to the gap |
_PPSD__insert_used_time | Inserts the given UTCDateTime at the right position in the list keeping |
_PPSD__plot_coverage | Helper function to plot coverage into given axes. |
_PPSD__process | Processes a one-hour segment of data and adds the information to the |
_PPSD__sanity_check | Checks if trace is compatible for use in the current PPSD instance. |
_PPSD__setup_bins | Makes an initial dummy psd and thus sets up the bins and all the rest. |
Special Methods
__init__ | Initialize the PPSD object setting all fixed information on the station |