From 4e23d8ab719d0c512143635a73f09033c2f8dbe4 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 7 Aug 2026 20:45:34 +0000 Subject: [PATCH 1/2] docs: repoint plot docs at the functional autofit.plot API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `docs/api/plot.rst` autosummary-listed `NestPlotter`, `MCMCPlotter` and `MLEPlotter`, none of which exist any more — `autofit.plot` exposes a function-only surface. The block generated broken `_autosummary` stubs for three dead classes and documented none of the five live entry points. Rewrite the page against `autofit/plot/__init__.py`: corner plots (`corner_cornerpy`, `corner_anesthetic`), sampling traces (`subplot_parameters`, `log_likelihood_vs_iteration`) and the shared `output_figure` helper, mirroring how PyAutoGalaxy/PyAutoLens present the same module. Dropped `:template: custom-class-template.rst` / `:recursive:`, which are class-template directives. The same removed classes were also being called in three prose snippets, so a reader copying them hit an AttributeError; repointed each at the function that replaced it (`the_basics.md`, `cookbooks/samples.md`, `cookbooks/search.md`). While in `search.md`, fixed two adjacent workspace notebook paths that no longer resolve (`searches/mcmc/Emcee.ipynb` and `plot/EmceePlotter.ipynb` -> `searches/mcmc.ipynb`, `plot/emcee_plotter.ipynb`). Docs-only; no code touched. `docs/sphinx_warning_baseline.txt` is a ceiling (67) so this can only move the count down — worth ratcheting once CI reports the new figure. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01FE4zErC6AvJWuHisYGutFR --- docs/api/plot.rst | 47 +++++++++++++++++++++++++++++-------- docs/cookbooks/samples.md | 7 +++--- docs/cookbooks/search.md | 18 ++++++-------- docs/overview/the_basics.md | 3 +-- 4 files changed, 48 insertions(+), 27 deletions(-) diff --git a/docs/api/plot.rst b/docs/api/plot.rst index 7feb8ae27..3849dcef4 100644 --- a/docs/api/plot.rst +++ b/docs/api/plot.rst @@ -1,27 +1,54 @@ ======== -Plotters +Plotting ======== -Create figures and subplots of non-linear search specific visualization of every search algorithm supported +Create figures and subplots of the non-linear search specific visualization of every search algorithm supported by **PyAutoFit**. +The plotting API is **functional**: import ``autofit.plot`` and call a plot function directly, passing it the +``Samples`` object of a completed fit. There are no ``Plotter`` classes. + +.. code-block:: python + + import autofit.plot as aplt + + aplt.corner_cornerpy(samples=result.samples) + **Examples / Tutorials:** - `readthedocs: non-linear search example `_ - `autofit_workspace: plot tutorials `_ - `HowToFit: tutorial lectures (detailed step-by-step examples) `_ --------- -Plotters --------- +Search Plot Functions [aplt] +---------------------------- .. currentmodule:: autofit.plot +**Posterior Corner Plots:** + +.. autosummary:: + :toctree: _autosummary + + corner_cornerpy + corner_anesthetic + +**Sampling Trace Plots:** + +.. autosummary:: + :toctree: _autosummary + + subplot_parameters + log_likelihood_vs_iteration + +Figure Output [aplt] +-------------------- + +Every plot function above takes ``path``, ``filename`` and ``format`` arguments controlling where the figure goes: +``format="show"`` (the default) displays it interactively, whereas ``"png"`` or ``"pdf"`` writes it to +``path/filename.format``. The shared helper that performs this is also public: + .. autosummary:: :toctree: _autosummary - :template: custom-class-template.rst - :recursive: - NestPlotter - MCMCPlotter - MLEPlotter \ No newline at end of file + output_figure diff --git a/docs/cookbooks/samples.md b/docs/cookbooks/samples.md index c457affd5..b5db8691f 100644 --- a/docs/cookbooks/samples.md +++ b/docs/cookbooks/samples.md @@ -289,12 +289,11 @@ Sigma = 10.001029545296722 ## Search Plots -The Probability Density Functions (PDF's) of the results can be plotted using the Emcee's visualization -tool `corner.py`, which is wrapped via the `EmceePlotter` object. +The Probability Density Functions (PDF's) of the results can be plotted using the visualization +tool `corner.py`, which is wrapped via the `corner_cornerpy` function. ```python -plotter = aplt.MCMCPlotter(samples=result.samples) -plotter.corner() +aplt.corner_cornerpy(samples=result.samples) ``` This plot appears as follows: diff --git a/docs/cookbooks/search.md b/docs/cookbooks/search.md index 493bfdedc..1924803d6 100644 --- a/docs/cookbooks/search.md +++ b/docs/cookbooks/search.md @@ -152,22 +152,18 @@ search = af.Emcee(number_of_cores=4) ## Plots -Every non-linear search supported by **PyAutoFit** has a dedicated `plotter` class that allows the results of the -model-fit to be plotted and inspected. +The results of a model-fit are plotted and inspected via the plot functions of `autofit.plot`, which wrap the +in-built visualization libraries of the searches. These are fully described in the `plot` package of the workspace. -This uses that search's in-built visualization libraries, which are fully described in the `plot` package of the -workspace. - -For example, `Emcee` has a corresponding `EmceePlotter`, which is used as follows. +For example, `corner_cornerpy` wraps `corner.py` and is used as follows. Checkout the `plot` package for a complete description of the plots that can be made for a given search. ```python samples = result.samples -plotter = aplt.MCMCPlotter(samples=samples) - -plotter.corner( +aplt.corner_cornerpy( + samples=samples, bins=20, range=None, color="k", @@ -256,8 +252,8 @@ Information about Emcee can be found at the following links: The following workspace example shows examples of fitting data with Emcee and plotting the results. -- `autofit_workspace/notebooks/searches/mcmc/Emcee.ipynb` -- `autofit_workspace/notebooks/plot/EmceePlotter.ipynb` +- `autofit_workspace/notebooks/searches/mcmc.ipynb` +- `autofit_workspace/notebooks/plot/emcee_plotter.ipynb` The following code shows how to use Emcee with all available options. diff --git a/docs/overview/the_basics.md b/docs/overview/the_basics.md index 97005e549..aa74a27fc 100644 --- a/docs/overview/the_basics.md +++ b/docs/overview/the_basics.md @@ -539,8 +539,7 @@ algorithm (e.g. the internal dynesty samples). Below we use the samples to plot the probability density function cornerplot of the results. ```python -plotter = aplt.NestPlotter(samples=result.samples) -plotter.corner_anesthetic() +aplt.corner_anesthetic(samples=result.samples) ``` The plot appears as follows: From 25054c085a105b5d236fd78a4195085e3ef57dcf Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 7 Aug 2026 21:02:39 +0000 Subject: [PATCH 2/2] docs: ratchet the sphinx warning baseline 67 -> 31 The Docs job asked for this explicitly: Sphinx warnings: 31 (baseline: 67) ::notice::Warning count 31 is below baseline 67 -- consider ratcheting docs/sphinx_warning_baseline.txt down Attributable to this branch, not drift: the same job on main at 1eb27733 (today, same dependency chain) reports 67, and this branch was identical to main before the plot.rst commit. Sphinx's own count moves 37 -> 31; the CI-counted line total moves 67 -> 31 because the three dead-class autosummary failures each emitted a multi-line warning. Leaving the ceiling at 67 would let 36 lines of new warnings land undetected, which is the regression the baseline exists to catch. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01FE4zErC6AvJWuHisYGutFR --- docs/sphinx_warning_baseline.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sphinx_warning_baseline.txt b/docs/sphinx_warning_baseline.txt index 3fdcd7c44..e85087aff 100644 --- a/docs/sphinx_warning_baseline.txt +++ b/docs/sphinx_warning_baseline.txt @@ -1 +1 @@ -67 +31