Compute Power Spectral Densities
This code is responsible for the computation of the Power Spectral Densities.
This script will search for QC jobs marked “T”odo in the database by day and process them. As soon as one day is selected, the corresponding jobs are marked “I”n Progress in the database. This allows running several instances of this script in parallel.
The PSD are calculated using the implementation in ObsPy. Parameters can be defined in the Config to control the windowing and the smoothness of the PSD results (see below).
The PSD computation produces two SDS-like structures that contain the results,
both under the
PSD/NPZ/: contains the NPZ, or “compressed numpy arrays”, with all the individual psd spectra
PSD/PNG/: contains the images representing the daily PPSD (probabilistic power spectral densities), which are useful for a routine, or rapid check.
qc_components: Components to process for QC, defaults to [Z], but can be any comma separated list (e.g. ‘Z,E,N’) (default=Z)
qc_ppsd_length: Length of data segments passed to psd in seconds. In the paper by McNamara et al (2004) a value of 3600 (1 hour) was chosen. Longer segments increase the upper limit of analyzed periods but decrease the number of analyzed segments. (default=3600)
qc_ppsd_overlap: Overlap of segments passed to psd. Overlap may take values between 0 and 1 and is given as fraction of the length of one segment, e.g. qc_ppsd_length=3600 and qc_ppsd_overlap=0.5 result in an overlap of 1800s of the segments. (default=0)
qc_ppsd_period_smoothing_width_octaves: Determines over what period/frequency range the psd is smoothed around every central period/frequency. Given in fractions of octaves (default of
1means the psd is averaged over a full octave at each central frequency). (default=0.125)
qc_ppsd_period_step_octaves: Step length on frequency axis in fraction of octaves (default of
0.125means one smoothed psd value on the frequency axis is measured every 1/8 of an octave). (default=0.0125)
qc_ppsd_period_limits: Set custom lower and upper end of period range (e.g.
(0.01, 100)seconds). The specified lower end of period range will be set as the central period of the first bin (geometric mean of left/right edges of smoothing interval). At the upper end of the specified period range, no more additional bins will be added after the bin whose center frequency exceeds the given upper end for the first time. (default=(0.01,100))
qc_ppsd_db_bins: Specify the lower and upper boundary and the width of the db bins. The bin width might get adjusted to fit a number of equally spaced bins in between the given boundaries. (default=(-200, -50, 1.))
To be able to compute the PSD, the instrument responses need to be provided. TODO: add link to “how to check if my responses are OK”
To run this script:
$ msnoise qc compute_psd
This step also supports parallel processing/threading:
$ msnoise -t 4 qc compute_psd
will start 4 instances of the code (after 1 second delay to avoid database conflicts). This works both with SQLite and MySQL but be aware problems could occur with SQLite.
New in version 2.0: New in 2.0