c332161a5edc9d12a52f628ef1602ffffe9af950
Overview
- Data source:
SingleRecordings/<id>/{hr.csv, rr.csv, timestamps.csv} - Scripts:
plot_meditation_data.py: per-recording plots (raw + moving averages + segment boxplots)aggregate_segments_analysis.py: aggregate metrics/plots across recordings with exactly 4 marks (conditions)
How calculations are done
-
HR and RR loading
- Read
timestamp(ms) → convert to datetime; set as index. - HR column:
hr(beats per minute). RR column:rr_ms(milliseconds).
- Read
-
Moving averages (per recording)
- Time-based rolling means over irregular timestamps using windows: 5 s, 10 s, 30 s, 60 s.
- X-axis is seconds from each recording’s start.
-
Mark handling (per recording)
- Vertical lines at marks from
timestamps.csv. - Segment boxplots use values in: each interval between consecutive marks and the final interval (last mark → end).
- Vertical lines at marks from
-
RMSSD (HRV)
- Definition: RMSSD = sqrt(mean(diff(RR_ms)^2)) using successive RR intervals (ms).
- Aggregate per-condition RMSSD: computed over all RR samples within each condition’s time window (recording-level); requires ≥2 RR samples.
- Aligned time-series RMSSD: first compute a 30 s time-based rolling RMSSD per recording, then align and average across recordings (see below).
-
Aggregate metrics across recordings (exactly 4 marks)
- Conditions (English labels):
- Breathing Scene 1 (pre-first mark)
- Spring Scene (1st–2nd mark)
- Summer Scene (2nd–3rd mark)
- Autumn Scene (3rd–4th mark)
- Breathing Scene 2 (post-last mark)
- Per recording: compute medians for HR and RR within each condition; compute RMSSD within each condition.
- Summary CSV aggregates these per-recording values; boxplots show distributions. The mean of each condition is marked by a black dot on the boxplots.
- Conditions (English labels):
-
Aligned average curves (HR, RR, RMSSD)
- Only recordings with exactly 4 marks are used.
- For each recording, durations of the five segments are measured; median segment proportions across recordings define a normalized 0–1 time axis with aligned boundaries.
- Each recording’s series is piecewise-linearly time-normalized to this axis, interpolated to a common grid, and then averaged (mean ± 1 SD). For RMSSD, a 30 s rolling RMSSD is used before alignment.
Results
| Condition | HR (bpm) | RR (ms) | RMSSD (ms) |
|---|---|---|---|
| Breathing Scene 1 | 72.61 | 843.33 | 52.70 |
| Spring Scene | 72.33 | 860.78 | 56.95 |
| Summer Scene | 72.50 | 862.00 | 41.15 |
| Autumn Scene | 72.89 | 850.44 | 41.89 |
| Breathing Scene 2 | 73.78 | 839.94 | 42.59 |
Plots
Aggregate Boxplots
Aligned Average Curves
Description
Languages
Python
100%





