We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 26c6a4d commit 2769dabCopy full SHA for 2769dab
src/data_analysis/heart_rate_variability/exploring_heart_rate_variability.clj
@@ -157,15 +157,18 @@
157
(defn LF-to-HF [freqs spectrogram]
158
(let [ds (tc/dataset {:f freqs
159
:s (:magnitude spectrogram)}
160
- tc/dataset)]
161
- (/ (-> ds
162
- (tc/select-rows #(<= 0.04 (% :f) 0.15))
163
- :s
164
- tcc/sum)
165
- (-> ds
166
- (tc/select-rows #(<= 0.15 (% :f) 0.4))
167
168
- tcc/sum))))
+ tc/dataset)
+ lf-power (-> ds
+ (tc/select-rows #(<= 0.04 (% :f) 0.15))
+ :s
+ tcc/sum)
+ hf-power (-> ds
+ (tc/select-rows #(<= 0.15 (% :f) 0.4))
+ tcc/sum)]
169
+ (if (pos? hf-power)
170
+ (/ lf-power hf-power)
171
+ Double/NaN))) ; Return NaN when HF power is zero or negative
172
173
(defn plot-with-measures [{:keys [sampling-rate
174
window-size
0 commit comments