pca

exception PCAError[source]

Bases: owlpy.error.OwlPyError

Raised when PCA failed.

pca(traces)[source]

Perform principal component analysis (PCA) of 2- or multi-component signal.

Parameters

traces (list of obspy.Trace or pyrocko.Trace objects) – Waveforms of the signals to be analysed. Components are expected in the order and polarity [east, north] or [east, north, up]. The traces must be of same length, sampling rate and data type.

Raises

OwlPyError if the input traces are incompatible, PCAError if the traces are too short.

Returns

(cov, evals, evecs, azimuth, incidence) where cov is the covariance matrix of the data, evals are the eigenvalues, evecs are the eigenvectors, azimuth is the horizontal direction of the principal component, measured clockwise from north and incidence is incidence angle of the principal component, measured from vertical. The azimuth is wrapped to the range [0, 180) because of its +-180 deg ambiguity, the incidence angle returned in the range [0, 90]. An incidence angle of 90 deg is returned, if no vertical component is available. Both angles are returned in [deg].

Return type

5-tuple: three numpy.ndarray and two float.

PCA is useful to find the polarisation of a signal contained in a 2- or 3-component seismic recording. This function estimates the covariance of the signal, the eigen-system of the covariance and the angles of the first principal component. Note that the polarity of the polarisation direction cannot be determined from the PCA alone.