Calculate the discharge rate (DR).
PARAMETER |
DESCRIPTION |
emgfile
|
The dictionary containing the emgfile.
TYPE:
dict
|
n_firings_RecDerec
|
The number of firings at recruitment and derecruitment to consider for
the calculation of the DR.
TYPE:
int
DEFAULT:
4
|
n_firings_steady
|
The number of firings to consider for the calculation of the DR at the
start and at the end
of the steady-state phase.
TYPE:
int
DEFAULT:
10
|
start_steady
|
The start and end point (in samples) of the steady-state phase.
If < 0 (default), the user will need to manually select the start and
end of the steady-state phase.
TYPE:
int
DEFAULT:
-1
|
end_steady
|
The start and end point (in samples) of the steady-state phase.
If < 0 (default), the user will need to manually select the start and
end of the steady-state phase.
TYPE:
int
DEFAULT:
-1
|
event_
|
When to calculate the DR.
rec_derec_steady
DR is calculated at recruitment, derecruitment and during the
steady-state phase.
rec
DR is calculated at recruitment.
derec
DR is calculated at derecruitment.
rec_derec
DR is calculated at recruitment and derecruitment.
steady
DR is calculated during the steady-state phase.
TYPE:
str {"rec_derec_steady", "rec", "derec", "rec_derec", "steady"}
DEFAULT:
"rec_derec_steady"
|
idr_range
|
If idr_range is a list [lower_limit, upper_limit], only firings with an
instantaneous discharge rate (IDR) within the limits are used for DR
calculation. lower_limit and upper_limit should be in pulses per
second. See examples section.
If idr_range is None, all the firings are used for DR calculation.
TYPE:
None or list
DEFAULT:
None
|
RETURNS |
DESCRIPTION |
mus_dr
|
A pd.DataFrame containing the requested DR.
TYPE:
DataFrame
|
WARNS |
DESCRIPTION |
warning
|
When calculation of DR at rec/derec fails due to not enough firings.
|
See also
- compute_thresholds : calculates recruitment/derecruitment thresholds.
- basic_mus_properties : calculate basic MUs properties on a trapezoidal
contraction.
- compute_covisi : calculate the coefficient of variation of interspike
interval.
- compute_drvariability : calculate the DR variability.
Notes
DR for all the contraction is automatically calculated and returned.
Examples:
Load the EMG file and compute the DR.
>>> import openhdemg.library as emg
>>> emgfile = emg.askopenfile(filesource="OTB", otb_ext_factor=8)
>>> mus_dr = emg.compute_dr(emgfile=emgfile)
>>> mus_dr
DR_rec DR_derec DR_start_steady DR_end_steady DR_all_steady DR_all
0 5.701081 4.662196 7.321255 6.420720 6.907559 6.814342
1 7.051127 6.752467 14.919066 10.245462 11.938671 11.683134
2 6.101529 4.789000 7.948740 6.133345 7.695189 8.055731
3 6.345692 5.333535 11.121785 9.265212 11.544140 11.109796
Type of output can be adjusted, e.g., to have only the DR at recruitment.
>>> import openhdemg.library as emg
>>> emgfile = emg.askopenfile(filesource="OTB", otb_ext_factor=8)
>>> mus_dr = emg.compute_dr(emgfile=emgfile, event_="rec")
>>> mus_dr
DR_rec DR_all
0 5.701081 6.814342
1 7.051127 11.683134
2 6.101529 8.055731
3 6.345692 11.109796
The manual selection of the steady state phase can be bypassed
if previously calculated with an automated method.
>>> import openhdemg.library as emg
>>> emgfile = emg.askopenfile(filesource="OTB", otb_ext_factor=8)
>>> mus_dr = emg.compute_dr(
... emgfile=emgfile,
... start_steady=20000,
... end_steady=50000,
... event_="steady",
... )
>>> mus_dr
DR_start_steady DR_end_steady DR_all_steady DR_all
0 7.476697 6.271750 6.794170 6.814342
1 14.440561 10.019572 11.822081 11.683134
2 7.293547 5.846093 7.589531 8.055731
3 13.289651 9.694317 11.613640 11.109796
The firings used for DR calculation can be filtered to avoid too closed
firings (e.g., doublets) or intervals of inactivity.
>>> emgfile = emg.emg_from_samplefile()
>>> idr = emg.compute_dr(
... emgfile, start_steady=15000, end_steady=51000, idr_range=[1, 50],
... )
>>> idr
DR_rec DR_derec ... DR_end_steady DR_all_steady DR_all
0 3.341579 4.606835 ... 8.506270 7.895837 7.657269
1 5.701081 4.662196 ... 6.271989 6.916566 6.814687
2 5.699017 3.691367 ... 7.221309 8.183408 7.949294
3 7.548770 5.449581 ... 10.399834 11.164994 10.693076
4 8.344515 5.333535 ... 9.694317 10.750855 10.543011