updated calculate integral in useful functions
This commit is contained in:
parent
ac9ced6bcc
commit
702cbd08bb
@ -75,9 +75,12 @@ def calculate_integral(freq, power, point, delta = 2.5):
|
|||||||
The calculated integral around the point.
|
The calculated integral around the point.
|
||||||
local_mean : float
|
local_mean : float
|
||||||
The local mean value (adjacent integrals).
|
The local mean value (adjacent integrals).
|
||||||
|
p_power : float
|
||||||
|
The local maxiumum power.
|
||||||
"""
|
"""
|
||||||
indices = (freq >= point - delta) & (freq <= point + delta)
|
indices = (freq >= point - delta) & (freq <= point + delta)
|
||||||
integral = np.trapz(power[indices], freq[indices])
|
integral = np.trapz(power[indices], freq[indices])
|
||||||
|
p_power = np.max(power[indices])
|
||||||
|
|
||||||
left_indices = (freq >= point - 5 * delta) & (freq < point - delta)
|
left_indices = (freq >= point - 5 * delta) & (freq < point - delta)
|
||||||
right_indices = (freq > point + delta) & (freq <= point + 5 * delta)
|
right_indices = (freq > point + delta) & (freq <= point + 5 * delta)
|
||||||
@ -86,7 +89,7 @@ def calculate_integral(freq, power, point, delta = 2.5):
|
|||||||
r_integral = np.trapz(power[right_indices], freq[right_indices])
|
r_integral = np.trapz(power[right_indices], freq[right_indices])
|
||||||
|
|
||||||
local_mean = np.mean([l_integral, r_integral])
|
local_mean = np.mean([l_integral, r_integral])
|
||||||
return integral, local_mean
|
return integral, local_mean, p_power
|
||||||
|
|
||||||
def extract_stim_data(stimulus):
|
def extract_stim_data(stimulus):
|
||||||
'''
|
'''
|
||||||
|
Loading…
Reference in New Issue
Block a user