From 702cbd08bbcec3c06c2400718bda4a820e0833c6 Mon Sep 17 00:00:00 2001 From: mbergmann Date: Wed, 23 Oct 2024 11:10:04 +0200 Subject: [PATCH] updated calculate integral in useful functions --- code/useful_functions.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/useful_functions.py b/code/useful_functions.py index f54f8e9..15010e1 100644 --- a/code/useful_functions.py +++ b/code/useful_functions.py @@ -75,9 +75,12 @@ def calculate_integral(freq, power, point, delta = 2.5): The calculated integral around the point. local_mean : float The local mean value (adjacent integrals). + p_power : float + The local maxiumum power. """ indices = (freq >= point - delta) & (freq <= point + delta) integral = np.trapz(power[indices], freq[indices]) + p_power = np.max(power[indices]) left_indices = (freq >= point - 5 * delta) & (freq < point - 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]) local_mean = np.mean([l_integral, r_integral]) - return integral, local_mean + return integral, local_mean, p_power def extract_stim_data(stimulus): '''