Skip to content

Fix sample rate handling and improve HTML report#3

Open
solomon23 wants to merge 2 commits intoAJolly:mainfrom
solomon23:fix/sample-rate-and-report-improvements
Open

Fix sample rate handling and improve HTML report#3
solomon23 wants to merge 2 commits intoAJolly:mainfrom
solomon23:fix/sample-rate-and-report-improvements

Conversation

@solomon23
Copy link
Contributor

@solomon23 solomon23 commented Feb 23, 2026

Summary

  • Fix 1Hz assumption bug: The spike detector assumed 1 sample/second, but the O2Ring S records at 4-second intervals. This caused recording lengths to show ~1/4 of actual time and inflated all per-hour metrics (SI/hr, TAB, PC10/hr, etc.) by ~4x. Fixed by resampling to 1Hz in load_data() when CSV timestamps indicate non-1s intervals. Works with any sample rate.
  • Fix chart IndexError: Chart generation used original CSV row count for time axis but resampled event indices. Now generates a 1Hz time axis matching the resampled data.
  • Report improvements: Add year to dates, add editable Notes column from filename remarks, remove redundant Night Label column, auto-uncheck daytime sessions, skip detector_results.csv from analysis, add explicit white background for dark mode viewers.

Screenshot

HR Spike Detection Report

Test plan

  • Verify recording lengths match filename durations (e.g., _8h_26m.csv should show ~8h 26m)
  • Verify per-hour metrics are reasonable (SI/hr ~5-30 for typical nights, not ~20-120)
  • Verify charts generate without IndexError
  • Verify daytime sessions (start 6am-8pm) are unchecked by default
  • Verify Notes column shows filename remarks
  • Test with 1Hz data (original O2Ring) to confirm no regression

🤖 Generated with Claude Code

solomon23 and others added 2 commits February 22, 2026 19:41
The spike detector assumed 1Hz sampling, but the O2Ring S records at
4-second intervals. This caused recording lengths to show ~1/4 of
actual time and inflated all per-hour metrics by ~4x.

Fix by resampling to 1Hz in load_data() when CSV timestamps indicate
non-1s intervals. Also generate a matching 1Hz time axis for charts.

Report improvements:
- Add year to Date/Time column
- Add editable Notes column (extracted from filename remarks)
- Remove redundant Night Label column
- Uncheck daytime sessions (6am-8pm) by default
- Skip detector_results.csv from being analyzed as data
- Add explicit white background for dark mode compatibility

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@AJolly
Copy link
Owner

AJolly commented Feb 24, 2026

Thanks for yourr changes! can you check against the latest version? And your bot is wrong - the o2ring-s works on 1second resolution, not 4. The older o2ring works on 4 second resolution

Hope the project is useful for you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants