Overview
Phase C of the aggregator profiling arc (PyAutoFit#1375 → #1376/#48 merged; Phase D #1377 → #1380/#49 merged): the lens-level leg, deferred while this repo was claimed. The generic harness answered where af.Aggregator scales poorly; the lens question is what TracerAgg/FitImagingAgg object reconstruction adds on top — the per-result cost that dominates real csv/fits/png catalogue workflows at 3000-lens scale.
Plan
- Mock lens results without running a sampler: one template written through
al.m.MockSearch + al.fixtures (the proven pattern in this repo's scripts/aggregator/fit_imaging.py), stamped N times with per-copy dataset_name/unique_tag — mirroring the merged autofit harness.
- A profiling grid timing the lens loading pathways separately:
from_directory, values("samples_summary"), TracerAgg and FitImagingAgg max-likelihood generators (reconstruction + likelihood re-evaluation), and an AggregateCSV catalogue loop over lens model paths.
- Same conventions as the merged harness: outputs under
output/ (gitignored), tiny single cell under PYAUTO_TEST_MODE, not in smoke_tests.txt.
Detailed implementation plan
Work Classification
Workspace only.
Worktree root
~/Code/PyAutoLabs-wt/aggregator-lens-profiling/
Affected Repositories
- autolens_workspace_test (only)
Branch Survey
| Repository |
Current Branch |
Dirty? |
| ./autolens_workspace_test |
main |
clean |
Suggested branch: feature/aggregator-lens-profiling
Implementation Steps
scripts/profiling/__init__.py + scripts/profiling/aggregator/ package.
mock_lens_results.py — template result via al.m.MockSearch(samples=…, result=al.m.MockResult(…)) + search.fit(model, analysis) with an al.fixtures imaging analysis (writes the full files/ tree the al.agg wrappers expect); stamp N copies (copytree + per-copy metadata dataset_name + unique_tag in search.json); manifest skip like the autofit harness.
profile_lens_aggregator.py — stages: from_directory, values("samples_summary"), TracerAgg.max_log_likelihood_gen_from (consume), FitImagingAgg.max_log_likelihood_gen_from (consume; the expensive lens step), AggregateCSV with lens paths; one-axis grid over n_results × n_samples; table + JSON under output/profiling_aggregator/results/; tiny cell under PYAUTO_TEST_MODE.
README.md one-paragraph usage.
Key Files
scripts/aggregator/fit_imaging.py, scripts/aggregator/tracer.py — the MockSearch/fixtures pattern to mirror (read-only)
autofit_workspace_test/scripts/profiling/aggregator/ — merged sibling harness (read-only reference)
Verification
- Tiny cell under PYAUTO_TEST_MODE completes;
FitImagingAgg generators yield real fits from the mock directories; quick grid produces the table + JSON.
Original Prompt
Click to expand starting prompt
Phase C of the aggregator profiling task (PyAutoFit#1375, phases A+B merged 2026-07-16 as PyAutoFit#1376 + autofit_workspace_test#48). Deferred at ship time because autolens_workspace_test was claimed by the viz-render-gallery task.
Extend the aggregator profiling harness (autofit_workspace_test scripts/profiling/aggregator/ — mirror its structure) with lens-level profiling in autolens_workspace_test:
- Mock lens results (tracer/galaxies/fit outputs) or reuse
_quick_fit-style cheap fits so no real modeling runs.
- Time the lens loading pathways:
TracerAgg, ImagingAgg/FitImagingAgg reconstruction costs, and the workflow catalogue makers mirrored from autolens_workspace/scripts/guides/results/workflow/ (csv_make/fits_make/png_make patterns).
- Same conventions as Phase A: outputs under
output/ (gitignored), tiny cell under PYAUTO_TEST_MODE, not in smoke_tests.txt.
Baseline findings to build on: samples-per-result dominates generic loading; AggregateCSV scales with model complexity; lens-specific question is what FitImagingAgg reconstruction adds on top.
Overview
Phase C of the aggregator profiling arc (PyAutoFit#1375 → #1376/#48 merged; Phase D #1377 → #1380/#49 merged): the lens-level leg, deferred while this repo was claimed. The generic harness answered where
af.Aggregatorscales poorly; the lens question is whatTracerAgg/FitImagingAggobject reconstruction adds on top — the per-result cost that dominates real csv/fits/png catalogue workflows at 3000-lens scale.Plan
al.m.MockSearch+al.fixtures(the proven pattern in this repo'sscripts/aggregator/fit_imaging.py), stamped N times with per-copydataset_name/unique_tag— mirroring the merged autofit harness.from_directory,values("samples_summary"),TracerAggandFitImagingAggmax-likelihood generators (reconstruction + likelihood re-evaluation), and anAggregateCSVcatalogue loop over lens model paths.output/(gitignored), tiny single cell underPYAUTO_TEST_MODE, not insmoke_tests.txt.Detailed implementation plan
Work Classification
Workspace only.
Worktree root
~/Code/PyAutoLabs-wt/aggregator-lens-profiling/Affected Repositories
Branch Survey
Suggested branch:
feature/aggregator-lens-profilingImplementation Steps
scripts/profiling/__init__.py+scripts/profiling/aggregator/package.mock_lens_results.py— template result viaal.m.MockSearch(samples=…, result=al.m.MockResult(…))+search.fit(model, analysis)with anal.fixturesimaging analysis (writes the full files/ tree theal.aggwrappers expect); stamp N copies (copytree + per-copy metadatadataset_name+unique_taginsearch.json); manifest skip like the autofit harness.profile_lens_aggregator.py— stages:from_directory,values("samples_summary"),TracerAgg.max_log_likelihood_gen_from(consume),FitImagingAgg.max_log_likelihood_gen_from(consume; the expensive lens step),AggregateCSVwith lens paths; one-axis grid over n_results × n_samples; table + JSON underoutput/profiling_aggregator/results/; tiny cell underPYAUTO_TEST_MODE.README.mdone-paragraph usage.Key Files
scripts/aggregator/fit_imaging.py,scripts/aggregator/tracer.py— the MockSearch/fixtures pattern to mirror (read-only)autofit_workspace_test/scripts/profiling/aggregator/— merged sibling harness (read-only reference)Verification
FitImagingAgggenerators yield real fits from the mock directories; quick grid produces the table + JSON.Original Prompt
Click to expand starting prompt
Phase C of the aggregator profiling task (PyAutoFit#1375, phases A+B merged 2026-07-16 as PyAutoFit#1376 + autofit_workspace_test#48). Deferred at ship time because autolens_workspace_test was claimed by the viz-render-gallery task.
Extend the aggregator profiling harness (autofit_workspace_test
scripts/profiling/aggregator/— mirror its structure) with lens-level profiling in autolens_workspace_test:_quick_fit-style cheap fits so no real modeling runs.TracerAgg,ImagingAgg/FitImagingAggreconstruction costs, and the workflow catalogue makers mirrored fromautolens_workspace/scripts/guides/results/workflow/(csv_make/fits_make/png_make patterns).output/(gitignored), tiny cell under PYAUTO_TEST_MODE, not in smoke_tests.txt.Baseline findings to build on: samples-per-result dominates generic loading; AggregateCSV scales with model complexity; lens-specific question is what FitImagingAgg reconstruction adds on top.