SHARE

TWEET

# Untitled

a guest
Jan 22nd, 2020
72
Never

**Not a member of Pastebin yet?**

**, it unlocks many cool features!**

__Sign Up__- # As with most functions, you can pass arguments to a
- # gumpy function that will be forwarded to the backend.
- # In this example the decomposition levels are mandatory, and the
- # mother wavelet that should be passed is optional
- level = 6
- wavelet = 'db4'
- # now we can retrieve the dwt for the different channels
- #data_class1 format: (c3, c4, cz, c3, c4, cz)
- mean_coeff_C3_c1 = gumpy.signal.dwt(data_class1[0], level=level, wavelet=wavelet) #c3 class 1 (left hand)
- mean_coeff_C4_c1 = gumpy.signal.dwt(data_class1[1], level=level, wavelet=wavelet) #c4 class 1 (left hand)
- mean_coeff_C3_c2 = gumpy.signal.dwt(data_class1[3], level=level, wavelet=wavelet) #c3 class 2 (right hand)
- mean_coeff_C4_c2 = gumpy.signal.dwt(data_class1[4], level=level, wavelet=wavelet) #c4 class 2 (right hand)
- # gumpy's signal.dwt function returns the approximation of the
- # coefficients as first result, and all the coefficient details as list
- # as second return value (this is contrast to the backend, which returns
- # the entire set of coefficients as a single list)
- approximation_C3_c1 = mean_coeff_C3_c1[0] # left hand
- approximation_C4_c1 = mean_coeff_C4_c1[0] # left hand
- # as mentioned in the comment above, the list of details are in the second
- # return value of gumpy.signal.dwt. Here we save them to additional variables
- # to improve clarity
- details_C3_c1 = mean_coeff_C3_c1[1] #left hand
- details_C4_c1 = mean_coeff_C4_c1[1] #left hand
- #details_c3_c2 = mean_coeff_ch0_c2[1] #right hand
- #details_c4_c2 = mean_coeff_ch1_c2[1] #right hand
- # gumpy exhibits a function to plot the dwt results. You must pass three lists,
- # i.e. the labels of the data, the approximations, as well as the detailed coeffs,
- # so that gumpy can automatically generate appropriate titles and labels.
- # you can pass an additional class string that will be incorporated into the title.
- # the function returns a matplotlib axis object in case you want to further
- # customize the plot.
- gumpy.plot.dwt(
- [approximation_C3_c1, approximation_C4_c1],
- [details_C3_c1, details_C4_c1],
- ['C3, c1', 'C4, c1'],
- level, grazb_data.sampling_freq, 'Class: Left')

RAW Paste Data

We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.