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_MODE and PYAUTO_WORKSPACE_SMALL_DATASETS → PYAUTO_SMALL_DATASETS
- Update all workspace
env_vars.yaml files 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() → reads PYAUTO_SKIP_FIT_OUTPUT
skip_visualization() → reads PYAUTO_SKIP_VISUALIZATION
skip_checks() → reads PYAUTO_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() >= 2
non_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 output
non_linear/search/abstract_search.py:530-537 — post-fit output
non_linear/analysis/analysis.py:331-334 — print_vram_use
non_linear/fitness.py:459-461 — check_likelihood_function
text/text_util.py:60-61 — model_text_from
Change to skip_visualization():
non_linear/analysis/visualize.py:44-45 — should_visualize
non_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_pixelisation
inversion/mesh/image_mesh/hilbert.py:401-402 — check_adapt_background_pixels
Rename PYAUTOARRAY_OUTPUT_MODE → PYAUTO_OUTPUT_MODE:
plot/output.py:196,225
plot/utils.py:308
Rename PYAUTO_WORKSPACE_SMALL_DATASETS → PYAUTO_SMALL_DATASETS:
structures/grids/uniform_2d.py:174,493
mask/mask_2d.py:363
operators/over_sampling/over_sample_util.py:272
util/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 resampling
autolens/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 definition
PyAutoConf/autoconf/__init__.py — exports
PyAutoFit/autofit/non_linear/search/abstract_search.py — most call sites
PyAutoArray/autoarray/plot/output.py — output_mode rename
- All workspace
config/build/env_vars.yaml files
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.
Overview
PYAUTOFIT_TEST_MODEhas 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 unifiedPYAUTO_*prefix. Also renamesPYAUTOARRAY_OUTPUT_MODE→PYAUTO_OUTPUT_MODEandPYAUTO_WORKSPACE_SMALL_DATASETS→PYAUTO_SMALL_DATASETS.Plan
test_mode.py(skip_fit_output,skip_visualization,skip_checks)PYAUTOFIT_TEST_MODE→PYAUTO_TEST_MODE(sampler-only, levels 0-3)PYAUTOARRAY_OUTPUT_MODE→PYAUTO_OUTPUT_MODEandPYAUTO_WORKSPACE_SMALL_DATASETS→PYAUTO_SMALL_DATASETSenv_vars.yamlfiles and shell scripts to set the new variables explicitlyDetailed implementation plan
Affected Repositories
Work Classification
Library (then workspace follow-up)
Branch Survey
Suggested branch:
feature/test-mode-separateWorktree root:
~/Code/PyAutoLabs-wt/test-mode-separate/New Environment Variables
PYAUTO_TEST_MODEPYAUTOFIT_TEST_MODEPYAUTO_SKIP_FIT_OUTPUTPYAUTO_SKIP_VISUALIZATIONPYAUTO_SKIP_CHECKSPYAUTO_OUTPUT_MODEPYAUTOARRAY_OUTPUT_MODEPYAUTO_SMALL_DATASETSPYAUTO_WORKSPACE_SMALL_DATASETSImplementation 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_CHECKSRename env var from
PYAUTOFIT_TEST_MODEtoPYAUTO_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_fromChange to
skip_visualization():non_linear/analysis/visualize.py:44-45— should_visualizenon_linear/plot/plot_util.py:16-18— skip_in_test_mode decoratorChange to
skip_checks():non_linear/samples/samples.py:382-383— weight thresholdStep 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_pixelsRename
PYAUTOARRAY_OUTPUT_MODE→PYAUTO_OUTPUT_MODE:plot/output.py:196,225plot/utils.py:308Rename
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:20Step 4: PyAutoGalaxy — renames
Rename
PYAUTO_WORKSPACE_SMALL_DATASETS→PYAUTO_SMALL_DATASETS:autogalaxy/analysis/model_util.py:93Step 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 exceptionChange to
skip_visualization():autolens/quantity/model/visualizer.py:43-44Step 6: Workspace env_vars.yaml and shell scripts
Update all
env_vars.yamlfiles to set all new vars explicitly:Update
run_scripts.sh/run_all_scripts.shto 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 renameconfig/build/env_vars.yamlfilesOriginal 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.