@@ -132,10 +132,10 @@ def central_scaled_coordinates(self) -> Tuple[float, float]:
132132
133133 def pixel_coordinates_2d_from (
134134 self , scaled_coordinates_2d : Tuple [float , float ]
135- ) -> Tuple [float , float ]:
135+ ) -> Tuple [int , int ]:
136136 """
137- Convert a 2D (y,x) scaled coordinate to a 2D (y,x) pixel coordinate, which are returned as floats such that they
138- include the decimal offset from each pixel's top-left corner relative to the input scaled coordinate.
137+ Convert a 2D (y,x) scaled coordinate to a 2D (y,x) pixel coordinate, which are returned as integers such that
138+ they do not include the decimal offset from each pixel's top-left corner relative to the input scaled coordinate.
139139
140140 The conversion is performed according to the 2D geometry on a uniform grid, where the pixel coordinate origin
141141 is at the top left corner, such that the pixel [0,0] corresponds to the highest (most positive) y scaled
@@ -190,6 +190,41 @@ def scaled_coordinates_2d_from(
190190 origins = self .origin ,
191191 )
192192
193+ def pixel_coordinates_wcs_2d_from (
194+ self , scaled_coordinates_2d : Tuple [float , float ]
195+ ) -> Tuple [float , float ]:
196+ """
197+ Convert a 2D (y,x) scaled coordinate to a 2D (y,x) WCS/FITS-style pixel coordinate.
198+
199+ The returned pixel coordinates follow the standard WCS convention:
200+
201+ - Coordinates are 1-based rather than 0-based, so that the centre of the top-left pixel is at (y, x) = (1.0, 1.0).
202+ - Coordinates refer to pixel centres, not pixel corners.
203+ - Values are continuous floats, so the fractional part encodes the sub-pixel offset from the pixel centre.
204+
205+ This differs from integer pixel-index conversions (e.g. ``pixel_coordinates_2d_from``), which return 0-based
206+ indices associated with pixel corners/top-left positions.
207+
208+ The mapping from scaled coordinates to WCS pixel coordinates is defined by this geometry's ``origin``: scaled
209+ coordinates are first shifted by the specified origin(s) before being converted using the pixel scale and
210+ array shape. Changing ``origin`` therefore translates the returned WCS pixel coordinates by a constant offset.
211+
212+ Parameters
213+ ----------
214+ scaled_coordinates_2d
215+ The 2D (y,x) coordinates in scaled units to be converted to WCS-style pixel coordinates.
216+
217+ Returns
218+ -------
219+ A 2D (y,x) WCS pixel coordinate, expressed as 1-based, pixel-centre, floating-point values.
220+ """
221+ return geometry_util .pixel_coordinates_wcs_2d_from (
222+ scaled_coordinates_2d = scaled_coordinates_2d ,
223+ shape_native = self .shape_native ,
224+ pixel_scales = self .pixel_scales ,
225+ origins = self .origin ,
226+ )
227+
193228 def scaled_coordinate_2d_to_scaled_at_pixel_centre_from (
194229 self , scaled_coordinate_2d : Tuple [float , float ]
195230 ) -> Tuple [float , float ]:
0 commit comments