Repository navigation
feat(interop): COOLEST observation pixel grid + on_unsupported="skip" - #740
Merged
Merged
Conversation
to_coolest wrote every template with an empty observation.pixels block (field_of_view 0, num_pix 0) because it built lazy.Observation() with no pixel grid; COOLEST's plotting API cannot render that. It now writes a PixelatedRegularGrid from shape_native + pixel_size or from dataset= (anything with shape_native and pixel_scales), and warns when neither is given. on_unsupported="skip" exports the full mass model and any supported light while omitting profiles COOLEST cannot represent (an MGE Basis, a Pixelization), recording each under meta.skipped_profiles. The default "raise" is unchanged. Refs #739 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Sep 16, 2026
Collaborator
Author
|
Workspace follow-ups behind the library-first gate (merge this PR first): PyAutoLabs/autolens_workspace#551, PyAutoLabs/euclid_strong_lens_modeling_pipeline#82. Heart RED override authorised by the human on 2026-09-16 for PR-open only; see #739. |
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
Fixes #739.
al.interop.coolest.to_coolest()wrote every template with an emptyobservation.pixelsblock (field_of_view_x/y = (0, 0),num_pix_x/y = 0) because it builtlazy.Observation()with no pixel grid. COOLEST's plotting API cannot render such a template (ModelPlotterfails withIndexError); an external reviewer found this and confirmed that setting the grid so its pixel scale matches the instrument block makes plotting work.to_coolestnow writes a realPixelatedRegularGridfromshape_native+pixel_size, or directly from adataset=(anything withshape_nativeandpixel_scales, e.g. anal.Imaging). If neither is given the template is written as before (zeros) and aUserWarningsays COOLEST plotting needs the grid.It also gains
on_unsupported="skip"for models COOLEST has no analytic profile for (an MGEBasisof Gaussians, a pixelized source). The supported parts (full mass model, Sersic light) still export and every omitted component is recorded undermeta.skipped_profilesas{"galaxy": "galaxy_i", "profile": "Basis(GaussianSph x 30)" | "Pixelization(Delaunay)"}. The default"raise"keeps today's behaviour, so existing callers and the workspace_test round trip are unchanged. This is what the Euclid DR1 pipeline (MGE lens light + Delaunay source) needs to write COOLEST by default; converting those components to COOLEST pixel grids is a follow-up.API Changes
to_coolest(...)gains keyword parametersshape_native=None,dataset=None,on_unsupported="raise"(inserted beforemetadata; all known callers passmetadataby keyword).UserWarningwhen a template is written with no observation grid.metamay carry askipped_profileslist whenon_unsupported="skip".See full details below.
Test Plan
pytest test_autolens/interop -q— 13 passed (6 existing + 7 new: grid fromshape_native/pixel_sizeincl. pixel-size identity with the instrument block,dataset=path, no-grid warning with zeros, default raise on MGE + pixelized galaxy, skip records both and still exports SIE + shear, invalidon_unsupported,from_cooleston a skipped template returns the mass-only tracer).JSONSerializer(...).load()givingnum_pix_x == 100,field_of_view_x == (-5.0, 5.0),observation.check_consistency_with_instrument()passes, andcoolest.api.plotting.ModelPlotter.plot_surface_brightness/plot_convergencerender. The same model written without a grid reproduces theIndexError.autolens_workspace/scripts/guides/coolest_interop.pyruns end to end with the new grid (round-trip max deflection difference 8.9e-16); workspace PR follows behind the library-first gate.Full API Changes (for automation & release notes)
Removed
Added
autolens.interop.coolest.to_coolest(galaxies, file_path, cosmology=None, mode="MAP", pixel_size=0.1, shape_native=None, dataset=None, on_unsupported="raise", metadata=None)—shape_native=(y, x)withpixel_size, ordataset=, writes theobservation.pixelsgrid (field_of_view_x = (-x*ps/2, x*ps/2),field_of_view_y = (-y*ps/2, y*ps/2),num_pix_x = x,num_pix_y = y);on_unsupported="skip"omits unconvertible profiles and lists them inmeta.skipped_profiles.Migration
al.interop.coolest.to_coolest(galaxies=tracer, file_path="model")→ template with a zero observation grid (now warns).al.interop.coolest.to_coolest(galaxies=tracer, file_path="model", dataset=imaging)orshape_native=(100, 100), pixel_size=0.1.on_unsupported="skip"and readmeta.skipped_profiles.Generated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code