resurfemg.pipelines.processing 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 perform default signal processing procedures.

resurfemg.pipelines.processing.ecg_removal_gating(emg_raw, ecg_peaks_idxs, gate_width_samples, method=3, ecg_shift=None)

Eliminate the ECG peaks from the emg_raw signal.

param emg_raw:

1 dimensional emg signal to gate

type emg_raw:

~numpy.ndarray

param ecg_peaks_idxs:

List of ECG peak sample numbers to gate.

type ecg_peaks_idxs:

~numpy.ndarray

param gate_width_samples:

Number of samples to gate

type gate_width_samples:

int

param fs:

Sampling rate of emg_raw

type fs:

int

param method:

gating method. See the ecg_removal.gating function.

type method:

int

param ecg_shift:

Shift gate windows relative to detected peaks in samples.

type ecg_shift:

int

returns emg_gated:

The gated EMG signal

rtype emg_gated:

numpy.ndarray

resurfemg.pipelines.processing.quick_look(emg_raw, fs_emg, plot_raw=False, plot_clean=True, plot_env=True, plot_power_spectrum=True)

Method for quick inspection of EMG data based on high-pass filtering @80Hz.

param emg_raw:

raw single channel EMG data

type emg_raw:

~numpy.ndarray

param fs_emg:

sampling frequency

type fs_emg:

~int

param plot_raw:

Plot the raw signal

type plot_raw:

bool

param plot_clean:

Plot the filtered signal

type plot_clean:

bool

param plot_env:

Plot the envelope of the signal

type plot_env:

bool

param plot_power_spectrum:

Plot the powerspectrum of the raw signal

type plot_power_spectrum:

bool

returns emg_filt:

The bandpass filtered EMG data

rtype emg_filt:

~numpy.ndarray

returns emg_env:

The envelope of the EMG data

rtype emg_env:

~numpy.ndarray