-
Notifications
You must be signed in to change notification settings - Fork 372
Open
Labels
Milestone
Description
Problem
MMMPlotSuite.sensitivity_analysis() appears self-contained (no external data argument), but at runtime it reads from self.idata.sensitivity_analysis -- a group that doesn't exist after fitting. It's injected by a separate SensitivityAnalysis.run_sweep(..., extend_idata=True) call.
This means:
- The method looks like it should work out of the box (like
residuals_over_time()orsaturation_scatterplot()), but silently depends on a prior side-effect. - The dependency is invisible in the method signature -- there's no parameter hinting that external data is needed.
- The error message ("No sensitivity analysis results found. Call
.sensitivity.run_sweep()first.") is helpful, but the design itself is fragile: it relies on dynamically attaching a group toidataviahasattrchecking.
Recommendation
Make the data dependency explicit by accepting the sensitivity analysis results as a parameter (e.g., sensitivity_analysis(data: xr.Dataset | xr.DataArray)), consistent with how budget_allocation(samples=...), cv_predictions(results=...), and saturation_curves(curve=...) handle external data. Keep the current fallback to self.idata.sensitivity_analysis for backwards compatibility if desired.
Reactions are currently unavailable