From 3af4426a2626b0c3211de051c76fbafb510473bd Mon Sep 17 00:00:00 2001 From: weygoldt <88969563+weygoldt@users.noreply.github.com> Date: Thu, 12 Jan 2023 09:04:51 +0100 Subject: [PATCH] added more docstrings and moved chirpsim --- code/chirpdetection.py | 7 ++++--- code/modules/filters.py | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/code/chirpdetection.py b/code/chirpdetection.py index 889004f..603c20b 100644 --- a/code/chirpdetection.py +++ b/code/chirpdetection.py @@ -171,10 +171,11 @@ def main(datapath: str) -> None: ident = np.load(datapath + "ident_v.npy", allow_pickle=True) # set time window # <------------------------ Iterate through windows here - window_duration = 60 * 5 # 5 minutes window - window_overlap = 30 # 30 seconds overlap + window_duration = 60 * 5 * data.samplerate # 5 minutes window + window_overlap = 30 * data.samplerate # 30 seconds overlap + raw_time = np.arange(data.shape[0]) window_starts = np.arange( - time[0], time[-1], window_duration) + raw_time[0], raw_time[-1], window_duration - window_overlap / 2) embed() exit() diff --git a/code/modules/filters.py b/code/modules/filters.py index 499a3dc..5192cdc 100644 --- a/code/modules/filters.py +++ b/code/modules/filters.py @@ -17,13 +17,14 @@ def bandpass_filter( rate : float The sampling rate lowf : float - The low frequency cutoff + The low cutoff frequency highf : float - The high frequency cutoff + The high cutoff frequency Returns ------- - np.ndarray : The filtered data + np.ndarray + The filtered data """ sos = butter(2, (lowf, highf), "bandpass", fs=rate, output="sos") fdata = sosfiltfilt(sos, data)