Skip to content

Commit

Permalink
convert knee to knee frequency
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanhammonds committed Feb 2, 2022
1 parent 79b1a7d commit 503688d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions neurodsp/sim/aperiodic.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ def sim_knee(n_seconds, fs, exponent1, exponent2, knee):
Power law exponent after the knee.
knee : float
Location of the knee in Hz.
Returns
-------
sig : 1d array
Expand Down Expand Up @@ -177,8 +176,11 @@ def sim_knee(n_seconds, fs, exponent1, exponent2, knee):
sig = np.zeros(n_samples)

for f in freqs:
sig += np.sqrt(1 / (f ** -exponent1 * (f ** (-exponent2 - exponent1) + knee))) \
* np.cos(2 * np.pi * f * times + 2 * np.pi * np.random.rand())

knee_term = knee**(-2*exponent1 - exponent2)

sig += np.sqrt(1 / (f ** -exponent1 * (f ** (-exponent2 - exponent1) + knee_term))) * \
np.cos(2 * np.pi * f * times + 2 * np.pi * np.random.rand())

return sig

Expand Down

0 comments on commit 503688d

Please sign in to comment.