@@ -121,8 +121,15 @@ def central_pixel_coordinates(self) -> Tuple[float, float]:
121121 @property
122122 def central_scaled_coordinates (self ) -> Tuple [float , float ]:
123123 """
124- Returns the central scaled coordinates of a 2D geometry (and therefore a 2D data structure like an ``Array2D``)
125- from the shape of that data structure.
124+ The central (y,x) coordinates of the 2D geometry in scaled units.
125+
126+ Computed from the shape and pixel scales of the geometry, shifted by the origin. This is
127+ the scaled-unit coordinate that sits at the geometric centre of the grid.
128+
129+ Returns
130+ -------
131+ Tuple[float, float]
132+ The (y,x) scaled coordinates of the geometric centre.
126133 """
127134 return geometry_util .central_scaled_coordinate_2d_from (
128135 shape_native = self .shape_native ,
@@ -134,24 +141,25 @@ def pixel_coordinates_2d_from(
134141 self , scaled_coordinates_2d : Tuple [float , float ]
135142 ) -> Tuple [int , int ]:
136143 """
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 .
144+ Convert a 2D (y,x) scaled coordinate to a 2D (y,x) pixel coordinate, returned as integers that
145+ identify the pixel containing the scaled coordinate (without sub- pixel decimal offsets) .
139146
140- The conversion is performed according to the 2D geometry on a uniform grid, where the pixel coordinate origin
141- is at the top left corner, such that the pixel [0,0] corresponds to the highest (most positive) y scaled
142- coordinate and lowest (most negative) x scaled coordinate on the gird .
147+ The conversion is performed according to the 2D geometry on a uniform grid, where the pixel
148+ coordinate origin is at the top- left corner, such that pixel [0,0] corresponds to the highest
149+ (most positive) y scaled coordinate and lowest (most negative) x scaled coordinate on the grid .
143150
144- The scaled coordinate is defined by an origin and coordinates are shifted to this origin before computing their
145- 1D grid pixel coordinate values .
151+ The geometry's origin is applied so that scaled coordinates are correctly shifted before the
152+ pixel index calculation .
146153
147154 Parameters
148155 ----------
149156 scaled_coordinates_2d
150- The 2D (y,x) coordinates in scaled units which are converted to pixel coordinates.
157+ The 2D (y,x) coordinates in scaled units to convert to pixel coordinates.
151158
152159 Returns
153160 -------
154- A 2D (y,x) pixel-value coordinate.
161+ Tuple[int, int]
162+ The 2D (y,x) integer pixel coordinates.
155163 """
156164 return geometry_util .pixel_coordinates_2d_from (
157165 scaled_coordinates_2d = scaled_coordinates_2d ,
@@ -164,23 +172,24 @@ def scaled_coordinates_2d_from(
164172 self , pixel_coordinates_2d : Tuple [float , float ]
165173 ) -> Tuple [float , float ]:
166174 """
167- Convert a 2D (y,x) pixel coordinates to a 2D (y,x) scaled values .
175+ Convert a 2D (y,x) pixel coordinate to a 2D (y,x) scaled coordinate .
168176
169- The conversion is performed according to a 2D geometry on a uniform grid, where the pixel coordinate origin is at
170- the top left corner, such that the pixel [0,0] corresponds to the highest (most positive) y scaled coordinate
171- and lowest (most negative) x scaled coordinate on the gird .
177+ The conversion is performed according to the 2D geometry on a uniform grid, where the pixel
178+ coordinate origin is at the top- left corner, such that pixel [0,0] corresponds to the highest
179+ (most positive) y scaled coordinate and lowest (most negative) x scaled coordinate on the grid .
172180
173- The scaled coordinate is defined by an origin and coordinates are shifted to this origin before computing their
174- 1D grid pixel coordinate values .
181+ The geometry's origin is applied so that the returned scaled coordinate is correctly shifted
182+ relative to the coordinate system's centre .
175183
176184 Parameters
177185 ----------
178- scaled_coordinates_2d
179- The 2D (y,x) coordinates in scaled units which are converted to pixel coordinates .
186+ pixel_coordinates_2d
187+ The 2D (y,x) pixel coordinates to convert to scaled units .
180188
181189 Returns
182190 -------
183- A 2D (y,x) pixel-value coordinate.
191+ Tuple[float, float]
192+ The 2D (y,x) coordinates in scaled units.
184193 """
185194
186195 return geometry_util .scaled_coordinates_2d_from (
@@ -266,6 +275,11 @@ def grid_pixels_2d_from(self, grid_scaled_2d: Grid2D) -> Grid2D:
266275 ----------
267276 grid_scaled_2d
268277 A grid of (y,x) coordinates in scaled units.
278+
279+ Returns
280+ -------
281+ Grid2D
282+ A grid of (y,x) pixel-value coordinates as floats including the sub-pixel decimal offset.
269283 """
270284 from autoarray .structures .grids .uniform_2d import Grid2D
271285
@@ -283,7 +297,7 @@ def grid_pixel_centres_2d_from(self, grid_scaled_2d: Grid2D) -> Grid2D:
283297 returned as integers such that they map directly to the pixel they are contained within.
284298
285299 The pixel coordinate origin is at the top left corner of the grid, such that the pixel [0,0] corresponds to
286- higher y scaled coordinate value and lowest x scaled coordinate.
300+ highest y scaled coordinate value and lowest x scaled coordinate.
287301
288302 The scaled coordinate origin is defined by the class attribute origin, and coordinates are shifted to this
289303 origin before computing their 1D grid pixel indexes.
@@ -292,6 +306,12 @@ def grid_pixel_centres_2d_from(self, grid_scaled_2d: Grid2D) -> Grid2D:
292306 ----------
293307 grid_scaled_2d
294308 The grid of (y,x) coordinates in scaled units.
309+
310+ Returns
311+ -------
312+ Grid2D
313+ A grid of (y,x) integer pixel coordinates identifying which pixel each scaled coordinate
314+ falls within.
295315 """
296316 from autoarray .structures .grids .uniform_2d import Grid2D
297317
@@ -309,7 +329,7 @@ def grid_pixel_indexes_2d_from(self, grid_scaled_2d: Grid2D) -> Array2D:
309329 Convert a grid of (y,x) scaled coordinates to an array of pixel 1D indexes, which are returned as integers.
310330
311331 The pixel coordinate origin is at the top left corner of the grid, such that the pixel [0,0] corresponds to
312- higher y scaled coordinate value and lowest x scaled coordinate.
332+ highest y scaled coordinate value and lowest x scaled coordinate.
313333
314334 For example:
315335
@@ -324,6 +344,12 @@ def grid_pixel_indexes_2d_from(self, grid_scaled_2d: Grid2D) -> Array2D:
324344 ----------
325345 grid_scaled_2d
326346 The grid of (y,x) coordinates in scaled units.
347+
348+ Returns
349+ -------
350+ Array2D
351+ A 1D array of flat pixel indexes, where each value is the integer index of the pixel
352+ (counting left-to-right, top-to-bottom) that the corresponding scaled coordinate falls in.
327353 """
328354
329355 from autoarray .structures .arrays .uniform_2d import Array2D
@@ -342,7 +368,7 @@ def grid_scaled_2d_from(self, grid_pixels_2d: Grid2D) -> Grid2D:
342368 Convert a grid of (y,x) pixel coordinates to a grid of (y,x) scaled values.
343369
344370 The pixel coordinate origin is at the top left corner of the grid, such that the pixel [0,0] corresponds to
345- higher y scaled coordinate value and lowest x scaled coordinate.
371+ highest y scaled coordinate value and lowest x scaled coordinate.
346372
347373 The scaled coordinate origin is defined by the class attribute origin, and coordinates are shifted to this
348374 origin before computing their 1D grid pixel indexes.
@@ -351,6 +377,11 @@ def grid_scaled_2d_from(self, grid_pixels_2d: Grid2D) -> Grid2D:
351377 ----------
352378 grid_pixels_2d
353379 The grid of (y,x) coordinates in pixels.
380+
381+ Returns
382+ -------
383+ Grid2D
384+ A grid of (y,x) coordinates in scaled units.
354385 """
355386 from autoarray .structures .grids .uniform_2d import Grid2D
356387
0 commit comments