Skip to content

Commit

Permalink
refactor: regroup spherical classes into separate files (#199)
Browse files Browse the repository at this point in the history
* refactor: regroup spherical classes into separate files

Signed-off-by: nstarman <nstarman@users.noreply.github.com>
  • Loading branch information
nstarman authored Oct 5, 2024
1 parent b827d61 commit c6ce7e3
Show file tree
Hide file tree
Showing 9 changed files with 710 additions and 617 deletions.
9 changes: 9 additions & 0 deletions src/coordinax/_src/d3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,37 @@

from . import (
base,
base_spherical,
cartesian,
compat,
constructor,
cylindrical,
generic,
lonlatspherical,
mathspherical,
spherical,
transform,
)
from .base import *
from .base_spherical import *
from .cartesian import *
from .compat import *
from .constructor import *
from .cylindrical import *
from .generic import *
from .lonlatspherical import *
from .mathspherical import *
from .spherical import *
from .transform import *

__all__: list[str] = []
__all__ += base.__all__
__all__ += cartesian.__all__
__all__ += cylindrical.__all__
__all__ += base_spherical.__all__
__all__ += spherical.__all__
__all__ += mathspherical.__all__
__all__ += lonlatspherical.__all__
__all__ += generic.__all__
__all__ += transform.__all__
__all__ += compat.__all__
Expand Down
55 changes: 55 additions & 0 deletions src/coordinax/_src/d3/base_spherical.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
"""Built-in vector classes."""

__all__ = [
"AbstractSphericalPosition",
"AbstractSphericalVelocity",
"AbstractSphericalAcceleration",
]

from abc import abstractmethod
from typing_extensions import override

from unxt import Quantity

from .base import AbstractAcceleration3D, AbstractPosition3D, AbstractVelocity3D
from coordinax._src.utils import classproperty

_90d = Quantity(90, "deg")
_180d = Quantity(180, "deg")
_360d = Quantity(360, "deg")


class AbstractSphericalPosition(AbstractPosition3D):
"""Abstract spherical vector representation."""

@override
@classproperty
@classmethod
@abstractmethod
def differential_cls(cls) -> "type[AbstractSphericalVelocity]": ...


class AbstractSphericalVelocity(AbstractVelocity3D):
"""Spherical differential representation."""

@override
@classproperty
@classmethod
@abstractmethod
def integral_cls(cls) -> type[AbstractSphericalPosition]: ...

@override
@classproperty
@classmethod
@abstractmethod
def differential_cls(cls) -> "type[AbstractSphericalAcceleration]": ...


class AbstractSphericalAcceleration(AbstractAcceleration3D):
"""Spherical acceleration representation."""

@override
@classproperty
@classmethod
@abstractmethod
def integral_cls(cls) -> type[AbstractSphericalVelocity]: ...
Loading

0 comments on commit c6ce7e3

Please sign in to comment.