Skip to content

Fix adaptive frequency bounds#284

Draft
Erikpostt wants to merge 8 commits into
mainfrom
fix-adaptive-frequency-bounds
Draft

Fix adaptive frequency bounds#284
Erikpostt wants to merge 8 commits into
mainfrom
fix-adaptive-frequency-bounds

Conversation

@Erikpostt

Copy link
Copy Markdown
Contributor

Description

Describe the purpose of this pull request. Also link any related issues.

Changes

List the changes you have made.

Additional Information

Include any additional information, such as how to test your changes.

Checklist

  • Tests passed
  • Documentation updated

- Add sampling_frequency property with setter to IMUConfig
- Implement _update_frequency_dependent_params() virtual method
- Override in GaitConfig: auto-clamp spectrum_high_frequency and mfcc_high_frequency to Nyquist
- Override in TremorConfig: auto-clamp fmax_peak_search and fmax_mfcc to Nyquist
- Add warnings when frequency bounds are clamped for safety
- Fixes issue where 50Hz/64Hz data caused 'out of bounds' errors in feature extraction

This allows users to set sampling_frequency at any point and freq-dependent params
adapt automatically, preventing Nyquist violations without manual config management.
…ss initialization

This fixes the initialization order bug where the update method was being called
in IMUConfig.__init__() before subclass attributes like mfcc_high_frequency were
set. Solution: defer calls until the end of GaitConfig and TremorConfig __init__.

The property setter still works for post-initialization frequency changes, and
the virtual method pattern correctly updates all bounds when sampling_frequency
changes at any point in the config lifecycle.

Verified with test_adaptive_frequencies_demo.py - all 3 tests pass.
- Remove test_adaptive_frequencies_demo.py (development validation only)
- Remove implementation notes from IMUConfig (internal architectural detail)
- Keep core adaptive frequency bounds implementation clean for production

Commit validates that all 3 frequency test cases (50/64/100 Hz) pass successfully.
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.

1 participant