You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement comprehensive error handling system (fixes#36) (#38)
* Implement comprehensive error handling system
- Add custom exception classes with recovery suggestions
- Create structured AnalysisResult class for comprehensive error reporting
- Implement input validation helpers to catch errors early
- Add comprehensive error handling to RandomizedBenchmarkingResult.analyze()
- Maintain backward compatibility with DataFrame returns
- Add 38 comprehensive tests covering all error scenarios
Addresses GitHub issue #36 (Weak error handling).
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Extend comprehensive error handling to Rabi and T1 experiments
- Add comprehensive error handling to RabiAnalysisResult with fitting validation
- Add comprehensive error handling to T1AnalysisResult with exponential decay fitting
- Create new Data classes for structured measurement data
- Implement proper input validation, fitting error recovery, and quality checks
- Add plotting with error handling following plot_settings.md guidelines
- Maintain backward compatibility with DataFrame returns
- Add comprehensive tests for both experiment types
- Fix T1 validation to allow zero delay times (common in T1 measurements)
All experiments now follow the same unified error handling pattern with:
✅ Custom exception handling with recovery suggestions
✅ Structured AnalysisResult with warnings and errors
✅ Input validation before expensive operations
✅ Graceful fitting failure recovery
✅ Quality validation of fitting results
✅ Comprehensive test coverage
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Fix forward reference Union syntax for Python compatibility
- Fix CHSHData.analysis_result to use Union["CHSHAnalysisResult", None]
- Forward references in quotes require Union syntax, not | operator
- Maintain Python 3.10+ compatibility for type hints
All 46 error handling tests now pass successfully.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Fix Rabi experiment integration with new error handling system
- Update Rabi experiment class to use new RabiData and RabiAnalysisResult pattern
- Create RabiData with proper measurement data structure
- Initialize RabiAnalysisResult with required data, raw_results, and experiment_instance
- Add default probability errors and shots for backward compatibility
- Maintain existing DataFrame return behavior
All 447 tests now pass successfully including the improved error handling.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Clean up redundant error handling code in experiment classes
Remove duplicate plotting and saving methods from Rabi and T1 experiments:
**Rabi experiment cleanup:**
- Remove _create_plot() method (137 lines) - handled by RabiAnalysisResult
- Remove _save_results() method (18 lines) - handled by RabiAnalysisResult
- Update analyze() to use new RabiData and RabiAnalysisResult pattern
- Simplify flow: analysis handled entirely by model classes
**T1 experiment cleanup:**
- Remove _create_plot() method (112 lines) - handled by T1AnalysisResult
- Remove _save_results() method (18 lines) - handled by T1AnalysisResult
- Update analyze() to use new T1Data and T1AnalysisResult pattern
- Maintain consistent error handling architecture
**Benefits:**
✅ Reduced code duplication (300+ lines removed)
✅ Centralized error handling in model classes
✅ Consistent plotting and saving behavior
✅ Easier maintenance and testing
✅ All tests still pass
The new architecture separates concerns properly:
- Experiment classes: circuit generation and data collection
- Model classes: analysis, error handling, plotting, and saving
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Refactor analysis results and validation in experiments
- Updated T1 and T2 Echo experiments to utilize new data structures for analysis results.
- Improved error handling in CHSH, Hadamard Test, Rabi, and Ramsey models to use a unified error reporting system.
- Enhanced validation helpers to include non-negative checks for amplitude values.
- Adjusted plotting functions to set logarithmic scales for better visualization of decay processes.
- Modified DataFrame structures in tests to align with new analysis result formats.
- Removed redundant code and improved overall readability and maintainability of the experiment modules.
* Fix Rabi oscillation formula for RX gates and clarify π-pulse calibration
---------
Co-authored-by: Claude <[email protected]>
0 commit comments