Developer Guide for hdsemg-pipe¶
This guide is intended for developers who want to contribute to the hdsemg-pipe project.
Project Structure¶
The project is structured as follows:
src/
- Main source codeactions/
- Implementation of main functionalities (file management, ROI cropping, etc.)config/
- Configuration managementcontroller/
- Control logicsettings/
- Settings dialogsstate/
- State managementui_elements/
- Reusable UI componentswidgets/
- Main widgets for different processing steps_log/
- Logging functionality
Main Components¶
Processing Steps¶
The application is divided into several processing steps, implemented through separate widget classes in the widgets/
directory:
OpenFileStepWidget
- File selection and importDefineRoiStepWidget
- Region of Interest (ROI) definitionChannelSelectionStepWidget
- Channel selectionGridAssociationStepWidget
- Electrode grid associationDecompositionStepWidget
- Signal decomposition
State Management¶
Global state management is handled through the global_state.py
module in the state/
directory. This ensures consistency between different processing steps.
Configuration¶
Application configuration is managed in the config/
directory:
- config_manager.py
- Management of configuration settings
- config.json
- Persistent configuration file
- config_enums.py
- Enumeration types for configuration options
Development Guidelines¶
Code Style¶
- Follow PEP 8 for Python code style
- Use meaningful variable and function names
- Document complex functions with docstrings
Error Handling¶
- Implement appropriate error handling with try-except blocks
- Use the integrated logging system (
_log/
directory) - Catch Qt-specific exceptions appropriately
UI Development¶
- New UI elements should inherit from existing base classes
- Use Qt Designer for complex layouts
- Ensure new UI elements are responsive
Testing¶
- Write unit tests for new functionality
- Test edge cases in signal processing
- Perform manual UI testing
Build Process¶
Dependencies¶
Project dependencies are defined in two files:
- requirements.txt
- Python packages for pip
- environment.yml
- Conda environment definition
Resources¶
Qt resources are defined in resources.qrc
and need to be recompiled after changes:
pyrcc5 resources.qrc -o resources_rc.py
Versioning¶
Version management is handled through make_version.py
and version.py
.
Documentation¶
- Use MkDocs for project documentation
- Document changes in the corresponding markdown file in the
docs/
directory - Update screenshots in
docs/img/
directory when UI changes
Contributing¶
- Fork the repository
- Create a feature branch
- Implement your changes
- Run tests
- Create a pull request
Support¶
For questions or issues: - Check the existing documentation - Create an issue in the repository - Contact the development team
License¶
Make sure your contributions comply with the project license.