spkit.wpa_plot

spkit.wpa_plot(x, winsize=128, overlap=64, verticle_stacked=True, wv='db3', mode='symmetric', maxlevel=None, inpterp='sinc', fs=128, plot=True, pad=True, verbose=0, plottype='abs', figsize=(15, 8))

WPA Window-wise Plot

Wavelet Packet Decomposition - temporal - Plot

Parameters:
x: 1d signal array
wvwavelet type, default = ‘db3’
winsize: int, default=128
  • window size, samples at the end will be discarded, if len(x)%overlap is not eqaul to 0, to avoid, pad the signal

overlap: int, default=None,
  • if None, overlap= winsize//2

  • shift of window

mode: {‘symmetric’, ..}, default=’symmetric’
maxlevel: int, or None, default=None
  • maximum levels of decomposition will result in 2**maxlevel packets

verticle_stacked: bool, default=True
  • if True, coefficients are vertically stacked - good for temporal alignment

pad: bool, default=False,
  • if True, signal will be padded with last value to make len(x)%overlap==0

verbose: bool, deault=False
  • Verbosity mode

plottype: {‘abs’,’abs_log’,’abs_log_p1’,’abs_log10’,’abs_log10_p1’}
  • used to plot Wavelet coefficients

figsize: figure size
inpterp: interpolation type
Returns:
WK_seq: 2D array, (N,K),
  • N = 2**maxlevel, number of packets

  • K, number of coefficients in each packet

Notes

#TODO

References

Examples

#sp.wpa_plot
import numpy as np
import matplotlib.pyplot as plt
import spkit as sp
x,fs,lead_names = sp.data.ecg_sample_12leads(sample=2)
x = x[:int(fs*5),5]
x = sp.filterDC_sGolay(x, window_length=fs//3+1)
t = np.arange(len(x))/fs
WK = sp.wpa_plot(x,wv='db3',winsize=512,overlap=256,mode='symmetric',maxlevel=3,plottype='abs_log_p1',
                verticle_stacked=True,pad=False,figsize=(10,6))
../../_images/spkit-WPA_plot-1.png