Skip to content

Fix AnalysisFactor.visualize_combined dispatch in FactorGraph - #1253

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/alma-datacube
May 5, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/alma-datacube

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Fixes a silent dispatch bug in af.FactorGraphModel's combined-visualization path. FactorGraphModel.visualize_combined calls model_factors[0].visualize_combined(model_factors, ...), but AnalysisFactor did not define visualize_combined itself — so the lookup fell through to Analysis.__getattr__'s auto-forwarder, which explicitly skips visualizer methods whose signature contains analyses ("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_combined and visualize_before_fit_combined directly to AnalysisFactor, forwarding to self.analysis.Visualizer.<method>(analyses=...) with the wrapper-unwrapped Analysis instances. The skip-guard in Analysis.__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's visualize_combined static method. Previously it silently no-op'd.

Migration

None. Purely additive — no existing API changes.

Linked Issues

Test Plan

  • Existing graphical/declarative test suite passes (184/184).
  • autolens_workspace_test/scripts/multi/visualization_imaging.py confirms fit_combined.png is now produced via the dispatch chain (was silently MISSING before this fix).
  • autolens_workspace_test/scripts/multi/visualization_interferometer.py confirms the same for interferometer datacubes (paired with the PyAutoLens visualizer addition shipping on the same branch).

🤖 Generated with Claude Code

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) <noreply@anthropic.com>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label May 5, 2026
@Jammy2211
Jammy2211 merged commit 65a2787 into main May 5, 2026
3 checks passed
@Jammy2211
Jammy2211 deleted the feature/alma-datacube branch May 5, 2026 07:35
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Sep 4, 2026
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.

1 participant