diff --git a/python-spec/src/somacore/coordinates.py b/python-spec/src/somacore/coordinates.py index 6acdfb1..520c240 100644 --- a/python-spec/src/somacore/coordinates.py +++ b/python-spec/src/somacore/coordinates.py @@ -2,15 +2,13 @@ import abc import collections.abc -from dataclasses import dataclass from typing import Any, Optional, Sequence, Tuple, Union import numpy as np import numpy.typing as npt -@dataclass -class Axis(metaclass=abc.ABCMeta): +class Axis: """A description of an axis of a coordinate system Args: @@ -21,9 +19,32 @@ class Axis(metaclass=abc.ABCMeta): Lifecycle: experimental """ - name: str - unit_name: Optional[str] = None - unit_scale: Optional[np.float64] = None + __slots__ = ("_name", "_unit_name", "_unit_scale") + + def __init__( + self, + name: str, + unit_name: Optional[str] = None, + unit_scale: Optional[np.float64] = None, + ): + self._name: str = name + self._unit_name: Optional[str] = unit_name + self._unit_scale: Optional[np.float64] = unit_scale + + @property + def name(self) -> str: + """Name of the axis.""" + return self._name + + @property + def unit_name(self) -> Optional[str]: + """Optional string name for the physical quantity the units are measured in.""" + return self._unit_name + + @property + def unit_scale(self) -> Optional[np.float64]: + """Optional scale for the physical quantity the units.""" + return self._unit_scale class CoordinateSpace(collections.abc.Sequence):