Skip to content

fix: retain samples in the database guide's capped fits - #465

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/database-guide-sample-weight-threshold
Aug 4, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/database-guide-sample-weight-threshold

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Closes #464.

scripts/guides/results/database/start_here.py fails with IndexError: list index out of range at line 358 (samples.parameter_lists[9][2]) in PyAutoHeart's release-integrate leg — run 30880450685, job integrate / run_scripts (3.12, autolens, guides), FAIL at 129.9s.

Cause

The script runs its own two Nautilus fits capped at n_like_max=300, then indexes sample 9. PyAutoFit/autofit/non_linear/samples/samples.py:398 applies config/output.yaml's samples_weight_threshold: 1.0e-10 when writing samples.csv, and a 300-evaluation nested-sampling run is so weight-peaked that only one sample clears it.

This is the same family as #274 / PyAutoFit#275 (release-validation cluster E). That fix consolidated the other guides/results tutorials onto _quick_fit.py, which sets the threshold to None at line 57 for exactly this reason — but this script was left out, because it must build a database from its own output folder over two differently-named datasets, which is the tutorial's subject.

Not a regression

e41b0fce added the auto-simulate guard to this script and removed its NEEDS_FIX entry from config/build/no_run.yaml. Yesterday's release run executed 41 scripts in the guides shard; today's executed 42. The script ran for the first time and hit a pre-existing defect.

The fix

conf.instance["output"]["samples_weight_threshold"] = None before the fit loop, with a short prose section explaining that the 300-evaluation cap is what makes the pruning bite and that a full-length fit does not need the line. Line 358 is unchanged — indexed sample access is the tutorial's subject, and the sibling results guides (aggregator/samples.py:200, aggregator/samples_via_aggregator.py:146) index [9] identically.

⚠️ Smoke cannot verify this fix

profile_smoke.yaml sets PYAUTO_SKIP_CHECKS=1, and samples.py:402 reads that as if skip_checks(): weight_threshold = None — the smoke profile disables the very threshold that causes the failure. A green smoke run on this PR is not evidence. The real gate is PyAutoHeart's release-integrate leg.

profile PYAUTO_SKIP_CHECKS threshold rows in samples.csv result
smoke 1 disabled 301 PASS
release 0 1e-10 1 FAIL

Evidence — control vs patched, both under profile_release.yaml

Run via autohands.env_config.build_env_for_script against config/build/profile_release.yaml, from a clean slate deleting output/database/, output/database.sqlite and output/database.info.

Control (unchanged script, main):

EXIT 1
  File ".../scripts/guides/results/database/start_here.py", line 358, in <module>
    print(samples.parameter_lists[9][2], "\n")
IndexError: list index out of range
     1 data rows  [TOO FEW]  database/simple/.../files/samples.csv
     1 data rows  [TOO FEW]  database/simple__no_lens_light/.../files/samples.csv

Patched (this branch):

EXIT 0
   300 data rows  [ok]  database/simple/.../files/samples.csv
   300 data rows  [ok]  database/simple__no_lens_light/.../files/samples.csv

The control reproduces the CI traceback line-for-line.

Scripts Changed

  • scripts/guides/results/database/start_here.py — import conf, disable samples_weight_threshold before the fit loop, and add a __Sample Retention__ prose section explaining why

No pending-release label: this is workspace-only and depends on no unreleased library API, so there is no library-first merge gate (same as #461, #463 and #450).

Note for anyone reproducing this

output/database.sqlite sits beside output/database/, so rm -rf output/database does not clear it and the aggregator silently reads the previous run's entries. That produced a false pass during diagnosis. A clean slate must delete the directory, the .sqlite and the .info.

Notebooks regenerated.

🤖 Generated with Claude Code

scripts/guides/results/database/start_here.py indexes sample 9 of the two
Nautilus fits it runs itself, but those fits are capped at n_like_max=300 and
the config/output.yaml samples_weight_threshold of 1e-10 prunes samples.csv to
a single row, so the index raised IndexError under the release profile.

Disable the threshold before the fits, as _quick_fit.py already does for the
other results guides, with a prose section explaining that the cap is what
makes the pruning bite.

The smoke profile sets PYAUTO_SKIP_CHECKS=1, which disables the threshold
outright, so smoke cannot reproduce this failure class.

Closes #464

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Jammy2211
Jammy2211 merged commit ec82b6b into main Aug 4, 2026
5 checks passed
@Jammy2211
Jammy2211 deleted the feature/database-guide-sample-weight-threshold branch August 25, 2026 18:56
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: database guide indexes sample 9 of a fit pruned to 1 sample

1 participant