6.2.10.14. eqcorrscan.utils.plotting.svd_plot

eqcorrscan.utils.plotting.svd_plot(svstreams, svalues, stachans, **kwargs)[source]

Plot singular vectors from the eqcorrscan.utils.clustering routines.

One plot for each channel.

Parameters:
  • svstreams (list) – See eqcorrscan.utils.clustering.svd_to_stream() - these should be ordered by power, e.g. first singular vector in the first stream.

  • svalues (list) – List of floats of the singular values corresponding to the SVStreams

  • stachans (list) – List of station.channel

  • title (str) – Title of figure

  • show (bool) – Whether to show the figure or not (defaults to True)

  • save (bool) – Whether to save the figure or not (defaults to False)

  • savefile (str) – Filename to save figure to, if save==True (defaults to “EQcorrscan_figure.png”)

  • return_figure (bool) – Whether to return the figure or not (defaults to True), if False then the figure will be cleared and closed.

  • size (tuple of float) – Figure size as (width, height) in inches. Defaults to (10.5, 7.5)

Returns:

matplotlib.figure.Figure

Example

>>> from obspy import read
>>> import glob
>>> from eqcorrscan.utils.plotting import svd_plot
>>> from eqcorrscan.utils.clustering import svd, svd_to_stream
>>> wavefiles = glob.glob('eqcorrscan/tests/test_data/WAV/TEST_/2013-*')
>>> streams = [read(w) for w in wavefiles[1:10]]
>>> stream_list = []
>>> for st in streams:
...     tr = st.select(station='GCSZ', channel='EHZ')
...     tr = tr.detrend('simple').resample(100).filter(
...        'bandpass', freqmin=2, freqmax=8)
...     stream_list.append(tr)
>>> uvec, sval, svec, stachans = svd(stream_list=stream_list)
>>> svstreams = svd_to_stream(uvectors=uvec, stachans=stachans, k=3,
...                           sampling_rate=100)
>>> svd_plot(svstreams=svstreams, svalues=sval,
...          stachans=stachans) 

(Source code)