Fix AnalysisFactor.visualize_combined dispatch in FactorGraph#1253
Merged
Fix AnalysisFactor.visualize_combined dispatch in FactorGraph#1253
Conversation
af.FactorGraphModel.visualize_combined calls model_factors[0].visualize_combined(model_factors, ...) — but AnalysisFactor did not define this method, so the lookup fell through to Analysis.__getattr__'s auto-forwarder, which explicitly skips any visualizer method whose signature contains 'analyses' and returns None. Result: combined plots like fit_combined.png were silently never produced for any multi-dataset fit (imaging or interferometer). Add visualize_combined and visualize_before_fit_combined directly on AnalysisFactor that forward into self.analysis.Visualizer.<method> with the AnalysisFactor wrappers unwrapped to their underlying Analysis instances. The auto-forwarder's skip behaviour is unchanged (still protects single-analysis callers); the FactorGraph dispatch path now bypasses it cleanly. Linked: PyAutoLabs/autolens_workspace#120 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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
Fixes a silent dispatch bug in
af.FactorGraphModel's combined-visualization path.FactorGraphModel.visualize_combinedcallsmodel_factors[0].visualize_combined(model_factors, ...), butAnalysisFactordid not definevisualize_combineditself — so the lookup fell through toAnalysis.__getattr__'s auto-forwarder, which explicitly skips visualizer methods whose signature containsanalyses("Skipping {item} as this is not a combined analysis"). The result: no combined plots were ever produced during multi-dataset fits — for imaging or interferometer.This fix adds
visualize_combinedandvisualize_before_fit_combineddirectly toAnalysisFactor, forwarding toself.analysis.Visualizer.<method>(analyses=...)with the wrapper-unwrappedAnalysisinstances. The skip-guard inAnalysis.__getattr__is unchanged (it still protects single-analysis callers), but the FactorGraph dispatch path now bypasses it cleanly.API Changes
API Changes
Added
AnalysisFactor.visualize_combined(analyses, paths, instance, during_analysis, quick_update=False)— forwards combined-visualization to the wrapped analysis's Visualizer.AnalysisFactor.visualize_before_fit_combined(analyses, paths, model)— forwards combined before-fit visualization.Changed Behaviour
af.FactorGraphModel.visualize_combined(...)now actually invokes the wrapped Visualizer'svisualize_combinedstatic method. Previously it silently no-op'd.Migration
None. Purely additive — no existing API changes.
Linked Issues
Test Plan
autolens_workspace_test/scripts/multi/visualization_imaging.pyconfirmsfit_combined.pngis now produced via the dispatch chain (was silently MISSING before this fix).autolens_workspace_test/scripts/multi/visualization_interferometer.pyconfirms the same for interferometer datacubes (paired with the PyAutoLens visualizer addition shipping on the same branch).🤖 Generated with Claude Code