You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove UltraNest and PySwarms search implementations from PyAutoFit to simplify the codebase. Both searches are preserved in the new autofit_workspace_developer repository with runnable examples. This also cleans up unit tests (adds Nautilus tests, expands abstract search coverage) and fixes pre-existing copy-paste bugs in Nautilus docstrings.
Plan
Archive UltraNest and PySwarms code to autofit_workspace_developer with examples
Remove source, imports, dependencies, configs, docs, citations, and tests from PyAutoFit
Fix Nautilus docstrings that incorrectly referenced UltraNest
Add Nautilus config test coverage (previously untested)
After reviewing the non-linear search package, here are the key improvement areas for future phases:
Issue Move search update to new class #1003 — Extract SearchUpdate class: perform_update and perform_visualization in abstract_search.py interact with many modules (saving samples, visualization, profiling, outputting results). Extracting to a SearchUpdate class would make each output task its own method.
Issue Simplify Samples calculation via search #1002 — Simplify samples coupling: The samples_cls / samples_via_internal_from / samples_via_csv_from methods are tightly coupled. A factory in Samples that inspects search_internal type would decouple sample types from search types.
Abstract search length (1353 lines): Composition and separation of concerns could significantly reduce this. Candidates for extraction: config loading boilerplate, multiprocessing pool management, path/output management.
Config boilerplate: Every search constructor repeats self._config("parallel", "number_of_cores") pattern. This could be pushed into the base class.
Missing integration tests: No tests actually run a search, even in test_mode. All existing tests only verify config loading. Lightweight end-to-end tests using test_mode would catch regressions in the _fit → samples_via_internal_from pipeline.
Docstring quality: Copy-paste errors exist across searches (Nautilus had two UltraNest references, now fixed). A systematic audit would catch more.
Original Prompt
Click to expand starting prompt
The PyAutoFit non-linear search package allows us to perform modeling with a search.
A high level description of modeling is given in @autofit_workspace/scripts/overview/overview_1_the_basics.py
The full model API is given in the cookbook files @autofit_workspace/scripts/cookbooks/search.py
and their applicaiton in @autofit_workspace/scripts/cookbooks/analysis.py
Another guide is @autofit_workspace/scirpts/howtofit/chapter_1_introduction/tutorial_3_non_linear_search.py
The file @autofit_workspace/scirpts/howtofit/chapter_2_scientific_workflow shows many of the key outputs possible
with a search, which allows a user to inspect and judge results, which is a key feature of autofit.
Searches are defined in the source code mostly at @PyAutoFit/autofit/non_linear
There is a lot of scope to refactor and redesign this package, first, we can remove:
First, after removing ultranest and pyswarms, can you review the unit tests, clean them up and add more test
coverage if you think it is needed? Then we can start to design the new API and implement it.
However, by remove, I dont want the code to be gone and lost forever. Can you
move their implmenetations to @autofit_workspace_developer,ensuring they can be run
with a test case locally. But such that most of the code which is a pain to keep ones head around
is in place.
The things I see that could be improved in this package are:
Look for unused functions and variables and remove them, to clean the code base and make it more concise.
Can the link between each search (e.g. samples_via_internal_from) and samples be improved or made more concise?
Attempts to make abstract_search a lot shorter by using composition and separation of concerns to move a lot
of the functionality performed there into standalone packages and moduels. I Think there are ltos of sections
guilty of this. Do this by running against a simple test script in @autofit_workspace_test carefully.
However,can you give me your assessment oft he pckage and where you think.
Overview
Remove UltraNest and PySwarms search implementations from PyAutoFit to simplify the codebase. Both searches are preserved in the new autofit_workspace_developer repository with runnable examples. This also cleans up unit tests (adds Nautilus tests, expands abstract search coverage) and fixes pre-existing copy-paste bugs in Nautilus docstrings.
Plan
autofit_workspace_developerwith examplesDetailed implementation plan
Affected Repositories
Work Classification
Library
Branch Survey
Suggested branch:
feature/search-remove-ultranest-pyswarmsImplementation Steps
Jammy2211/autofit_workspace_developerwith UltraNest and PySwarms source + examplesautofit/non_linear/search/nest/ultranest/andautofit/non_linear/search/mle/pyswarms/autofit/__init__.pypyswarms==1.3.0from dependencies andultranest==4.3.2from optional depsnest.yaml,mle.yaml, test configs, andvisualize.yamlsearches.rst,search.rstcookbook,interpolate.rst,installation/overview.rst)citations.md,citations.bib,citation.tex,paper.md,paper.bib)CLAUDE.md,AGENTS.md, README filestest_nautilus.pywith 3 tests (config loading, identifier fields, test mode)test_abstract_search.py(config dicts, unique_tag, path_prefix, identifier fields)Key Files
autofit/__init__.py— removed 3 importspyproject.toml— removed 2 dependenciesautofit/config/non_linear/nest.yaml— removed UltraNest blockautofit/config/non_linear/mle.yaml— removed PySwarms blocksdocs/api/searches.rst,docs/cookbooks/search.rst— removed sectionsDownstream cleanup needed (separate follow-up)
autofit_workspace— 32 files reference pyswarms/ultranestautolens_workspace— 9 filesPyAutoGalaxy— 9 files (docs, citations)PyAutoLens— 5 files (docs, citations)Assessment: Future refactoring opportunities
After reviewing the non-linear search package, here are the key improvement areas for future phases:
Issue Move search update to new class #1003 — Extract SearchUpdate class:
perform_updateandperform_visualizationinabstract_search.pyinteract with many modules (saving samples, visualization, profiling, outputting results). Extracting to aSearchUpdateclass would make each output task its own method.Issue Simplify Samples calculation via search #1002 — Simplify samples coupling: The
samples_cls/samples_via_internal_from/samples_via_csv_frommethods are tightly coupled. A factory inSamplesthat inspectssearch_internaltype would decouple sample types from search types.Abstract search length (1353 lines): Composition and separation of concerns could significantly reduce this. Candidates for extraction: config loading boilerplate, multiprocessing pool management, path/output management.
Config boilerplate: Every search constructor repeats
self._config("parallel", "number_of_cores")pattern. This could be pushed into the base class.Missing integration tests: No tests actually run a search, even in test_mode. All existing tests only verify config loading. Lightweight end-to-end tests using
test_modewould catch regressions in the_fit→samples_via_internal_frompipeline.Docstring quality: Copy-paste errors exist across searches (Nautilus had two UltraNest references, now fixed). A systematic audit would catch more.
Original Prompt
Click to expand starting prompt
The PyAutoFit non-linear search package allows us to perform modeling with a search.
A high level description of modeling is given in @autofit_workspace/scripts/overview/overview_1_the_basics.py
The full model API is given in the cookbook files @autofit_workspace/scripts/cookbooks/search.py
and their applicaiton in @autofit_workspace/scripts/cookbooks/analysis.py
Another guide is @autofit_workspace/scirpts/howtofit/chapter_1_introduction/tutorial_3_non_linear_search.py
The file @autofit_workspace/scirpts/howtofit/chapter_2_scientific_workflow shows many of the key outputs possible
with a search, which allows a user to inspect and judge results, which is a key feature of autofit.
Searches are defined in the source code mostly at @PyAutoFit/autofit/non_linear
There is a lot of scope to refactor and redesign this package, first, we can remove:
The following github describe some clean up and refactors:
#1003
#1002
First, after removing ultranest and pyswarms, can you review the unit tests, clean them up and add more test
coverage if you think it is needed? Then we can start to design the new API and implement it.
However, by remove, I dont want the code to be gone and lost forever. Can you
move their implmenetations to @autofit_workspace_developer,ensuring they can be run
with a test case locally. But such that most of the code which is a pain to keep ones head around
is in place.
The things I see that could be improved in this package are:
of the functionality performed there into standalone packages and moduels. I Think there are ltos of sections
However,can you give me your assessment oft he pckage and where you think.