diff --git a/helperFunctions.py b/helperFunctions.py
index 868fccf..ee28b6c 100644
--- a/helperFunctions.py
+++ b/helperFunctions.py
@@ -284,15 +284,13 @@ def calculate_serial_correlation(spiketimes: np.ndarray, max_lag: int) -> np.nda
     return cor
 
 
-def calculate_eod_frequency(time, eod):
+def calculate_eod_frequency(eod, sampling_interval):
     # TODO for few samples very volatile measure!
-    up_indicies, down_indicies = threshold_crossings(eod, 0)
-    up_times, down_times = threshold_crossing_times(time, eod, 0, up_indicies, down_indicies)
+    std = np.std(eod)
+    peaks, _ = detect_peaks(eod, std*1)
+    peak_times = [p*sampling_interval for p in peaks]
 
-    if len(up_times) == 0:
-        return 0
-
-    durations = np.diff(up_times)
+    durations = np.diff(peak_times)
     mean_duration = np.mean(durations)
 
     return 1/mean_duration