resurfemg.helper_functions.visualization module¶
Copyright 2022 Netherlands eScience Center and University of Twente Licensed under the Apache License, version 2.0. See LICENSE for details.
This file contains functions to visualize the power spectrum of EMG arrays.
- resurfemg.helper_functions.visualization.show_periodogram(signal, fs_emg, axis_spec=1, signal_unit='uV')¶
This function calculates and shows the periodogram.¶
- param signal:
the signal array
- type signal:
~numpy.ndarray
- param fs_emg:
emg sampling rate
- type fs_emg:
int
- param axis_spec:
1 for logaritmic axis, 0 for linear axis
- type axis_spec:
int
- param signal_unit:
Unit of y-axis, default is uV
- type signl_unit:
str
- return (f, Pxx_den):
Frequencies and power spectral density
- rtype (f, Pxx_den):
(np.ndarray, np.ndarray)
- resurfemg.helper_functions.visualization.show_power_spectrum(signal, fs_emg, t_window_s, axis_spec=1, signal_unit='uV')¶
Plot the power spectrum of the frequencies comtained in an EMG based on a Fourier transform. It does not return the graph, rather the values but plots the graph before it return. Sample should be one single row (1-dimensional array) ————————————————————————— :param signal: The signal array :type signal: ~numpy.ndarray :param fs_emg: emg sampling rate :type fs_emg: int :param t_window_s: The end of window over which values will be plotted :type t_window_s: int :param axis_spec: 1 for logaritmic axis, 0 for linear axis :type axis_spec: int :param signal_unit: Unit of y-axis, default is uV :type signal_unit: str
- Return (yf, xf):
Fourier transformed array and frequencies axis
- Rtype (yf, xf):
(np.ndarray, np.ndarray)
- resurfemg.helper_functions.visualization.show_psd_welch(signal, fs_emg, t_window_s, axis_spec=1, signal_unit='uV')¶
Calculates the power spectrum density using the Welch method. This method involves dividing the signal into overlapping segments, copmuting a modified periodogram for each segment, and then averaging these periodograms. ————————————————————————— :param signal: the signal array :type signal: ~numpy.ndarray :param fs_emg: Number of samples per second :type fs_emg: int :param t_window_s:Length of segments in which original signal is divided :type t_window_s: int :param axis_spec: 1 for logaritmic axis, 0 for linear axis :type axis_spec: int :param signal_unit: Unit of signal for labeling the PSD axis, default uV :type signal_unit: str
- Return (f, Pxx_den):
Frequencies and power spectral density
- Rtype (f, Pxx_den):
(np.ndarray, np.ndarray)