From 7550d1eb3946e4a43d28457da4b4df0ee2b152cc Mon Sep 17 00:00:00 2001 From: DanRyanIrish Date: Sat, 20 Jul 2024 18:10:27 -0600 Subject: [PATCH] Some docs bugfixes relating to NDMeta. --- docs/explaining_ndcube/metadata.rst | 10 +++++----- docs/explaining_ndcube/slicing.rst | 10 +++++----- ndcube/__init__.py | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/explaining_ndcube/metadata.rst b/docs/explaining_ndcube/metadata.rst index a26eddd3c..0eda298d8 100644 --- a/docs/explaining_ndcube/metadata.rst +++ b/docs/explaining_ndcube/metadata.rst @@ -90,7 +90,7 @@ We can now access each piece of metadata by indexing ``meta`` as if it were a `d .. code-block:: python >>> meta["name"] - "world" + 'world' In this example we have provided a very simple set of metadata. In fact, it is so simple that there is no practical difference between ``meta`` and a simple `dict`. @@ -108,7 +108,7 @@ We can now access the comments by indexing the `~ndcube.NDMeta.key_comments` pro .. code-block:: python >>> meta.key_comments["name"] - "Each planet in the solar system has a name." + 'Each planet in the solar system has a name.' Now let's discuss how to initialize how to `~ndcube.NDMeta` with axis-aware metadata. (Here, we will specifically consider grid-aligned metadata. Axis-aligned metadata is assigned in the same way. But see the :ref:`assigning_axis_aligned_metadata` section for more details.) @@ -186,7 +186,7 @@ Unwanted metadata can be removing by employing the `del` operator. >>> del meta["voltage"] >>> meta.get("voltage", "deleted") - "deleted" + 'deleted' Note that the `del` operator also removes associated comments and axes. @@ -194,9 +194,9 @@ Note that the `del` operator also removes associated comments and axes. >>> del meta["voltage"] >>> meta.key_comments.get("voltage", "deleted") - "deleted" + 'deleted' >>> meta.axes.get("voltage", "deleted") - "deleted" + 'deleted' Data Shape ---------- diff --git a/docs/explaining_ndcube/slicing.rst b/docs/explaining_ndcube/slicing.rst index 1873e43d8..c447d916c 100644 --- a/docs/explaining_ndcube/slicing.rst +++ b/docs/explaining_ndcube/slicing.rst @@ -436,7 +436,7 @@ Therefore, slicing is achieved by applying Python's slicing API to `~ndcube.NDMe >>> from ndcube import NDMeta >>> raw_meta = {"salutation": "hello", "name": "world", ... "exposure time": u.Quantity([2] * 4, unit=u.s), - ... "pixel response", np.ones((4, 5))} + ... "pixel response": np.ones((4, 5))} >>> axes = {"exposure time": 0, "pixel response": (1, 2)} >>> meta = NDMeta(raw_meta, axes=axes, data_shape=(4, 4, 5)) @@ -466,7 +466,7 @@ Moreover, because the first axis has been sliced away, ``"exposure time"`` is no .. code-block:: python >>> list(sliced_meta.axes.keys()) - ["pixel response"] + ['pixel response'] Finally, note that axis-agnostic metadata is unaltered by the slicing process. @@ -518,8 +518,8 @@ In fact, ``sliced_cube.meta`` is equivalent to ``sliced_meta`` from the previous >>> sliced_cube.meta["exposure time"] >>> list(sliced_cube.meta.axes.keys()) - ["pixel response"] + ['pixel response'] >>> sliced_cube.meta["salultation"] - "hello" + 'hello' >>> sliced_cube.meta["name"] - "world" + 'world' diff --git a/ndcube/__init__.py b/ndcube/__init__.py index a9051923f..b4f740497 100644 --- a/ndcube/__init__.py +++ b/ndcube/__init__.py @@ -15,4 +15,4 @@ from .ndcube_sequence import NDCubeSequence, NDCubeSequenceBase from .version import version as __version__ -__all__ = ['NDCube', 'NDCubeSequence', "Meta", "NDCollection", "ExtraCoords", "GlobalCoords", "ExtraCoordsABC", "GlobalCoordsABC", "NDCubeBase", "NDCubeSequenceBase", "__version__"] +__all__ = ['NDCube', 'NDCubeSequence', "NDCollection", "NDMeta", "ExtraCoords", "GlobalCoords", "ExtraCoordsABC", "GlobalCoordsABC", "NDCubeBase", "NDCubeSequenceBase", "__version__"]