Skip to content

Commit

Permalink
Update coordinate class based on feedback
Browse files Browse the repository at this point in the history
- Drop scale from units
- Use `attrs` instead of `dataclass`
- Remove ABC meta class (bug)
  • Loading branch information
jp-dark committed Sep 16, 2024
1 parent afe2e54 commit 9c514cd
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions python-spec/src/somacore/coordinates.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
"""Definitions of types related to coordinate systems."""

import abc
import attrs
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):
@attrs.define(frozen=True)
class Axis:
"""A description of an axis of a coordinate system
Args:
name: Name of the axis.
unit_name: Optional string name for the units. Defaults to ``None``.
unit_scale: Optional scale for units. Defaults to ``None``.
unit: Optional units. Defaults to ``None``.
Lifecycle: experimental
"""

name: str
unit_name: Optional[str] = None
unit_scale: Optional[np.float64] = None
unit: Optional[str] = None


class CoordinateSpace(collections.abc.Sequence):
Expand Down

0 comments on commit 9c514cd

Please sign in to comment.