Skip to content

Commit a022997

Browse files
authored
Merge pull request #302 from fooof-tools/kneetime
[BUG] - Fix description of time constant estimation
2 parents d1e8d8c + bd59f77 commit a022997

File tree

2 files changed

+37
-8
lines changed

2 files changed

+37
-8
lines changed

fooof/tests/utils/test_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def test_compute_knee_frequency():
1313

1414
def test_compute_time_constant():
1515

16-
assert compute_time_constant(100)
16+
assert compute_time_constant(10)
1717

1818
def test_compute_fwhm():
1919

fooof/utils/params.py

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,55 @@ def compute_knee_frequency(knee, exponent):
1919
-------
2020
float
2121
Frequency value, in Hz, of the knee occurs.
22+
23+
Notes
24+
-----
25+
The knee frequency is an estimate of the frequency in spectrum at which the spectrum
26+
moves from the plateau region to the exponential decay.
27+
28+
This approach for estimating the knee frequency comes from [1]_ (see [2]_ for code).
29+
30+
Note that this provides an estimate of the knee frequency, but is not, in the general case,
31+
a precisely defined value. In particular, this conversion is based on the case of a Lorentzian
32+
with exponent = 2, and for other exponent values provides a non-exact approximation.
33+
34+
References
35+
----------
36+
.. [1] Gao, R., van den Brink, R. L., Pfeffer, T., & Voytek, B. (2020). Neuronal timescales
37+
are functionally dynamic and shaped by cortical microarchitecture. Elife, 9, e61277.
38+
https://doi.org/10.7554/eLife.61277
39+
.. [2] https://github.com/rdgao/field-echos/blob/master/echo_utils.py#L64
2240
"""
2341

24-
return knee ** (1./exponent)
42+
return knee ** (1. / exponent)
2543

2644

27-
def compute_time_constant(knee):
28-
"""Compute the characteristic time constant based on the knee value.
45+
def compute_time_constant(knee_freq):
46+
"""Compute the characteristic time constant from the estimated knee frequency.
2947
3048
Parameters
3149
----------
32-
knee : float
33-
Knee parameter value.
50+
knee_freq : float
51+
Estimated knee frequency.
3452
3553
Returns
3654
-------
3755
float
38-
Calculated time constant value, tau, given the knee parameter.
56+
Calculated time constant value, tau, given the knee frequency.
57+
58+
Notes
59+
-----
60+
This approach for estimating the time constant comes from [1]_ (see [2]_ for code).
61+
62+
References
63+
----------
64+
.. [1] Gao, R., van den Brink, R. L., Pfeffer, T., & Voytek, B. (2020). Neuronal timescales
65+
are functionally dynamic and shaped by cortical microarchitecture. Elife, 9, e61277.
66+
https://doi.org/10.7554/eLife.61277
67+
.. [2] https://github.com/rdgao/field-echos/blob/master/echo_utils.py#L65
3968
"""
4069

41-
return 1. / (2*np.pi*knee)
70+
return 1. / (2 * np.pi * knee_freq)
4271

4372

4473
def compute_fwhm(std):

0 commit comments

Comments
 (0)