Resize all the components in the emgfile.
This function can be useful to compute the various parameters only in the
area of interest.
PARAMETER |
DESCRIPTION |
emgfile |
The dictionary containing the emgfile to resize.
TYPE:
dict
|
area |
The resizing area. If already known, it can be passed in samples, as a
list (e.g., [120,2560]).
If None, the user can select the area of interest manually.
TYPE:
None or list
DEFAULT:
None
|
how |
If area==None, allow the user to visually select the area to resize
based on how.
ref_signal
Visualise the reference signal to select the area to resize.
mean_emg
Visualise the mean EMG signal to select the area to resize.
TYPE:
str {"ref_signal", "mean_emg"}
DEFAULT:
"ref_signal"
|
accuracy |
recalculate
The Silhouette score is computed in the new resized file. This can
be done only if IPTS is present.
maintain
The original accuracy measure already contained in the emgfile is
returned without any computation.
TYPE:
str {"recalculate", "maintain"}
DEFAULT:
"recalculate"
|
ignore_negative_ipts |
This parameter determines the silhouette score estimation. If True,
only positive ipts values are used during peak and noise clustering.
This is particularly important for compensating sources with large
negative components. This parameter is considered only if
accuracy=="recalculate".
TYPE:
bool
DEFAULT:
False
|
RETURNS |
DESCRIPTION |
rs_emgfile
|
the new (resized) emgfile.
TYPE:
dict
|
start_, end_ : int
|
the start and end of the selection (can be used for code automation).
|
Notes
Suggested names for the returned objects: rs_emgfile, start_, end_.
Examples:
Manually select the area to resize the emgfile based on mean EMG signal
and recalculate the silhouette score in the new portion of the signal.
>>> emgfile = emg.askopenfile(filesource="DEMUSE", ignore_negative_ipts=True)
>>> rs_emgfile, start_, end_ = emg.resize_emgfile(
... emgfile,
... how="mean_emg",
... accuracy="recalculate",
... )
Automatically resize the emgfile in the pre-specified area. Do not
recalculate the silhouette score in the new portion of the signal.
>>> emgfile = emg.askopenfile(filesource="CUSTOMCSV")
>>> rs_emgfile, start_, end_ = emg.resize_emgfile(
... emgfile,
... area=[120, 25680],
... accuracy="maintain",
... )