fix: mixed-dataset factor graphs crash combined visualization#587
Merged
Conversation
A mixed-dataset FactorGraphModel (e.g. AnalysisImaging + AnalysisWeak, the weak series' combined strong+weak example) routes every factor's analysis into the lead factor's Visualizer.visualize_combined, which previously treated all of them as its own type (AttributeError: 'FitWeak' object has no attribute 'data'). VisualizerImaging / VisualizerInterferometer now filter to their own Analysis type before building fits, returning early (before plotter construction) when none remain; every factor still visualizes its own fit individually. First mixed-type graph exercised this path. Surfaced by the combined strong+weak example (autolens_workspace#247). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
The first mixed-dataset
FactorGraphModel(AnalysisImaging + AnalysisWeak, built by the weak series' combined strong+weak example) crashed during on-the-fly visualization: PyAutoFit routes every factor's analysis into the lead factor'sVisualizer.visualize_combined, and the imaging/interferometer implementations assumed all analyses were their own type (AttributeError: 'FitWeak' object has no attribute 'data'). Both now filter to their ownAnalysistype before building fits and return early (before plotter construction) when none remain; every factor still visualizes its own fit individually. Surfaced by autolens_workspace#247.API Changes
None — internal fix to visualization behaviour under mixed factor graphs.
Test Plan
VisualizerImaging.visualize_combinedwith only non-imaging analyses returns without touching paths.test_autolens/suite: 357 passed.modeling.pyjoint Nautilus fit runs to completion (previously crashed at the first combined-visualization call).Validation checklist (--auto run)
🤖 Generated with Claude Code