Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a new utility to convert 2D scaled coordinates into continuous FITS/WCS-style (1-based, pixel-centre) pixel coordinates, exposes it via Geometry2D, expands test coverage around pixel/WCS coordinate conversions, and tweaks a visualization default.
Changes:
- Added
pixel_coordinates_wcs_2d_fromconversion utility ingeometry_util.py. - Exposed the conversion via
Geometry2D.pixel_coordinates_wcs_2d_fromand clarified integer-vs-float behavior in existing docs. - Added extensive unit tests for the new WCS conversion and changed a plotting config default (
subplot_mappings).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| test_autoarray/geometry/test_geometry_util.py | Adds new tests for WCS pixel coordinate conversion (but introduces a redundant import). |
| autoarray/geometry/geometry_util.py | Introduces the new WCS pixel coordinate conversion utility. |
| autoarray/geometry/geometry_2d.py | Clarifies integer pixel conversion docstring and adds a Geometry2D wrapper for the WCS conversion. |
| autoarray/config/visualize/plots.yaml | Disables inversion mapping subplots by default. |
Comments suppressed due to low confidence (1)
autoarray/geometry/geometry_2d.py:142
- Typo in docstring: "gird" should be "grid".
they do not include the decimal offset from each pixel's top-left corner relative to the input scaled coordinate.
The conversion is performed according to the 2D geometry on a uniform grid, where the pixel coordinate origin
is at the top left corner, such that the pixel [0,0] corresponds to the highest (most positive) y scaled
coordinate and lowest (most negative) x scaled coordinate on the gird.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
autoarray/geometry/geometry_2d.py
Outdated
Comment on lines
+200
to
+202
| The conversion is performed according to the 2D geometry on a uniform grid, where the pixel coordinate origin | ||
| is at the top left corner, such that the pixel [0,0] corresponds to the highest (most positive) y scaled | ||
| coordinate and lowest (most negative) x scaled coordinate on the gird. |
There was a problem hiding this comment.
Typo in docstring: "gird" should be "grid".
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.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.
This pull request introduces a new utility for converting 2D scaled coordinates to WCS-style pixel coordinates with floating-point precision, adds thorough tests for this new functionality, and clarifies the distinction between integer and float pixel coordinate conversions in the codebase. Additionally, it makes a minor configuration change to plotting settings.
New WCS Pixel Coordinate Conversion:
pixel_coordinates_wcs_2d_fromtogeometry_util.py, which converts 2D scaled coordinates to continuous (float) WCS pixel coordinates, suitable for Astropy WCS transforms. This function uses the pixel-centre convention and supports arbitrary origins.pixel_coordinates_wcs_2d_fromto theGeometry2Dclass ingeometry_2d.py, exposing this new conversion utility at the class level.Testing Improvements:
pixel_coordinates_wcs_2d_fromintest_geometry_util.py, covering various grid sizes, pixel scales, origins, and both integer and continuous coordinates.Documentation and Clarity:
pixel_coordinates_2d_frommethod ingeometry_2d.pyto specify that it returns integer pixel coordinates (not floats), making the distinction between the two conversion methods explicit.Configuration Update:
subplot_mappingsoption fromtruetofalsein theautoarray/config/visualize/plots.yamlconfiguration file, disabling the default plotting of image-to-source pixel mappings in inversion subplots.