Skip to content

pic

Description

This module contains all the functions used to quantify and analyze MU persistent inward currents.

Currently includes delta F.


compute_deltaf(emgfile, smoothfits, average_method='test_unit_average', normalisation='False', recruitment_difference_cutoff=1.0, corr_cutoff=0.7, controlunitmodulation_cutoff=0.5, clean=True)

Quantify delta F via paired motor unit analysis.

Conducts a paired motor unit analysis, quantifying delta F between the supplied collection of motor units. Origional framework for deltaF provided in Gorassini et. al., 2002: https://journals.physiology.org/doi/full/10.1152/jn.00024.2001

Author: James (Drew) Beauchamp

PARAMETER DESCRIPTION
emgfile

The dictionary containing the emgfile.

TYPE: dict

smoothfits

Smoothed discharge rate estimates. Each array: motor unit discharge rate x samples aligned in time; instances of non-firing = NaN Your choice of smoothing. See compute_svr gen_svr for example.

TYPE: list of arrays

average_method

The method for test MU deltaF value. More to be added.

test_unit_average The average across all possible control units.

all This returns all possible MU pairs

TYPE: str {"test_unit_average", "all"} DEFAULT: "test_unit_average"

normalisation

The method for deltaF nomalization.

ctrl_max_desc Whether to normalise deltaF values to control unit descending range during test unit firing. See Skarabot et. al., 2023: https://www.biorxiv.org/content/10.1101/2023.10.16.562612v1

TYPE: str {"False", "ctrl_max_desc"} DEFAULT: "False"

recruitment_difference_cutoff

An exlusion criteria corresponding to the necessary difference between control and test MU recruitement in seconds.

TYPE: float DEFAULT: 1

corr_cutoff

An exclusion criteria corresponding to the correlation between control and test unit discharge rate.

TYPE: float (0 to 1) DEFAULT: 0.7

controlunitmodulation_cutoff

An exclusion criteria corresponding to the necessary modulation of control unit discharge rate during test unit firing in Hz.

TYPE: float DEFAULT: 0.5

clean

To remove values that do not meet exclusion criteria

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
delta_f

A pd.DataFrame containing deltaF values and corresponding MU number. The resulting df will be different depending on average_method. In particular, if average_method="all", delta_f[MU][row] will contain a tuple representing the indices of the two motor units for each given pair (reporter, test) and their corresponding deltaF value.

TYPE: DataFrame

See also
  • compute_svr : fit MU discharge rates with Support Vector Regression, nonlinear regression.

Examples:

Quantify delta F using svr fits.

>>> import openhdemg.library as emg
>>> emgfile = emg.emg_from_samplefile()
>>> emgfile = emg.sort_mus(emgfile=emgfile)
>>> svrfits = emg.compute_svr(emgfile)
>>> delta_f = emg.compute_deltaf(
...     emgfile=emgfile, smoothfits=svrfits["gensvr"],
... )
delta_f
   MU        dF
0   0       NaN
1   1       NaN
2   2       NaN
3   3  1.838382
4   4  2.709522

For all possible combinations, not test unit average, MU in this case is pairs (reporter, test).

>>> delta_f_2 = emg.compute_deltaf(
...     emgfile=emgfile, smoothfits=svrfits["gensvr"], average_method='all',
... )
delta_f_2
       MU        dF
0  (0, 1)       NaN
1  (0, 2)       NaN
2  (0, 3)  2.127461
3  (0, 4)       NaN
4  (1, 2)       NaN
5  (1, 3)  1.549303
6  (1, 4)       NaN
7  (2, 3)       NaN
8  (2, 4)       NaN
9  (3, 4)  2.709522