Institute of Geophysics of the CAS, v. v. i.


PCA-decomposition package: calculation of the common wavelet from seismic traces

Version 1.0,  last update 5.9.2017

Author: Václav Vavryčuk (, Jana Doubravová (


Short description


PCA-DECOMPOSITION is a Matlab software package for the Principal Component Decomposition of seismic traces for extracting the common wavelet. Details about the method are published in Vavryčuk et al. (2017).


Primary reference

Vavryčuk, V., Adamová, P., Doubravová, J., Jakoubková, H., 2017. Moment tensor inversion based on the principal component analysis of waveforms: Method and application to microearthquakes in West Bohemia, Czech Republic, Seismological Research Letters, doi: 10.1785/0220170027, in press.



Please fill in the following form. After submitting needed information the software will be sent to your e-mail.


First Name: *
Surname: *
Email: *
* I claim that the downloaded software will be used for non-commercial purposes only.
  * = obligatory information



The software is structured in the following directories: Data, Figures, Output, Programs.

The PCA decomposition is run by a script called PCA_wavelet.m stored in the Programs directory. Before running the code, change your Matlab directory to /Programs/.


Input parameters

Input parameters for individual events should be stored in the Data directory. The standard name of the input file is /Data/event_list.txt.

The input parameters are formed by nine columns. Each line consists of values of one event:

  • ID                                - identification name of the event
  • W1, W2                       - times of the beginning of the window (increasing part from 0to 1)
  • W3, W4                       - times of the end of the window (decreasing part from 1 to 0)
  • fr_1, fr_2                    - the lower and upper corner frequency of the band-pass filter
  • reference_station     - name of the station, for which the polarity of the wavelet is known
  • reference_polarity    - polarity of the wavelet at the reference station


Control parameters

Control parameters are stored in the Matlab script /Programs/configuration_PCA.m.

The following parameters control the processing of seismic traces:

  • t_min_show, t_max_show   - time interval for plotting seismic traces (in sec)
  • dt                                            - sampling interval used for calculating tiny shifts ofwaveforms
  • N                                             - maximum number of samples in seismic traces
  • t_shift_limit                           - maximum shift (in sec) for alignment of traces by  cross-correlation
  • i_int                                        - option for integrating velocity records to displacementrecords
  • i_zero_phase                         - option for using the zero-phase band-pass filter
  • i_plot                                      - option for plotting figures
  • i_plot_save                            - option for saving figures


Input data

Input data for individual events should be stored in the /Data/Events directory. The standard name of the input files is /Data/Events/ID.mat.

The data files contain data structure event_data:

  • event_data.stations                 - names of the stations
  • event_data.components         - components identifying the traces
  • event_data.sampling_rate      - sampling rate of seismic records
  • event_data.traces                    - individual seismic traces



The output files are stored in the Output directory. The standard names of the output files are:

  • /Output/ID_pca_amplitudes.txt   -  contains names of station and the PCA amplitudes
  • /Output/ID_wavelet.txt                 -  contains the common PCA wavelet



Figures are stored in the Figures directory. The code generates the following postscript figures:

  • /Figures/ID_data.eps          - raw and filtered seismic traces,
  • /Figures/ID_data_pc.eps    - filtered seismic traces with the principal components,
  • /Figures/ID_pc.eps              - the first (in red) and second (in black) principal components.



As an example, we provide the input files for two micro-earthquakes from the West Bohemia swarm area (see Vavryčuk et al., 2017).

To run the code: change your Matlab directory to /Programs/ and call PCA_wavelet.m.



The code can be freely used for research purposes only. In the case of publishing the results obtained by this code, please, refer to the paper of Vavryčuk et al. (2017). If you intend to use the code for commercial purposes, you should contact the author for providing with the commercial licence. The use of the software for commercial purposes with no commercial licence is prohibited.