Skip to content

Commit

Permalink
Fix the documentation
Browse files Browse the repository at this point in the history
This does two things,
1. updates to using the "new" astropy doc theme
2. properly displays the methods inherited from parents
    in the docs.
  • Loading branch information
WilliamJamieson committed Jan 8, 2025
1 parent f584872 commit 1f459dd
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 29 deletions.
10 changes: 2 additions & 8 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import importlib.metadata

try:
from sphinx_astropy.conf.v1 import * # noqa: F403
from sphinx_astropy.conf.v2 import * # noqa: F403
except ImportError:
print( # noqa: T201
"ERROR: the documentation requires the sphinx-astropy package to be installed"
Expand Down Expand Up @@ -108,13 +108,6 @@
# name of a builtin theme or the name of a custom theme in html_theme_path.
# html_theme = None

# See sphinx-bootstrap-theme for documentation of these options
# https://github.com/ryan-roemer/sphinx-bootstrap-theme
html_theme_options = {
"logotext1": "g", # white, semi-bold
"logotext2": "wcs", # orange, light
"logotext3": ":docs", # white, light
}

# Custom sidebar templates, maps document names to template names.
# html_sidebars = {}
Expand Down Expand Up @@ -156,6 +149,7 @@
nitpicky = True
nitpick_ignore = [
("py:class", "gwcs.api.GWCSAPIMixin"),
("py:class", "gwcs.wcs._pipeline.Pipeline"),
("py:obj", "astropy.modeling.projections.projcodes"),
("py:attr", "gwcs.WCS.bounding_box"),
("py:meth", "gwcs.WCS.footprint"),
Expand Down
10 changes: 10 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,18 @@ Reference/API
-------------

.. automodapi:: gwcs.wcs
:inherited-members:

.. automodapi:: gwcs.coordinate_frames
:inherited-members:

.. automodapi:: gwcs.wcstools

.. automodapi:: gwcs.selector
:inherited-members:

.. automodapi:: gwcs.spectroscopy
:inherited-members:

.. automodapi:: gwcs.geometry
:inherited-members:
43 changes: 22 additions & 21 deletions gwcs/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ def pixel_to_world_values(self, *pixel_arrays):
def array_index_to_world_values(self, *index_arrays):
"""
Convert array indices to world coordinates.
This is the same as `~BaseLowLevelWCS.pixel_to_world_values` except that
the indices should be given in ``(i, j)`` order, where for an image
This is the same as `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_to_world_values`
except that the indices should be given in ``(i, j)`` order, where for an image
``i`` is the row and ``j`` is the column (i.e. the opposite order to
`~BaseLowLevelWCS.pixel_to_world_values`).
`~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_to_world_values`).
"""
pixel_arrays = index_arrays[::-1]
return self.pixel_to_world_values(*pixel_arrays)
Expand All @@ -127,11 +127,11 @@ def world_to_pixel_values(self, *world_arrays):
def world_to_array_index_values(self, *world_arrays):
"""
Convert world coordinates to array indices.
This is the same as `~BaseLowLevelWCS.world_to_pixel_values` except that
the indices should be returned in ``(i, j)`` order, where for an image
``i`` is the row and ``j`` is the column (i.e. the opposite order to
`~BaseLowLevelWCS.pixel_to_world_values`). The indices should be
returned as rounded integers.
This is the same as `~astropy.wcs.wcsapi.BaseLowLevelWCS.world_to_pixel_values`
except that the indices should be returned in ``(i, j)`` order, where for an
image ``i`` is the row and ``j`` is the column (i.e. the opposite order to
`~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_to_world_values`). The indices should
be returned as rounded integers.
"""
results = self.world_to_pixel_values(*world_arrays)
results = (results,) if self.pixel_n_dim == 1 else results[::-1]
Expand All @@ -143,7 +143,7 @@ def world_to_array_index_values(self, *world_arrays):
def array_shape(self):
"""
The shape of the data that the WCS applies to as a tuple of
length `~BaseLowLevelWCS.pixel_n_dim`.
length `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim`.
If the WCS is valid in the context of a dataset with a particular
shape, then this property can be used to store the shape of the
data. This can be used for example if implementing slicing of WCS
Expand All @@ -167,12 +167,13 @@ def array_shape(self, value):
def pixel_bounds(self):
"""
The bounds (in pixel coordinates) inside which the WCS is defined,
as a list with `~BaseLowLevelWCS.pixel_n_dim` ``(min, max)`` tuples.
The bounds should be given in ``[(xmin, xmax), (ymin, ymax)]``
order. WCS solutions are sometimes only guaranteed to be accurate
within a certain range of pixel values, for example when defining a
WCS that includes fitted distortions. This is an optional property,
and it should return `None` if a shape is not known or relevant.
as a list with `~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim`
``(min, max)`` tuples. The bounds should be given in
``[(xmin, xmax), (ymin, ymax)]`` order. WCS solutions are sometimes
only guaranteed to be accurate within a certain range of pixel values,
for example when defining a WCS that includes fitted distortions. This
is an optional property, and it should return `None` if a shape is not
known or relevant.
"""
bounding_box = self.bounding_box
if bounding_box is None:
Expand Down Expand Up @@ -225,12 +226,12 @@ def pixel_shape(self, value):
@property
def axis_correlation_matrix(self):
"""
Returns an (`~BaseLowLevelWCS.world_n_dim`,
`~BaseLowLevelWCS.pixel_n_dim`) matrix that indicates using booleans
whether a given world coordinate depends on a given pixel coordinate.
This defaults to a matrix where all elements are `True` in the absence of
any further information. For completely independent axes, the diagonal
would be `True` and all other entries `False`.
Returns an (`~astropy.wcs.wcsapi.BaseLowLevelWCS.world_n_dim`,
`~astropy.wcs.wcsapi.BaseLowLevelWCS.pixel_n_dim`) matrix that indicates
using booleans whether a given world coordinate depends on a given pixel
coordinate. This defaults to a matrix where all elements are `True` in
the absence of any further information. For completely independent axes,
the diagonal would be `True` and all other entries `False`.
"""
return separable.separability_matrix(self.forward_transform)

Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ docs = [
"sphinx-rtd-theme",
"stsci-rtd-theme",
"sphinx-astropy",
"sphinx-copybutton",
"pydata-sphinx-theme",
"sphinx-asdf",
"tomli; python_version <'3.11'",
]
Expand Down

0 comments on commit 1f459dd

Please sign in to comment.