Skip to content

Commit

Permalink
Update description of 2D array indices
Browse files Browse the repository at this point in the history
  • Loading branch information
larrybradley committed Oct 4, 2024
1 parent 120693c commit b611bcc
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions docs/getting_started/pixel_conventions.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Pixel Coordinate Conventions
============================

In Photutils, integer pixel coordinates fall at the center of pixels,
and they are 0-indexed, matching the Python 0-based indexing. That means
the first pixel is considered pixel ``0``, but pixel coordinate ``0`` is
the *center* of that pixel. Hence, the first pixel spans pixel values
``-0.5`` to ``0.5``.
In Photutils, integer pixel coordinates are located at the center of
pixels, and they are 0-indexed, matching the Python 0-based indexing.
That means the first pixel is considered pixel ``0``, but pixel
coordinate ``0`` is the *center* of that pixel. Hence, the first pixel
spans pixel values ``-0.5`` to ``0.5``.

For a 2-dimensional array, ``(x, y) = (0, 0)`` corresponds to
the *center* of the bottom, leftmost array element. That means
Expand All @@ -15,10 +15,10 @@ WCS <https://fits.gsfc.nasa.gov/fits_wcs.html>`_, `ds9`_, and
`SourceExtractor`_ conventions, in which the center of the bottom,
leftmost array element is ``(x, y) = (1, 1)``.

Following Python indexing, the ``x`` (column) coordinate corresponds to
the second (fast) array index and the ``y`` (row) coordinate corresponds
to the first (slow) index. ``image[y, x]`` gives the value at pixel
coordinates ``(x, y)``.
Following Python indexing, two-dimensional arrays are indexed as
``image[yi, xi]``, with 0 being the first index. The ``xi`` (column)
index corresponds to the second (fast) array index and the ``yi`` (row)
index corresponds to the first (slow) index.

.. _SourceExtractor: https://sextractor.readthedocs.io/en/latest/
.. _ds9: http://ds9.si.edu/

0 comments on commit b611bcc

Please sign in to comment.