Repository navigation
perf: corner_anesthetic on 20 parameters in ~30 s, not 40+ min - #1761
Merged
Merged
Conversation
- Run pandas' shared-axis label pass once after plot_2d instead of after every panel (it walks every axis each time: n^4). - Build NestedSamples without labelled columns (copied per panel) and put the LaTeX labels back with axes.set_labels. - Above max_detailed_parameters (10): 2D histograms instead of KDE contours in the lower triangle and no upper triangle; caller kinds/upper win. - output_figure saves via the figure: plt.savefig re-renders via draw_idle. - Search skips the full corner plot above max_parameters_search (30). - Corner plots of weighted and chain searches are made once the fit is complete, not at every iterations_per_full_update (plots_during_fit). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…review) Deferring pandas' shared-axis pass let the bottom-right diagonal's twin axis settle on its own curve's range, so the last parameter's 1D posterior was drawn shifted against its tick labels. Re-impose each twin's x range from its parent after the replay (autoscale flags unchanged): seeded default, compact, subset and latent plots are pixel-identical to main. The deferral test now compares every axis's limits, with the KDE kinds. The skipped-full-corner log no longer promises per-component plots a single-component model (or components switched off) does not make. Co-Authored-By: Claude Opus 5.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
corner_anestheticon a 20-parameter model took more than 40 minutes (HowToLens chapter 2 tutorial 2, 14,534 weighted Nautilus samples). It now takes about 25–32 s. Closes #1760.Why it got slow. It didn't, really. Before 2026-10-04 this plot never drew for models with two components of the same name: repeated LaTeX labels made anesthetic raise
KeyError, which@log_plot_exceptionswallowed. 9db2921 fixed the labels and exposed the cost. The pandas 3 upgrade is not the cause (same timing in the old environment). Details in the issue comment.main.plt.savefigdraws the whole figure a second time after savingoutput_figuresaves via the figure. Every search plot gains.Two behaviour changes to judge (beyond the approved plan, so human
/prm, not auto-merge):max_detailed_parameters(10), corner plots use the compact style: 2D histograms, no upper triangle. A caller'skind,kindsorupperoverrides it.iterations_per_full_update. They need converged samples and are the slowest plot a search makes. Point searches' progress plots still update during the fit.Also: a search skips the full corner plot above
max_parameters_search(30). The per-component plots are still made, and the log says when there are none.API Changes
No public signatures change. Two new
visualize/plots_settings.yamlkeys; older configs fall back to the defaults. Corner plots change behaviour as above. See full details below.Test Plan
test_conformance_backend.py::test_samples_from_falls_back_to_paths_samples[FileNotFoundError-Zeus], which fails identically onmain(run serially; under xdist the suite fails a different handful each run, onmaintoo).corner_anestheticon the real 20-parameter tutorial model with 14,534 weighted samples: 23.6–31.9 s over five runs, target < 60 s.mainfor the full, repeated-label,parameter_indices,latentand 12-parameter compact plots: 0 pixels differ.pyauto-heart smokeon the branch: 160/160 pass across the six workspaces (autofit 10, autogalaxy 16, autolens 44, autolens_test 40, euclid 9, HowToLens 41). The two CTI environments could not be built on the laptop (arcticpy needs GSL headers), so no CTI script ran; CTI does not use these code paths.Heart RED override (development only)
Authorized by James Nightingale on 2026-11-09, live in this session, for PyAutoFit#1760 only: answer "Override, open PR (Recommended)" to the question "Do you authorize the 'Human override for Heart RED (development only)' to open the PyAutoFit#1760 PR now? It only opens the PR; the merge still needs your /prm with green checks."
Heart's RED reasons at the time (
heart_feed.py, verbatim):None involves this branch. PyAutoFit
mainCI is green. Passed branch gates: unit tests, smoke, independent review (CLEAN after fixes). This override permits commit, push and opening this PR only. Merging still needs a separate/prmwith every required check green. It does not claim to fix Heart, and Heart stays RED for releases.Full API Changes (for automation & release notes)
Added
visualize/plots_settings.yaml→corner_anesthetic.max_detailed_parameters: 10: above it, compact corner style.visualize/plots_settings.yaml→corner_anesthetic.max_parameters_search: 30: above it, a search skips the full corner plot.PosteriorDefaults.plots_during_fit(True;FalseforChainDefaults,WeightedDefaults).SearchUpdater(..., plot_results_during_fit=True)keyword;AbstractSearch.plots_results_during_fitproperty.Changed Behaviour
autofit.plot.corner_anesthetic: compact style abovemax_detailed_parameters; much faster at any size; output otherwise unchanged.autofit.non_linear.plot.plot_util.output_figure: saves viaplt.gcf().savefig(no second render).plot_results(corner plots) runs only on the final update.Migration
corner_anesthetic(samples, kinds="default", upper=True)or raisemax_detailed_parameters.🤖 Generated with Claude Code