improve eod calculation/detection
This commit is contained in:
parent
71115d83d0
commit
ad62b31abc
@ -284,15 +284,13 @@ def calculate_serial_correlation(spiketimes: np.ndarray, max_lag: int) -> np.nda
|
|||||||
return cor
|
return cor
|
||||||
|
|
||||||
|
|
||||||
def calculate_eod_frequency(time, eod):
|
def calculate_eod_frequency(eod, sampling_interval):
|
||||||
# TODO for few samples very volatile measure!
|
# TODO for few samples very volatile measure!
|
||||||
up_indicies, down_indicies = threshold_crossings(eod, 0)
|
std = np.std(eod)
|
||||||
up_times, down_times = threshold_crossing_times(time, eod, 0, up_indicies, down_indicies)
|
peaks, _ = detect_peaks(eod, std*1)
|
||||||
|
peak_times = [p*sampling_interval for p in peaks]
|
||||||
|
|
||||||
if len(up_times) == 0:
|
durations = np.diff(peak_times)
|
||||||
return 0
|
|
||||||
|
|
||||||
durations = np.diff(up_times)
|
|
||||||
mean_duration = np.mean(durations)
|
mean_duration = np.mean(durations)
|
||||||
|
|
||||||
return 1/mean_duration
|
return 1/mean_duration
|
||||||
|
Loading…
Reference in New Issue
Block a user