Skip to content

Refactoring, packaging and imports optimization#19

Merged
roelofsc merged 6 commits intodevelopfrom
cr-misc-optimizing-imports
Mar 11, 2026
Merged

Refactoring, packaging and imports optimization#19
roelofsc merged 6 commits intodevelopfrom
cr-misc-optimizing-imports

Conversation

@roelofsc
Copy link
Contributor

Several refactorings and improvements to enhance the project's maintainability, performance, and robustness.

Logging

  • Centralized configuration: Moved logging setup to the package's __init__.py. Logging is now configured once upon import using logging.yaml.
  • Fallbacks: Updated setup_logging in core/_logs.py to handle missing configuration files gracefully. It now defaults to a basic configuration (logging.basicConfig) instead of raising errors when a configuration file is missing or malformed, making the package more library-friendly.
  • Removed redundancy: Eliminated redundant setup_logging calls across multiple modules (fault_detector.py, fault_detection_model.py, quick_fault_detector.py).

Performance

  • Vectorized criticality calculation: Refactored calculate_criticality in energy_fault_detector/utils/analysis.py to use numpy vectorized operations and an efficient bounded cumulative sum loop. This provides a performance boost for large time-series datasets.

Infrastructure and Project Structure

  • Packaging: Migrated project configuration from legacy setup.py, requirements.txt, and .coveragerc to a modern pyproject.toml structure.
  • Tensorflow backend is imported only when needed (lazy).

@roelofsc roelofsc requested a review from cgueck895 February 20, 2026 09:57
@roelofsc roelofsc merged commit ce5a287 into develop Mar 11, 2026
1 check passed
@roelofsc roelofsc deleted the cr-misc-optimizing-imports branch March 11, 2026 12:02
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