Plot the MUAPs of a specific matrix channel.
Plot the MUs action potential (MUAPs) shapes with or without average.
PARAMETER |
DESCRIPTION |
emgfile |
The dictionary containing the emgfile.
TYPE:
dict
|
stmuap |
dict containing a dict of ST MUAPs (pd.DataFrame) for every MUs.
TYPE:
dict
|
munumber |
The number of the MU to plot.
TYPE:
int
|
column |
The matrix columns.
Options are usyally "col0", "col1", "col2", ..., last column.
TYPE:
str
|
channel |
The channel of the matrix to plot.
This can be the real channel number if channelprog=False (default),
or a progressive number (from 0 to the length of the matrix column)
if channelprog=True.
TYPE:
int
|
channelprog |
Whether to use the real channel number or a progressive number
(see channel).
TYPE:
bool
DEFAULT:
False
|
average |
Whether to plot also the MUAPs average obtained by spike triggered
average.
TYPE:
bool
DEFAULT:
True
|
timeinseconds |
Whether to show the time on the x-axes in seconds (True)
or in samples (False).
TYPE:
bool
DEFAULT:
True
|
figsize |
Size of the figure in centimeters [width, height].
TYPE:
list
DEFAULT:
[20, 15]
|
showimmediately |
If True (default), plt.show() is called and the figure showed to the
user.
It is useful to set it to False when calling the function from the GUI.
TYPE:
bool
DEFAULT:
True
|
tight_layout |
If True (default), the plt.tight_layout() is called and the figure's
layout is improved.
It is useful to set it to False when calling the function from the GUI.
TYPE:
bool
DEFAULT:
True
|
RETURNS |
DESCRIPTION |
fig
|
TYPE:
pyplot `~.figure.Figure`
|
See also
- plot_muaps : Plot MUAPs obtained from STA from one or multiple MUs.
- st_muap : Generate spike triggered MUAPs of every MUs
(as input to this function).
Examples:
Plot all the consecutive MUAPs of a single MU.
In this case we are plotting the matrix channel 45 which is placed in
column 4 ("col3" as Python numbering is base 0).
>>> import openhdemg.library as emg
>>> emgfile = emg.askopenfile(filesource="OTB", otb_ext_factor=8)
>>> sorted_rawemg = emg.sort_rawemg(
... emgfile,
... code="GR08MM1305",
... orientation=180,
... dividebycolumn=True,
... )
>>> stmuap = emg.st_muap(
... emgfile=emgfile,
... sorted_rawemg=sorted_rawemg,
... timewindow=50,
... )
>>> emg.plot_muap(
... emgfile=emgfile,
... stmuap=stmuap,
... munumber=1,
... column="col3",
... channel=45,
... channelprog=False,
... average=False,
... timeinseconds=True,
... figsize=[20, 15],
... showimmediately=True,
... )
To avoid the problem of remebering which channel number is present in
which matrix column, we can set channelprog=True and locate the channel
with a value ranging from 0 to the length of each column.
>>> import openhdemg.library as emg
>>> emgfile = emg.askopenfile(filesource="OTB", otb_ext_factor=8)
>>> sorted_rawemg = emg.sort_rawemg(
... emgfile=emgfile,
... code="GR08MM1305",
... orientation=180,
... dividebycolumn=True,
... )
>>> stmuap = emg.st_muap(
... emgfile=emgfile,
... sorted_rawemg=sorted_rawemg,
... timewindow=50,
... )
>>> emg.plot_muap(
... emgfile=emgfile,
... stmuap=stmuap,
... munumber=1,
... column="col3",
... channel=5,
... channelprog=True,
... average=False,
... timeinseconds=True,
... figsize=[20, 15],
... showimmediately=True,
... )
It is also possible to visualise the spike triggered average
of the MU with average=True.
In this example the single differential derivation is used.
>>> import openhdemg.library as emg
>>> emgfile = emg.askopenfile(filesource="OTB", otb_ext_factor=8)
>>> sorted_rawemg = emg.sort_rawemg(
... emgfile=emgfile,
... code="GR08MM1305",
... orientation=180,
... dividebycolumn=True,
... )
>>> sorted_rawemg = emg.diff(sorted_rawemg=sorted_rawemg)
>>> stmuap = emg.st_muap(
... emgfile=emgfile,
... sorted_rawemg=sorted_rawemg,
... timewindow=50,
... )
>>> emg.plot_muap(
... emgfile=emgfile,
... stmuap=stmuap,
... munumber=1,
... column="col2",
... channel=6,
... channelprog=True,
... average=True,
... timeinseconds=True,
... figsize=[20, 15],
... showimmediately=True,
... )