Skip to content

Feature/wcs coordinates#210

Merged
Jammy2211 merged 6 commits intomainfrom
feature/wcs_coordinates
Feb 10, 2026
Merged

Feature/wcs coordinates#210
Jammy2211 merged 6 commits intomainfrom
feature/wcs_coordinates

Conversation

@Jammy2211
Copy link
Owner

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:

  • Added pixel_coordinates_wcs_2d_from to geometry_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.
  • Added a corresponding method pixel_coordinates_wcs_2d_from to the Geometry2D class in geometry_2d.py, exposing this new conversion utility at the class level.

Testing Improvements:

  • Introduced comprehensive tests for pixel_coordinates_wcs_2d_from in test_geometry_util.py, covering various grid sizes, pixel scales, origins, and both integer and continuous coordinates.

Documentation and Clarity:

  • Clarified the docstring for the existing pixel_coordinates_2d_from method in geometry_2d.py to specify that it returns integer pixel coordinates (not floats), making the distinction between the two conversion methods explicit.

Configuration Update:

  • Changed the subplot_mappings option from true to false in the autoarray/config/visualize/plots.yaml configuration file, disabling the default plotting of image-to-source pixel mappings in inversion subplots.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_from conversion utility in geometry_util.py.
  • Exposed the conversion via Geometry2D.pixel_coordinates_wcs_2d_from and 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.

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.
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in docstring: "gird" should be "grid".

Copilot uses AI. Check for mistakes.
Jammy2211 and others added 4 commits February 10, 2026 17:28
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>
@Jammy2211 Jammy2211 merged commit 506fc64 into main Feb 10, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants