From 11693187d27b9cd951993bf2f33bc93d0925c753 Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Thu, 15 Jun 2023 14:29:01 +0100 Subject: [PATCH] Add a multi-dimensional PixelFrame And deprecate Frame2D --- gwcs/coordinate_frames.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/gwcs/coordinate_frames.py b/gwcs/coordinate_frames.py index f4c4f9e4..b7752c58 100644 --- a/gwcs/coordinate_frames.py +++ b/gwcs/coordinate_frames.py @@ -282,6 +282,30 @@ def _world_axis_object_components(self): return [(f"{at}{i}" if i != 0 else at, 0, 'value') for i, at in enumerate(self._axes_type)] +class PixelFrame(CoordinateFrame): + """ + A coordinate frame describing pixels. + + Parameters + ---------- + naxes : int + The number of pixel dimensions described by the frame. + name : str, optional + The name of this frame. + axes_names : list of str, optional + The names of the pixel axes. + """ + def __init__(self, naxes, axes_names=None, name=None): + super().__init__( + naxes, + ["PIXEL"]*naxes, + axes_order=list(range(naxes)), + unit=[u.pix]*naxes, + axes_names=axes_names, + name=name, + ) + + class CelestialFrame(CoordinateFrame): """ Celestial Frame Representation @@ -757,6 +781,8 @@ def coordinate_to_quantity(self, *coords): return coords[0] +@deprecated("0.19", + "Frame2D is deprecated, use PixelFrame for describing pixel axes or an instance of CoordinateFrame for custom use") class Frame2D(CoordinateFrame): """ A 2D coordinate frame.