Find duplicate MUs within the same file based on discharge times.
| PARAMETER |
DESCRIPTION |
emgfile
|
The dictionary containing the emgfile.
TYPE:
dict
|
correlation_max_lag
|
Maximum lag (in seconds) used when computing the cross-correlation
between MU spike trains. Defines the full search range for possible
synchronisation peaks. Larger values allow detection of synchrony
over wider time shifts. This must be < 1.
TYPE:
float
DEFAULT:
50e-3
|
peak_window_half_width
|
Half-width (in seconds) of the window used around the cross-correlation
peak to compute the duplication sensitivity metric. This window should
capture the narrow temporal jitter expected for duplicate MUs.
This must be < 1 and < correlation_max_lag.
TYPE:
float
DEFAULT:
2.5e-3
|
duplicate_threshold
|
Threshold (in percent) for classifying two MUs as duplicates.
The sensitivity metric is computed as the sum of the cross-correlation
values within a ±peak_window_half_width window around the
correlation peak, normalised by the size of the larger spike train.
TYPE:
float
DEFAULT:
30
|
which
|
How to classify the duplicated MUs.
accuracy
The MU with the lowest accuracy is considered duplicate. The
emgfile must already contain the 'ACCURACY' dataframe.
covisi
The MU with the highest CoV of interspike interval is is considered
duplicate.
TYPE:
str {"accuracy", "covisi"}
DEFAULT:
"accuracy"
|
| RETURNS |
DESCRIPTION |
duplicates
|
Sorted list of MU indices classified as duplicates and therefore
recommended for removal.
TYPE:
list of int
|
duplicates_info
|
Detailed information about each detected duplicate MU pair.
Each element of the list is a dictionary describing one MU-MU
comparison that exceeded the duplication threshold. The dictionary
contains:
pair : tuple of int
A tuple "(mu1, mu2)" containing the indices of the two MUs
identified as potential duplicates.
accuracy : tuple of float, optional
Present only when which="accuracy".
Contains the SIL (accuracy) values of the two units in the same
order as "pair". The MU with the lowest SIL is considered the
duplicate.
covisi : tuple of float, optional
Present only when which="covisi".
Contains the CoV of the interspike interval for the two units, in
the same order as "pair". The MU with the highest CoV-ISI is
considered the duplicate.
TYPE:
list of dict
|
See also
- remove_duplicates_within : Remove duplicate MUs within the same file
based on discharge times.
Examples:
Starting from a generic file, the results will look similar to the
following if which="accuracy":
>>> duplicates, duplicate_info = find_duplicates_within(
... emgfile,
... which="accuracy",
... )
>>> duplicates
[0, 3, 4]
>>> duplicate_info
[
{
'pair': (0, 1),
'accuracy': (0.8768360226084906, 0.9552696780856847)
},
{
'pair': (1, 3),
'accuracy': (0.9552696780856847, 0.8969855881081578)
},
{
'pair': (1, 4),
'accuracy': (0.9552696780856847, 0.9178590868820631)
}
]
Or similar to the following if which="covisi":
>>> duplicates, duplicate_info = find_duplicates_within(
... emgfile,
... which="covisi",
... )
>>> duplicates
[0, 1, 2, 3]
>>> duplicate_info
[
{
'pair': (0, 1),
'covisi': (76.9574103452168, 16.266055150945718)
},
{
'pair': (1, 3),
'covisi': (16.266055150945718, 19.07156533711372)
},
{
'pair': (1, 4),
'covisi': (16.266055150945718, 15.38224044131706)
},
{
'pair': (2, 4),
'covisi': (23.264925152223373, 15.38224044131706)
}
]
The returned duplicates list can be used later to remove the duplicate
units by passing it to the delete_mus function:
>>> duplicates, duplicate_info = find_duplicates_within(
... emgfile,
... which="accuracy",
... )
>>> emgfile = emg.delete_mus(emgfile, munumber=duplicates)