Skip to content

fix: quick update tolerates an out-of-disk max-likelihood instance - #1568

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/quick-update-tolerates-invalid-instance
Sep 7, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/quick-update-tolerates-invalid-instance

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

A quick update is a convenience render inside the likelihood call the sampler is driving; nothing in it may terminate a search. Fitness.manage_quick_update called model.instance_from_vector on the running max-likelihood vector unguarded, so when that vector mapped to an unphysical instance (an out-of-disk ell_comps, magnitude 1.009, raising PyAutoGalaxy's ModelParameterException from the profile constructor) the exception unwound through nautilus.sampler.evaluate_likelihood and killed a 36 h Euclid DR1 run 3m52s in, before any partial result existed (RAL array 342301 task 3). Closes #1567.

The guard now wraps instance construction: on failure the skip is logged with the traceback, the visual (both the background-worker submit and the synchronous render) is skipped, the model.results text is still written from the parameter vector, and the cadence counter still resets so the update does not re-fire on every later evaluation. The synchronous render also gains the except Exception protection the background worker (BackgroundQuickUpdate._process_pending) already had.

Exception is caught rather than af.exc.FitException alone: the contract is "a render never kills a search", and this makes the synchronous path match the background one.

Channel map: #1487 closed the results-write channel (Result.instance falls back to Samples.max_log_likelihood()); #1538 / PyAutoGalaxy#589 shipped the opt-in joint disk projection, which only gradient searches consume (Nautilus has no clipper hook); this PR closes the quick-update channel. The pipeline leg (euclid_strong_lens_modeling_pipeline, same issue) bounds the source MGE ell_comps box inside the unit disk so the unphysical region is not sampled in the first place.

API Changes

None — internal. Behaviour change only: a quick update whose max-likelihood vector cannot be turned into a model instance, or whose synchronous visual raises, now logs and skips instead of propagating out of the likelihood call.

Test Plan

  • New test_autofit/non_linear/test_quick_update_invalid_instance.py: the regression case fails on unfixed code (the ValueError/FitException propagates) and passes with the guard; positive control (valid vector still renders); synchronous visual that raises is swallowed and logged.
  • pytest test_autofit/non_linear: 803 passed, 1 skipped.
  • CI green.
Full API Changes (for automation & release notes)

Removed

  • None

Added

  • None

Changed

  • autofit.non_linear.fitness.Fitness.manage_quick_update — model-instance construction and the synchronous perform_quick_update call are guarded; failures log (logger.exception) and skip the visual; the search continues and model.results is still written.

Migration

  • None.

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

https://claude.ai/code/session_01P5K4AXFBYMCPhbNFYA24YX

…1567)

`Fitness.manage_quick_update` called `model.instance_from_vector` on the
running max-likelihood vector unguarded, inside the likelihood call the
sampler drives. An unphysical vector (out-of-disk `ell_comps`, magnitude
1.009) raised `ModelParameterException` from the profile constructor and
killed a 36 h Nautilus run at its first quick update (RAL 342301 task 3).

Guard instance construction: log the skip with the traceback, bypass the
visual on both the background-submit and synchronous branches, still write
the model.results text, still reset the cadence counter. The synchronous
render also gains the `except Exception` protection the background worker
already had. Regression test fails on the unguarded code.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P5K4AXFBYMCPhbNFYA24YX
@Jammy2211

Copy link
Copy Markdown
Collaborator Author

Pipeline leg: PyAutoLabs/euclid_strong_lens_modeling_pipeline#53 (merge this library PR first).

@Jammy2211
Jammy2211 merged commit f6a9915 into main Sep 7, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/quick-update-tolerates-invalid-instance branch September 7, 2026 17:14
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Sep 26, 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.

fix: quick update tolerates an out-of-disk max-likelihood instance

1 participant