feat: Add comprehensive uncertainty analysis and fit validation to FitResult classFeat/add pcov in fit#3
Open
joanjcaceres wants to merge 46 commits intoUlysseREGLADE:mainfrom
Open
Conversation
… class ResonatorParams
…e hints - Updated synthetic_signal.py to import resonator functions from resonators module. - Simplified parameter handling in get_synthetic_resonance function. - Improved docstrings and added type hints in utils.py for better clarity and type safety. - Introduced new utility functions for SI prefix formatting and enhanced existing functions. - Updated pyproject.toml to include configuration for Ruff linter with specific rules and exclusions.
…es for numpy, scipy, and matplotlib; format readme.ipynb for improved readability
- Fix syntax error where @Property decorator was malformed - Ensure all property methods are properly defined - Maintain code quality after linting improvements
- Remove trailing whitespace - Maintain code quality standards - Final cleanup before PR
- Fixed circular import between plot.py and resonators.py - Added analyze() function as new API entry point - Fixed syntax errors from merge conflict resolution - Corrected typo in __init__.py exports - All functionality tested and working: * FitResult class with uncertainty analysis * Parameter error calculation from covariance matrix * Goodness of fit metrics (R², χ²_red, RMS) * Fit validation with warnings and recommendations * Parameter correlation analysis
This commit addresses the API redundancy issue where fit_signal() returned (fit_func, FitResult) but FitResult.fit_func already contained the same function. Major changes: - Created _fit_signal_core() as internal implementation returning only FitResult - Modified fit_signal() to be a deprecated wrapper with proper DeprecationWarning - Enhanced analyze() as the recommended API with comprehensive documentation - Added plot() method to FitResult class for direct visualization - Fixed parameter naming bug in plot.py (red_Warning → red_warning) Backward compatibility is fully maintained while providing a clear migration path from the redundant fit_signal() API to the cleaner analyze() API. The refactor eliminates redundancy while preserving all existing functionality and adding enhanced plotting capabilities through FitResult.plot().
…esult export and add _get_fit_summary() for detailed fit summaries
…itResult object creation
…oved fit validation and plotting
…tore original signal for improved analysis
…h original and background-corrected signals
…ground-corrected signal and remove original signal overlay
…/abcd_rf_fit into feat/add-pcov-in-fit
…/abcd_rf_fit into feat/add-pcov-in-fit
…/abcd_rf_fit into feat/add-pcov-in-fit
6d01d73 to
53b2e90
Compare
This reverts commit 6d01d73.
… at resonance frequency
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.
This pull request introduces significant updates to the
abcd_rf_fitpackage, focusing on refactoring, code cleanup, and enhanced documentation for improved usability and maintainability. The most important changes include removing theresonators-checkpoint.pyfile, adding type hints and docstrings to key functions, and enhancing thefit_signalfunction to return aFitResultobject with additional fit quality metrics.Code cleanup and removal:
abcd_rf_fit/.ipynb_checkpoints/resonators-checkpoint.pyfile, which included unused functions and classes for resonator modeling. This streamlines the codebase and eliminates redundancy.Enhanced documentation and type hints:
abcd_rf_fit/abcd_rf_fit.py, includingget_abcd,abcd2params,get_fit_function,meta_fit_edelay, andfit_signal. These updates clarify function purposes, parameters, and return values, improving code readability and usability. [1] [2] [3] [4] [5]Functional improvements:
fit_signalfunction to return aFitResultobject, which includes parameter uncertainties, goodness-of-fit metrics, and validation capabilities. This provides users with more detailed insights into the fit quality and results.meta_fit_edelayfunction to use a reduced number of test points (21 instead of 1001) for electrical delay estimation, improving computational efficiency.Package structure updates:
abcd_rf_fit/__init__.pyfile to includeFitResultandResonatorParamsin the module's exports (__all__), ensuring these components are accessible when importing the package.These changes collectively enhance the robustness, usability, and maintainability of the
abcd_rf_fitpackage.[Copilot is generating a summary...]