Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Added 7 more EMG onset detectors #17

Merged
merged 1 commit into from
May 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions biosppy/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,10 @@ def plot_eda(ts=None,


def plot_emg(ts=None,
sampling_rate=None,
raw=None,
filtered=None,
processed=None,
onsets=None,
path=None,
show=False):
Expand All @@ -411,10 +413,14 @@ def plot_emg(ts=None,
----------
ts : array
Signal time axis reference (seconds).
sampling_rate : int, float
Sampling frequency (Hz).
raw : array
Raw EMG signal.
filtered : array
Filtered EMG signal.
processed : array
Processed EMG signal according to the chosen onset detector.
onsets : array
Indices of EMG pulse onsets.
path : str, optional
Expand All @@ -428,7 +434,7 @@ def plot_emg(ts=None,
fig.suptitle('EMG Summary')

# raw signal
ax1 = fig.add_subplot(211)
ax1 = fig.add_subplot(311)

ax1.plot(ts, raw, linewidth=MAJOR_LW, label='Raw')

Expand All @@ -437,7 +443,7 @@ def plot_emg(ts=None,
ax1.grid()

# filtered signal with onsets
ax2 = fig.add_subplot(212, sharex=ax1)
ax2 = fig.add_subplot(312, sharex=ax1)

ymin = np.min(filtered)
ymax = np.max(filtered)
Expand All @@ -456,6 +462,14 @@ def plot_emg(ts=None,
ax2.legend()
ax2.grid()

# processed signal
ax3 = fig.add_subplot(313)
ax3.plot(np.arange(len(processed))/sampling_rate, processed, linewidth=MAJOR_LW, label='Processed')
ax3.set_xlabel('Time (s)')
ax3.set_ylabel('Amplitude')
ax3.legend()
ax3.grid()

# make layout tight
fig.tight_layout()

Expand Down
Loading