File tree Expand file tree Collapse file tree
src/data_analysis/heart_rate_variability Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4949 (:import [com.github.psambit9791.jdsp.signal CrossCorrelation]
5050 [com.github.psambit9791.jdsp.signal.peaks FindPeak]
5151 [com.github.psambit9791.jdsp.filter Butterworth]
52- [com.github.psambit9791.jdsp.transform DiscreteFourier]))
52+ [com.github.psambit9791.jdsp.transform DiscreteFourier]
53+ [com.github.psambit9791.jdsp.windows Hanning]))
5354
5455; ; ## My pulse-to-pulse intervals
5556
127128 4
128129 0.04 ; Lower cutoff at 0.04 Hz to remove baseline drift
129130 0.4 )
130- fft (DiscreteFourier. (double-array window-filtered))
131+ ; ; Apply Hann window to reduce spectral leakage
132+ hann-window (-> (Hanning. window-size) .getWindow)
133+ window-windowed (map * window-filtered hann-window)
134+ fft (DiscreteFourier. (double-array window-windowed))
131135 _ (.transform fft)
132136 whole-magnitude (.getMagnitude fft true )]
133137 {:t (* w hop-size (/ 1.0 sampling-rate))
You can’t perform that action at this time.
0 commit comments