Conversation
…plete Job.perform() in autofit/non_linear/grid/sensitivity/job.py used to short-circuit `dataset = None` when `is_complete` was True (commit 41095a0, Oct 2024 "skip simulation if job is complete") but still called base_fit_cls / perturb_fit_cls with that None. Consumer Analysis classes that unpack `dataset.data` / `dataset.noise_map` in __init__ — including the user-facing autofit_workspace/scripts/features/sensitivity_mapping.py tutorial — crash on re-runs with `AttributeError: 'NoneType' object has no attribute 'data'`. Always call simulate_cls. The expensive non-linear search is still skipped on re-runs via Search.fit's load-from-zip path (paths.restore() unzips, paths.is_complete returns True, result_via_completed_fit loads samples from disk). Only the typically-cheap simulator cost is no longer optimized away. The library's own `test_perform_twice` test in `test_autofit/non_linear/grid/test_sensitivity/test_functionality.py` masked the contract issue because the test conftest's `Analysis.__init__` simply stores `dataset` without unpacking — real workspace code unpacks it eagerly.
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
AttributeError: 'NoneType' object has no attribute 'data'on re-runs of sensitivity mapping.Job.perform()was producingdataset = Noneas a "skip simulation if job is complete" optimization (commit 41095a0, Oct 2024), then handing thatNonestraight tobase_fit_cls/perturb_fit_cls. ConsumerAnalysisclasses that unpackdataset.data/dataset.noise_mapin__init__— including the user-facingautofit_workspace/scripts/features/sensitivity_mapping.pytutorial — crashed.The fix is a 7-line change: always call
simulate_cls. Re-runs still skip the expensive non-linear search viaSearch.fit's load-from-zip path (paths.restore()unzips,paths.is_completereturns True,result_via_completed_fitloads samples from disk). Only the typically-cheap simulator call is no longer optimized away.The library's own
test_perform_twicetest intest_autofit/non_linear/grid/test_sensitivity/test_functionality.pymasked the contract issue because the test conftest'sAnalysis.__init__simply storesdatasetwithout unpacking — real workspace code unpacks it eagerly.API Changes
None — internal change only.
Job.perform()is library-internal; no public symbols added, removed, renamed, or signature-changed. The behavioural change is "re-runs of sensitivity mapping no longer crash" — strictly a fix.Test Plan
pytest test_autofit/non_linear/grid/test_sensitivity/passes 25/25 (incl.test_perform_twice).autofit_workspace_test/scripts/database/scrape/sensitivity.pyreproduced theAttributeErroron re-run pre-fix; passes on a clean two-run cycle post-fix (first run completes, second run hitsis_complete=Truefor both cells via zip presence,Search.fit.restore()unzips, load path returns).Known limitation (out of scope)
If a previous run was killed mid-fit (leaving e.g.
[perturb].zippresent but[base].zipmissing), the re-run will hit a different failure on that cell:Search.fitfinds no zip to restore for the missing side,paths.is_completeis False, the resume logic kicks in, andFitness.check_log_likelihoodraisesSearchExceptionbecause the new (non-deterministic) simulator output's FoM doesn't match the persisted partial-fit FoM. That's a separate bug from this one — flagged for follow-up. This PR fixes only theis_complete=Truepath that producedNone.🤖 Generated with Claude Code