Skip to content

Commit 706e7a8

Browse files
Jammy2211Copilot
andauthored
Update autoarray/geometry/geometry_util.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 0cf7ee2 commit 706e7a8

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

autoarray/geometry/geometry_util.py

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -358,19 +358,42 @@ def scaled_coordinates_2d_from(
358358

359359

360360
def pixel_coordinates_wcs_2d_from(
361-
scaled_coordinates_2d,
362-
shape_native,
363-
pixel_scales,
364-
origins=(0.0, 0.0),
365-
):
361+
scaled_coordinates_2d: Tuple[float, float],
362+
shape_native: Tuple[int, int],
363+
pixel_scales: ty.PixelScales,
364+
origins: Tuple[float, float] = (0.0, 0.0),
365+
) -> Tuple[float, float]:
366366
"""
367367
Return FITS / WCS pixel coordinates (1-based, pixel-centre convention) as floats.
368368
369369
This function returns continuous pixel coordinates suitable for Astropy WCS
370-
transforms (e.g. wcs_pix2world with origin=1). Pixel centres lie at integer
371-
values; for an image of shape (ny, nx) the geometric centre is:
372-
((ny + 1)/2, (nx + 1)/2)
373-
e.g. (100, 100) -> (50.5, 50.5).
370+
transforms (e.g. ``wcs_pix2world`` with ``origin=1``). Pixel centres lie at
371+
integer values; for an image of shape ``(ny, nx)`` the geometric centre is::
372+
373+
((ny + 1) / 2, (nx + 1) / 2)
374+
375+
e.g. ``(100, 100) -> (50.5, 50.5)``.
376+
377+
Parameters
378+
----------
379+
scaled_coordinates_2d
380+
The 2D (y, x) coordinates in scaled units which are converted to WCS
381+
pixel coordinates.
382+
shape_native
383+
The (y, x) shape of the 2D array on which the scaled coordinates are
384+
defined, used to determine the geometric centre in WCS pixel units.
385+
pixel_scales
386+
The (y, x) conversion factors from scaled units to pixel units.
387+
origins
388+
The (y, x) origin in scaled units about which the coordinates are
389+
defined. The scaled coordinates are shifted by this origin before being
390+
converted to WCS pixel coordinates.
391+
392+
Returns
393+
-------
394+
pixel_coordinates_wcs_2d
395+
A 2D (y, x) WCS pixel coordinate in the 1-based, pixel-centre
396+
convention, returned as floats.
374397
"""
375398
ny, nx = shape_native
376399

0 commit comments

Comments
 (0)