Repository navigation
feat: persist SparseTerms oversample fine grids in dataset.fits (opt-in) - #650
Merged
Merged
Conversation
`interferometer_hdu_list_from(dataset, include_fine_grids=False)` writes the `oversample` fine grids of array-free terms as HDUs PRECISION_OPERATOR_FINE and DIRTY_IMAGE_FINE, with `oversample` / `oversample_pad` appended to SPARSE_TERMS_SCALARS_ORDER (append-only, NaN = unrecorded) and header cards OVERSAMP / OVERSPAD, only when opted in: dataset.fits is written into every search's output and the grids grow as q^2 (~840 MB at 400 px, q = 8), so save_attributes keeps the default. The aggregator loader reads them via _has_hdu; files without them (default writes, pre-change files) reload the four fields as None. Depends on PyAutoArray feature/sparse-terms-oversampled-fine-grids (SparseTerms fine-grid fields). Refs PyAutoLabs/PyAutoArray#620 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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
Depends on PyAutoLabs/PyAutoArray#621 (merge that first). It adds the
SparseTermsfine-grid fields this PR persists.This PR adds FITS persistence for the
oversample=qfine grids of array-free interferometer datasets, requested by @HRSAstro in Discussion #13 (comment item 1); tracking issue PyAutoLabs/PyAutoArray#620.interferometer_hdu_list_from(dataset, include_fine_grids=False)writes the fine grids as HDUsPRECISION_OPERATOR_FINEandDIRTY_IMAGE_FINE, afterSPARSE_TERMS_SCALARS. It does so only when the terms carry them andinclude_fine_grids=True. Alongside them it writesoversample/oversample_pad, appended toSPARSE_TERMS_SCALARS_ORDER(append-only, NaN = unrecorded), and header cardsOVERSAMP/OVERSPAD.Why off by default:
dataset.fitsis written into every search's output bysave_attributes, and the grids grow as q². At 400 px and q=8 that is ~840 MB per search output.save_attributestherefore keeps the default, and a default write is identical to that of terms without fine grids (oversampling scalars NaN).The aggregator loader reads the HDUs via the existing
_has_hdupattern. A file without them (default writes, or files written before this change) reloads all four fields asNone, so a reloadedSparseTermsnever claims anoversamplewithout its grids.API Changes
Additive only.
autogalaxy.interferometer.model.analysis.interferometer_hdu_list_from(dataset, include_fine_grids=False)gains a new keyword.SPARSE_TERMS_SCALARS_ORDERgetsoversampleandoversample_padappended, andSPARSE_TERMS_HEADER_KEYSgetsOVERSAMPandOVERSPAD. TheSPARSE_TERMS_SCALARSHDU now has 9 entries; readers of the first 7 are unaffected.See full details below.
Test Plan
OVERSAMPcard; opting in on terms without fine grids writes nothing extra.writeto/fits.open) of both fine grids,oversample(asint) andoversample_pad. Reloaded terms still refuse to sum with a different q, and a default-written file reloads withNone.Nonefor all four fields, with other terms intact.test_autogalaxy: 1357 passed (with PyAutoArray#621).autolens_workspace/scripts/interferometer/features/datacube/modeling_array_free.pypasses.Full API Changes (for automation & release notes)
Added
interferometer_hdu_list_from(dataset, include_fine_grids: bool = False)— opt-in writing ofPRECISION_OPERATOR_FINE/DIRTY_IMAGE_FINE.SPARSE_TERMS_SCALARS_ORDER+=("oversample", "oversample_pad");SPARSE_TERMS_HEADER_KEYS["oversample"] = "OVERSAMP",["oversample_pad"] = "OVERSPAD".autogalaxy.aggregator.interferometer.interferometer._sparse_terms_fromreloads the fine grids when present.Migration
Requested by @HRSAstro — https://github.com/orgs/PyAutoLabs/discussions/13 (https://github.com/orgs/PyAutoLabs/discussions/13#discussioncomment-18741903).
Tier: judge — merge mode: human /prm (after PyAutoArray#621). Heart readiness at ship: YELLOW (manifest drift: shared-standards blocks; release validation stale), acknowledged.
Generated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code