From 335619dfd0db8dee738dd54b2a81192e8397b1f9 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 --- gwcs/coordinate_frames.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/gwcs/coordinate_frames.py b/gwcs/coordinate_frames.py index fcf329e0..51c46ae4 100644 --- a/gwcs/coordinate_frames.py +++ b/gwcs/coordinate_frames.py @@ -312,6 +312,34 @@ 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. + axes_order : list of int, optional + The axes order, if not specified defaults to `range(naxes)` (i.e. all + axes are in this 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_order=None, axes_names=None, name=None): + axes_order = axes_order if axes_order is not None else list(range(naxes)) + super().__init__( + naxes, + ["PIXEL"]*naxes, + axes_order=axes_order, + unit=[u.pix]*naxes, + axes_names=axes_names, + name=name, + ) + + class CelestialFrame(CoordinateFrame): """ Celestial Frame Representation