Repository navigation
Description
Overview
PYAUTOFIT_TEST_MODE has become a catch-all that controls sampler speedup, visualization, fit I/O, and validation checks. This task separates it into distinct, purpose-specific environment variables under a unified PYAUTO_* prefix. Also renames PYAUTOARRAY_OUTPUT_MODE → PYAUTO_OUTPUT_MODE and PYAUTO_WORKSPACE_SMALL_DATASETS → PYAUTO_SMALL_DATASETS.
Plan
- Add new env var accessor functions to PyAutoConf
test_mode.py(skip_fit_output,skip_visualization,skip_checks) - Rename
PYAUTOFIT_TEST_MODE→PYAUTO_TEST_MODE(sampler-only, levels 0-3) - Update every call site in PyAutoFit, PyAutoArray, PyAutoGalaxy, and PyAutoLens to use the correct new function
- Rename
PYAUTOARRAY_OUTPUT_MODE→PYAUTO_OUTPUT_MODEandPYAUTO_WORKSPACE_SMALL_DATASETS→PYAUTO_SMALL_DATASETS - Update all workspace
env_vars.yamlfiles and shell scripts to set the new variables explicitly - Update CLAUDE.md documentation across repos
Detailed implementation plan
Affected Repositories
- PyAutoConf (primary — defines env var functions)
- PyAutoFit (most call sites)
- PyAutoArray (hilbert checks, output_mode rename, small_datasets rename)
- PyAutoGalaxy (small_datasets rename)
- PyAutoLens (position checks, visualization)
- autofit_workspace (env_vars.yaml, run_scripts.sh)
- autogalaxy_workspace (env_vars.yaml, run_all_scripts.sh)
- autolens_workspace (env_vars.yaml, run_all_scripts.sh)
Work Classification
Library (then workspace follow-up)
Branch Survey
| Repository | Current Branch | Dirty? |
|---|---|---|
| PyAutoConf | main | clean |
| PyAutoFit | main | clean |
| PyAutoArray | main | clean |
| PyAutoGalaxy | main | clean |
| PyAutoLens | main | clean |
| autofit_workspace | main | dirty (datasets) |
| autogalaxy_workspace | main | dirty (datasets) |
| autolens_workspace | main | dirty (datasets) |
Suggested branch: feature/test-mode-separate
Worktree root: ~/Code/PyAutoLabs-wt/test-mode-separate/
New Environment Variables
| New env var | Replaces | Type | What it controls |
|---|---|---|---|
PYAUTO_TEST_MODE |
PYAUTOFIT_TEST_MODE |
int 0-3 | Sampler speedup only |
PYAUTO_SKIP_FIT_OUTPUT |
(was in test_mode) | bool | Pre/post-fit I/O, VRAM, result text, likelihood check |
PYAUTO_SKIP_VISUALIZATION |
(was in test_mode) | bool | Fit visualization and plotting |
PYAUTO_SKIP_CHECKS |
(was in test_mode) | bool | Mesh validation, position resampling, weight thresholds |
PYAUTO_OUTPUT_MODE |
PYAUTOARRAY_OUTPUT_MODE |
bool | Save all plots as numbered PNGs |
PYAUTO_SMALL_DATASETS |
PYAUTO_WORKSPACE_SMALL_DATASETS |
bool | Cap grids to 15x15 |
Implementation Steps
Step 1: PyAutoConf — extend test_mode.py
Add new functions alongside existing test_mode_level() / is_test_mode():
skip_fit_output()→ readsPYAUTO_SKIP_FIT_OUTPUTskip_visualization()→ readsPYAUTO_SKIP_VISUALIZATIONskip_checks()→ readsPYAUTO_SKIP_CHECKS
Rename env var from PYAUTOFIT_TEST_MODE to PYAUTO_TEST_MODE.
Export all new functions from autoconf/__init__.py.
Step 2: PyAutoFit — update call sites
Sampler speedup (keep test_mode_level() / is_test_mode()):
non_linear/initializer.py:65—is_test_mode()non_linear/search/abstract_search.py:668-674—test_mode_level() >= 2non_linear/search/abstract_search.py:829-874—_fit_bypass_test_mode()non_linear/search/mcmc/emcee/search.py:270-284—is_test_mode()non_linear/search/mcmc/zeus/search.py:289-304—is_test_mode()non_linear/search/mcmc/auto_correlations.py:52-53—is_test_mode()
Change to skip_fit_output():
non_linear/search/abstract_search.py:500-518— pre-fit outputnon_linear/search/abstract_search.py:530-537— post-fit outputnon_linear/analysis/analysis.py:331-334— print_vram_usenon_linear/fitness.py:459-461— check_likelihood_functiontext/text_util.py:60-61— model_text_from
Change to skip_visualization():
non_linear/analysis/visualize.py:44-45— should_visualizenon_linear/plot/plot_util.py:16-18— skip_in_test_mode decorator
Change to skip_checks():
non_linear/samples/samples.py:382-383— weight threshold
Step 3: PyAutoArray — update call sites + renames
Change to skip_checks():
inversion/mesh/image_mesh/hilbert.py:334-335— check_adapt_pixelisationinversion/mesh/image_mesh/hilbert.py:401-402— check_adapt_background_pixels
Rename PYAUTOARRAY_OUTPUT_MODE → PYAUTO_OUTPUT_MODE:
plot/output.py:196,225plot/utils.py:308
Rename PYAUTO_WORKSPACE_SMALL_DATASETS → PYAUTO_SMALL_DATASETS:
structures/grids/uniform_2d.py:174,493mask/mask_2d.py:363operators/over_sampling/over_sample_util.py:272util/dataset_util.py:20
Step 4: PyAutoGalaxy — renames
Rename PYAUTO_WORKSPACE_SMALL_DATASETS → PYAUTO_SMALL_DATASETS:
autogalaxy/analysis/model_util.py:93
Step 5: PyAutoLens — update call sites
Change to skip_checks():
autolens/analysis/result.py:307-308— position resamplingautolens/analysis/analysis/dataset.py:113-114— inversion position exception
Change to skip_visualization():
autolens/quantity/model/visualizer.py:43-44
Step 6: Workspace env_vars.yaml and shell scripts
Update all env_vars.yaml files to set all new vars explicitly:
PYAUTO_TEST_MODE: "2"
PYAUTO_SKIP_FIT_OUTPUT: "1"
PYAUTO_SKIP_VISUALIZATION: "1"
PYAUTO_SKIP_CHECKS: "1"
PYAUTO_SMALL_DATASETS: "1"Update run_scripts.sh / run_all_scripts.sh to export all new vars.
Update any unset: overrides that referenced old names.
Step 7: Update CLAUDE.md and documentation
Update env var references in CLAUDE.md across all repos.
Key Files
PyAutoConf/autoconf/test_mode.py— central definitionPyAutoConf/autoconf/__init__.py— exportsPyAutoFit/autofit/non_linear/search/abstract_search.py— most call sitesPyAutoArray/autoarray/plot/output.py— output_mode rename- All workspace
config/build/env_vars.yamlfiles
Original Prompt
Click to expand starting prompt
PYAUTOFIT_TEST_MODE has become a bit of a catch all term for things I dont want to run when testing,
it incldues disable some visualization and posiition resmapling in autolens as opposed to just
making the sampler run faster.
Furthermore, there is also PYAUTOARRAY_OUTPUT_MODE which outputs images to hard disk, which si use.
Can you look at all PYAUTOFIT_TEST_MODE clauses and work out which are not doing a sampler speed up.
Can you then suggest names for us to use for them all.
I also want us to move to environment variables just being PYAUTO, so PYAUTO_TEST_MODE, PYAUTO_OUTPUT_MODE,
we will also rename PYAUTO_WORKSPACE_SMALL_DATASETS to PYAUTO_SMALL_DATASETS.
Activity
Jammy2211 commentedon Apr 12, 2026
Library PRs Created — 2026-04-12
PRs
Status
Workspace changes needed. Next: /start_workspace
API Changes
PYAUTOFIT_TEST_MODE→PYAUTO_TEST_MODEPYAUTOARRAY_OUTPUT_MODE→PYAUTO_OUTPUT_MODEPYAUTO_WORKSPACE_SMALL_DATASETS→PYAUTO_SMALL_DATASETSPYAUTO_SKIP_FIT_OUTPUT,PYAUTO_SKIP_VISUALIZATION,PYAUTO_SKIP_CHECKSJammy2211 commentedon Apr 12, 2026
Shipped — 2026-04-12
Library PRs
Workspace PRs
Summary
Separated the catch-all
PYAUTOFIT_TEST_MODEinto purpose-specific environment variables:PYAUTO_TEST_MODE(sampler),PYAUTO_SKIP_FIT_OUTPUT,PYAUTO_SKIP_VISUALIZATION,PYAUTO_SKIP_CHECKS. Also renamedPYAUTOARRAY_OUTPUT_MODE→PYAUTO_OUTPUT_MODEandPYAUTO_WORKSPACE_SMALL_DATASETS→PYAUTO_SMALL_DATASETS. Updated all 8 repos (5 libraries + 3 workspaces).Session Notes
Jammy2211 commentedon May 28, 2026
Shipped via #1195. Closing.