Developer Guide¶
This guide provides information for developers who want to contribute to or modify the hdsemg-select application.
Project Structure¶
src/
├── __init__.py
├── main.py # Application entry point
├── version.py # Version information
├── _log/ # Logging configuration
├── config/ # Application configuration
├── controller/ # Application controllers
├── helper/ # Utility functions
├── select_logic/ # Core selection algorithms
├── settings/ # Settings management
├── state/ # Application state management
└── ui/ # User interface components
Development Setup¶
- Fork the repository
- Set up your development environment following the Installation Guide
- Install additional development dependencies:
bash pip install pytest pytest-cov pylint
Coding Standards¶
- Follow PEP 8 style guide
- Write docstrings for all public methods
- Maintain type hints
- Keep methods focused and single-responsibility
- Write unit tests for new features
Testing¶
Running Tests¶
python -m pytest
Test Coverage¶
python -m pytest --cov=src
Building¶
Resource Compilation¶
cd src
pyrcc5 resources.qrc -o resources_rc.py
Creating Executables¶
- Windows:
bash pyinstaller src/hdsemg_select-win.spec
- macOS:
bash pyinstaller src/hdsemg_select-macos.spec
Core Components¶
Signal Processing¶
- Located in
select_logic/data_processing.py
- Handles raw signal manipulation
- Implements filtering algorithms
Artifact Detection¶
- Located in
select_logic/auto_flagger.py
- ECG contamination detection
- Power line noise identification
- Custom artifact detection algorithms
UI Components¶
- Based on PyQt5
- Custom widgets in
ui/widgets/
- Plot components using pyqtgraph
Contributing¶
Pull Request Process¶
- Create a feature branch
- Implement changes
- Add/update tests
- Update documentation
- Submit PR with description
Version Control¶
- Use semantic versioning
- Update version.py
- Document changes in CHANGELOG.md
Architecture¶
Data Flow¶
- File Loading → Grid Detection → Signal Processing
- User Interface ←→ State Management
- Selection Logic → Data Export
State Management¶
- Centralized state in
state/state.py
- Event-driven updates
- PyQt signals and slots
Performance Considerations¶
Large Dataset Handling¶
- Implement pagination
- Use memory-efficient data structures
- Consider chunked processing
Optimization Tips¶
- Profile code using cProfile
- Optimize heavy computations
- Use NumPy for array operations
Debugging¶
Logging¶
- Configure in
_log/log_config.py
- Use appropriate log levels
- Include context in log messages
Common Issues¶
- Resource compilation errors
- Memory management
- Qt event loop issues
Future Development¶
Planned Features¶
- Additional file format support
- Enhanced artifact detection
- Performance optimizations
- Extended analysis tools
Roadmap¶
- Improve automatic detection
- Add batch processing
- Implement additional exports
- Enhance visualization options