Repository navigation
fix: AggregateFITS resolves FITS sources through result.fits, not value() - #1633
Merged
Merged
Conversation
…ue() SearchOutput.value searches JSON outputs before FITS outputs. A search that writes both files/<name>.json and image/<name>.fits (every PyAutoLens fit writes files/tracer.json beside image/tracer.fits) therefore made AggregateFITS._hdus receive the JSON object and fail with "'Tracer' object has no attribute 'index_of'", so al.agg.fits_tracer was unusable through AggregateFITS. Found while collecting per-lens mass maps for the Euclid DR1 catalogue (euclid_strong_lens_modeling_pipeline#80). New module-level fits_source(result, name) looks the FITS output up by name in result.fits and raises FileNotFoundError when absent; _hdus and extract_csv use it. SearchOutput.value keeps its JSON-first order. Regression test copies the aggregate_summary fixture, drops a files/fit.json beside image/fit.fits and asserts extraction still returns the HDUs (red on main: AttributeError 'dict' object has no attribute 'index_of'). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
6 of 8 tasks
Collaborator
Author
|
Workspace PR: PyAutoLabs/euclid_strong_lens_modeling_pipeline#81 — drops its AggregateTracerFITS stand-in on this fix; library-first merge (this PR first). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
af.AggregateFITScould not read a FITS output whose name is shared with a JSON output.AggregateFITS._hdusresolved the source file withSearchOutput.value(name), andvaluesearchesjsonsbeforefits. Every PyAutoLens fit writes bothfiles/tracer.json(the max-log-likelihoodTracer) andimage/tracer.fits, soextract_fits(hdus=[al.agg.fits_tracer.convergence])received theTracerobject and died:Found while collecting per-lens convergence/potential/deflections maps for the Euclid DR1 catalogue (euclid_strong_lens_modeling_pipeline#80, PR #81), where the producer had to carry a stand-in copy of the extraction loop. This PR fixes the resolution in PyAutoFit so that stand-in is deleted.
Fix. New module-level
fits_source(result, name)inautofit/aggregator/summary/aggregate_fits.pylooks the FITS output up by name inresult.fits, where FITS files are unambiguously FITS files, and raisesFileNotFoundErrorwhen none exists._hdusandextract_csvuse it.SearchOutput.valuekeeps its JSON-first order; nothing else changes.API Changes
None for callers.
AggregateFITS.extract_fits/extract_csv/output_to_folderkeep their signatures and return types; a missing FITS output now raisesFileNotFoundErrorinstead of anAttributeErroronNone. One new public helper,autofit.aggregator.summary.aggregate_fits.fits_source.See full details below.
Test Plan
test_json_does_not_shadow_fits: copy of theaggregate_summaryfixture with afiles/fit.jsonbeside eachimage/fit.fits; red onmain(AttributeError: 'dict' object has no attribute 'index_of'), green heretest_fits_source_missing:FileNotFoundErrorfor an unknown namepytest test_autofit/aggregator -q: 85 passed;summary_files: 36 passed;test_autofit/database/test_file_types.py: 7 passeddr1_sep1mass maps produced throughaf.AggregateFITSon this branch are byte-identical to the stand-in's output (27 files), 18 result zips untouchedFull API Changes (for automation & release notes)
Added
autofit.aggregator.summary.aggregate_fits.fits_source(result, name)— the openedHDUListof the FITS output callednamefor oneSearchOutput, resolved throughresult.fits; raisesFileNotFoundErrorwhen absent.Changed
AggregateFITS._hdusandAggregateFITS.extract_csvresolve their source file viafits_sourceinstead ofSearchOutput.value. Behaviour is identical when no same-named JSON exists; when one does, the FITS file is now read rather than the JSON object.Migration
Downstream: euclid_strong_lens_modeling_pipeline PR #81 (branch of the same name) drops its
AggregateTracerFITSstand-in and depends on this fix; library-first merge.Heart was RED at ship time for reasons unrelated to this change (TestPyPI install verification; release-validation integrate stage); PR opened on the human's acknowledgement.
Generated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code