Bumped up version to 0.3.0 Reducing cognitive complexity#9
Open
TestmanX wants to merge 3 commits into
Open
Conversation
Fix for transfer function's relative import. Fix for Bitalino_rev comparison. Switched to f strings formatting
Summary of Changes: Transfer Functions signal resolution fix, check for 6bit or 10bit, raise error otherwise plot() method refactoring Extracted _normalize_sensors() - handles sensor input normalization Extracted _plot_multiple_signals() - handles multi-signal plotting Extracted _plot_single_signal() - handles single signal plotting Extracted _plot_signal() - core plotting logic for single axis Reduced cognitive complexity from ~170 lines with deep nesting to focused helper methods (20-40 lines each) __init__() method refactoring Extracted _init_member_variables() - initializes all member variables Created load_file() - separates file loading from initialization Removes coupling between init and plotting side effects Enables cleaner testing and reusability Combined signal() and raw() methods. Created _get_signal_data() helper method (lines 294-340): Unified implementation for both signal() and raw() Takes use_raw parameter to select between raw/converted signals Reduced code duplication by ~60% Simplified validation logic Refactored public methods: signal() - now just calls _get_signal_data(sensors, use_raw=False) raw() - now just calls _get_signal_data(sensors, use_raw=True) Clearer variable names (num_sensors, col_idx, res_idx, etc.) Better separation of concerns
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes:
Transfer Functions signal resolution fix, check for 6bit or 10bit, raise error otherwise
plot() method refactoring
Extracted _normalize_sensors() - handles sensor input normalization
Extracted _plot_multiple_signals() - handles multi-signal plotting
Extracted _plot_single_signal() - handles single signal plotting
Extracted _plot_signal() - core plotting logic for single axis
Reduced cognitive complexity from ~170 lines with deep nesting to focused helper methods (20-40 lines each)
init() method refactoring
Extracted _init_member_variables() - initializes all member variables
Created load_file() - separates file loading from initialization
Removes coupling between init and plotting side effects
Enables cleaner testing and reusability
Combined signal() and raw() methods.
Created _get_signal_data() helper method (lines 294-340):
Unified implementation for both signal() and raw()
Takes use_raw parameter to select between raw/converted signals
Reduced code duplication by ~60%
Simplified validation logic
Refactored public methods:
signal() - now just calls _get_signal_data(sensors, use_raw=False)
raw() - now just calls _get_signal_data(sensors, use_raw=True)
Clearer variable names (num_sensors, col_idx, res_idx, etc.)
Better separation of concerns