From 730ebb3bc31c45c7a6a34ca19a05919816b051d9 Mon Sep 17 00:00:00 2001 From: nstarman Date: Wed, 14 Aug 2024 16:33:09 -0400 Subject: [PATCH] refactor: move to _coordinax folder Signed-off-by: nstarman --- pyproject.toml | 2 +- src/coordinax/__init__.py | 36 +++++++++---------- src/coordinax/_coordinax/__init__.py | 1 + src/coordinax/{ => _coordinax}/_base.py | 2 +- src/coordinax/{ => _coordinax}/_base_acc.py | 0 src/coordinax/{ => _coordinax}/_base_pos.py | 3 +- src/coordinax/{ => _coordinax}/_base_vel.py | 0 src/coordinax/{ => _coordinax}/_checks.py | 2 +- src/coordinax/{ => _coordinax}/_converters.py | 2 +- .../{ => _coordinax}/_d1/__init__.py | 0 src/coordinax/{ => _coordinax}/_d1/base.py | 10 +++--- .../{ => _coordinax}/_d1/cartesian.py | 8 ++--- src/coordinax/{ => _coordinax}/_d1/compat.py | 2 +- src/coordinax/{ => _coordinax}/_d1/operate.py | 4 +-- src/coordinax/{ => _coordinax}/_d1/radial.py | 6 ++-- .../{ => _coordinax}/_d1/transform.py | 4 +-- .../{ => _coordinax}/_d2/__init__.py | 0 src/coordinax/{ => _coordinax}/_d2/base.py | 10 +++--- .../{ => _coordinax}/_d2/cartesian.py | 8 ++--- src/coordinax/{ => _coordinax}/_d2/compat.py | 2 +- src/coordinax/{ => _coordinax}/_d2/operate.py | 4 +-- src/coordinax/{ => _coordinax}/_d2/polar.py | 8 ++--- .../{ => _coordinax}/_d2/transform.py | 2 +- .../{ => _coordinax}/_d3/__init__.py | 0 src/coordinax/{ => _coordinax}/_d3/base.py | 10 +++--- .../{ => _coordinax}/_d3/cartesian.py | 8 ++--- src/coordinax/{ => _coordinax}/_d3/compat.py | 2 +- .../{ => _coordinax}/_d3/cylindrical.py | 8 ++--- src/coordinax/{ => _coordinax}/_d3/operate.py | 4 +-- src/coordinax/{ => _coordinax}/_d3/sphere.py | 10 +++--- .../{ => _coordinax}/_d3/transform.py | 2 +- .../{ => _coordinax}/_d4/__init__.py | 0 src/coordinax/{ => _coordinax}/_d4/base.py | 6 ++-- src/coordinax/{ => _coordinax}/_d4/compat.py | 0 src/coordinax/{ => _coordinax}/_d4/operate.py | 2 +- .../{ => _coordinax}/_d4/spacetime.py | 10 +++--- .../{ => _coordinax}/_dn/__init__.py | 0 src/coordinax/{ => _coordinax}/_dn/base.py | 10 +++--- .../{ => _coordinax}/_dn/cartesian.py | 10 +++--- .../{ => _coordinax}/_dn/poincare.py | 8 ++--- .../{ => _coordinax}/_dn/transform.py | 0 src/coordinax/{ => _coordinax}/_exceptions.py | 0 src/coordinax/{ => _coordinax}/_funcs.py | 0 .../{ => _coordinax}/_interop/__init__.py | 0 .../_interop/coordinax_interop_astropy.py | 11 +++--- src/coordinax/{ => _coordinax}/_mixins.py | 0 src/coordinax/{ => _coordinax}/_space.py | 16 ++++----- .../{ => _coordinax}/_transform/__init__.py | 0 .../_transform/accelerations.py | 12 +++---- .../{ => _coordinax}/_transform/d1.py | 14 ++++---- .../{ => _coordinax}/_transform/d2.py | 20 +++++------ .../{ => _coordinax}/_transform/d3.py | 18 +++++----- .../_transform/differentials.py | 10 +++--- .../{ => _coordinax}/_transform/dn.py | 9 +++-- .../{ => _coordinax}/_transform/space.py | 9 +++-- src/coordinax/{ => _coordinax}/_typing.py | 0 src/coordinax/{ => _coordinax}/_utils.py | 2 +- .../_coordinax/operators/__init__.py | 4 +++ .../{ => _coordinax}/operators/_base.py | 2 +- .../{ => _coordinax}/operators/_composite.py | 2 +- .../{ => _coordinax}/operators/_funcs.py | 0 .../operators/_galilean/__init__.py | 0 .../operators/_galilean/base.py | 2 +- .../operators/_galilean/boost.py | 12 +++---- .../operators/_galilean/composite.py | 10 +++--- .../operators/_galilean/rotation.py | 12 +++---- .../operators/_galilean/translation.py | 18 +++++----- .../{ => _coordinax}/operators/_identity.py | 2 +- .../{ => _coordinax}/operators/_sequential.py | 0 src/coordinax/operators.py | 31 ++++++++++++++++ src/coordinax/operators/__init__.py | 20 ----------- tests/test_exceptions.py | 2 +- tests/test_jax_ops.py | 2 +- 73 files changed, 235 insertions(+), 211 deletions(-) create mode 100644 src/coordinax/_coordinax/__init__.py rename src/coordinax/{ => _coordinax}/_base.py (99%) rename src/coordinax/{ => _coordinax}/_base_acc.py (100%) rename src/coordinax/{ => _coordinax}/_base_pos.py (99%) rename src/coordinax/{ => _coordinax}/_base_vel.py (100%) rename src/coordinax/{ => _coordinax}/_checks.py (94%) rename src/coordinax/{ => _coordinax}/_converters.py (88%) rename src/coordinax/{ => _coordinax}/_d1/__init__.py (100%) rename src/coordinax/{ => _coordinax}/_d1/base.py (90%) rename src/coordinax/{ => _coordinax}/_d1/cartesian.py (98%) rename src/coordinax/{ => _coordinax}/_d1/compat.py (95%) rename src/coordinax/{ => _coordinax}/_d1/operate.py (83%) rename src/coordinax/{ => _coordinax}/_d1/radial.py (91%) rename src/coordinax/{ => _coordinax}/_d1/transform.py (97%) rename src/coordinax/{ => _coordinax}/_d2/__init__.py (100%) rename src/coordinax/{ => _coordinax}/_d2/base.py (84%) rename src/coordinax/{ => _coordinax}/_d2/cartesian.py (97%) rename src/coordinax/{ => _coordinax}/_d2/compat.py (95%) rename src/coordinax/{ => _coordinax}/_d2/operate.py (83%) rename src/coordinax/{ => _coordinax}/_d2/polar.py (93%) rename src/coordinax/{ => _coordinax}/_d2/transform.py (98%) rename src/coordinax/{ => _coordinax}/_d3/__init__.py (100%) rename src/coordinax/{ => _coordinax}/_d3/base.py (85%) rename src/coordinax/{ => _coordinax}/_d3/cartesian.py (97%) rename src/coordinax/{ => _coordinax}/_d3/compat.py (98%) rename src/coordinax/{ => _coordinax}/_d3/cylindrical.py (93%) rename src/coordinax/{ => _coordinax}/_d3/operate.py (94%) rename src/coordinax/{ => _coordinax}/_d3/sphere.py (99%) rename src/coordinax/{ => _coordinax}/_d3/transform.py (99%) rename src/coordinax/{ => _coordinax}/_d4/__init__.py (100%) rename src/coordinax/{ => _coordinax}/_d4/base.py (79%) rename src/coordinax/{ => _coordinax}/_d4/compat.py (100%) rename src/coordinax/{ => _coordinax}/_d4/operate.py (96%) rename src/coordinax/{ => _coordinax}/_d4/spacetime.py (96%) rename src/coordinax/{ => _coordinax}/_dn/__init__.py (100%) rename src/coordinax/{ => _coordinax}/_dn/base.py (97%) rename src/coordinax/{ => _coordinax}/_dn/cartesian.py (98%) rename src/coordinax/{ => _coordinax}/_dn/poincare.py (88%) rename src/coordinax/{ => _coordinax}/_dn/transform.py (100%) rename src/coordinax/{ => _coordinax}/_exceptions.py (100%) rename src/coordinax/{ => _coordinax}/_funcs.py (100%) rename src/coordinax/{ => _coordinax}/_interop/__init__.py (100%) rename src/coordinax/{ => _coordinax}/_interop/coordinax_interop_astropy.py (99%) rename src/coordinax/{ => _coordinax}/_mixins.py (100%) rename src/coordinax/{ => _coordinax}/_space.py (97%) rename src/coordinax/{ => _coordinax}/_transform/__init__.py (100%) rename src/coordinax/{ => _coordinax}/_transform/accelerations.py (94%) rename src/coordinax/{ => _coordinax}/_transform/d1.py (96%) rename src/coordinax/{ => _coordinax}/_transform/d2.py (94%) rename src/coordinax/{ => _coordinax}/_transform/d3.py (96%) rename src/coordinax/{ => _coordinax}/_transform/differentials.py (94%) rename src/coordinax/{ => _coordinax}/_transform/dn.py (89%) rename src/coordinax/{ => _coordinax}/_transform/space.py (90%) rename src/coordinax/{ => _coordinax}/_typing.py (100%) rename src/coordinax/{ => _coordinax}/_utils.py (96%) create mode 100644 src/coordinax/_coordinax/operators/__init__.py rename src/coordinax/{ => _coordinax}/operators/_base.py (98%) rename src/coordinax/{ => _coordinax}/operators/_composite.py (97%) rename src/coordinax/{ => _coordinax}/operators/_funcs.py (100%) rename src/coordinax/{ => _coordinax}/operators/_galilean/__init__.py (100%) rename src/coordinax/{ => _coordinax}/operators/_galilean/base.py (89%) rename src/coordinax/{ => _coordinax}/operators/_galilean/boost.py (91%) rename src/coordinax/{ => _coordinax}/operators/_galilean/composite.py (95%) rename src/coordinax/{ => _coordinax}/operators/_galilean/rotation.py (95%) rename src/coordinax/{ => _coordinax}/operators/_galilean/translation.py (96%) rename src/coordinax/{ => _coordinax}/operators/_identity.py (98%) rename src/coordinax/{ => _coordinax}/operators/_sequential.py (100%) create mode 100644 src/coordinax/operators.py delete mode 100644 src/coordinax/operators/__init__.py diff --git a/pyproject.toml b/pyproject.toml index 44e41a6..5554477 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -195,7 +195,7 @@ [tool.ruff.lint.isort] combine-as-imports = true extra-standard-library = ["typing_extensions"] - known-first-party = ["dataclassish", "quaxed", "unxt"] + known-first-party = ["dataclassish", "quaxed", "unxt", "xmmutablemap"] known-local-folder = ["coordinax"] diff --git a/src/coordinax/__init__.py b/src/coordinax/__init__.py index 43f7c00..c6d68ae 100644 --- a/src/coordinax/__init__.py +++ b/src/coordinax/__init__.py @@ -7,7 +7,8 @@ from jaxtyping import install_import_hook -from . import ( +from . import operators +from ._coordinax import ( _base, _base_acc, _base_pos, @@ -23,23 +24,22 @@ _transform, _typing, _utils, - operators, ) -from ._base import * -from ._base_acc import * -from ._base_pos import * -from ._base_vel import * -from ._d1 import * -from ._d2 import * -from ._d3 import * -from ._d4 import * -from ._dn import * -from ._exceptions import * -from ._funcs import * -from ._space import * -from ._transform import * -from ._typing import * -from ._utils import * +from ._coordinax._base import * +from ._coordinax._base_acc import * +from ._coordinax._base_pos import * +from ._coordinax._base_vel import * +from ._coordinax._d1 import * +from ._coordinax._d2 import * +from ._coordinax._d3 import * +from ._coordinax._d4 import * +from ._coordinax._dn import * +from ._coordinax._exceptions import * +from ._coordinax._funcs import * +from ._coordinax._space import * +from ._coordinax._transform import * +from ._coordinax._typing import * +from ._coordinax._utils import * from ._version import version as __version__ from .setup_package import RUNTIME_TYPECHECKER @@ -62,7 +62,7 @@ # Interoperability # Astropy -from ._interop import coordinax_interop_astropy # noqa: E402 +from ._coordinax._interop import coordinax_interop_astropy # noqa: E402 # Runtime Typechecker install_import_hook("coordinax", RUNTIME_TYPECHECKER) diff --git a/src/coordinax/_coordinax/__init__.py b/src/coordinax/_coordinax/__init__.py new file mode 100644 index 0000000..e58e219 --- /dev/null +++ b/src/coordinax/_coordinax/__init__.py @@ -0,0 +1 @@ +"""Coordinax package.""" diff --git a/src/coordinax/_base.py b/src/coordinax/_coordinax/_base.py similarity index 99% rename from src/coordinax/_base.py rename to src/coordinax/_coordinax/_base.py index 5e1325a..ecb9756 100644 --- a/src/coordinax/_base.py +++ b/src/coordinax/_coordinax/_base.py @@ -29,8 +29,8 @@ from dataclassish import field_items, field_values, replace from unxt import Quantity, unitsystem +from ._typing import Unit from ._utils import classproperty, full_shaped -from coordinax._typing import Unit if TYPE_CHECKING: from typing_extensions import Self diff --git a/src/coordinax/_base_acc.py b/src/coordinax/_coordinax/_base_acc.py similarity index 100% rename from src/coordinax/_base_acc.py rename to src/coordinax/_coordinax/_base_acc.py diff --git a/src/coordinax/_base_pos.py b/src/coordinax/_coordinax/_base_pos.py similarity index 99% rename from src/coordinax/_base_pos.py rename to src/coordinax/_coordinax/_base_pos.py index 32b323f..18adcb4 100644 --- a/src/coordinax/_base_pos.py +++ b/src/coordinax/_coordinax/_base_pos.py @@ -19,7 +19,7 @@ from dataclassish import field_items from unxt import Quantity -import coordinax._typing as ct +from . import _typing as ct from ._base import AbstractVector from ._mixins import AvalMixin from ._utils import classproperty @@ -265,7 +265,6 @@ def _mul_v_pos(lhs: ArrayLike, rhs: AbstractPosition, /) -> AbstractPosition: So let's define a new class and try it out: >>> from typing import ClassVar - >>> from coordinax._utils import classproperty >>> class MyCartesian(cx.AbstractPosition): ... x: Quantity ... y: Quantity diff --git a/src/coordinax/_base_vel.py b/src/coordinax/_coordinax/_base_vel.py similarity index 100% rename from src/coordinax/_base_vel.py rename to src/coordinax/_coordinax/_base_vel.py diff --git a/src/coordinax/_checks.py b/src/coordinax/_coordinax/_checks.py similarity index 94% rename from src/coordinax/_checks.py rename to src/coordinax/_coordinax/_checks.py index f261878..bd9f587 100644 --- a/src/coordinax/_checks.py +++ b/src/coordinax/_coordinax/_checks.py @@ -8,7 +8,7 @@ import quaxed.array_api as xp from unxt import Quantity -from coordinax._typing import BatchableAngle, BatchableLength +from coordinax._coordinax._typing import BatchableAngle, BatchableLength _0m = Quantity(0, "meter") _0d = Quantity(0, "rad") diff --git a/src/coordinax/_converters.py b/src/coordinax/_coordinax/_converters.py similarity index 88% rename from src/coordinax/_converters.py rename to src/coordinax/_coordinax/_converters.py index 9374ba2..c6d5215 100644 --- a/src/coordinax/_converters.py +++ b/src/coordinax/_coordinax/_converters.py @@ -5,7 +5,7 @@ from unxt import Quantity -from coordinax._typing import BatchableAngle +from coordinax._coordinax._typing import BatchableAngle _2pid = Quantity(360, "deg") diff --git a/src/coordinax/_d1/__init__.py b/src/coordinax/_coordinax/_d1/__init__.py similarity index 100% rename from src/coordinax/_d1/__init__.py rename to src/coordinax/_coordinax/_d1/__init__.py diff --git a/src/coordinax/_d1/base.py b/src/coordinax/_coordinax/_d1/base.py similarity index 90% rename from src/coordinax/_d1/base.py rename to src/coordinax/_coordinax/_d1/base.py index 0a5163d..1ba7929 100644 --- a/src/coordinax/_d1/base.py +++ b/src/coordinax/_coordinax/_d1/base.py @@ -11,11 +11,11 @@ import quaxed.numpy as jnp from unxt import Quantity -from coordinax._base import AbstractVector -from coordinax._base_acc import AbstractAcceleration -from coordinax._base_pos import AbstractPosition -from coordinax._base_vel import AbstractVelocity -from coordinax._utils import classproperty +from coordinax._coordinax._base import AbstractVector +from coordinax._coordinax._base_acc import AbstractAcceleration +from coordinax._coordinax._base_pos import AbstractPosition +from coordinax._coordinax._base_vel import AbstractVelocity +from coordinax._coordinax._utils import classproperty class AbstractPosition1D(AbstractPosition): diff --git a/src/coordinax/_d1/cartesian.py b/src/coordinax/_coordinax/_d1/cartesian.py similarity index 98% rename from src/coordinax/_d1/cartesian.py rename to src/coordinax/_coordinax/_d1/cartesian.py index d541329..6320aeb 100644 --- a/src/coordinax/_d1/cartesian.py +++ b/src/coordinax/_coordinax/_d1/cartesian.py @@ -19,11 +19,11 @@ from quaxed import lax as qlax from unxt import Quantity -import coordinax._typing as ct +import coordinax._coordinax._typing as ct from .base import AbstractAcceleration1D, AbstractPosition1D, AbstractVelocity1D -from coordinax._base_pos import AbstractPosition -from coordinax._mixins import AvalMixin -from coordinax._utils import classproperty +from coordinax._coordinax._base_pos import AbstractPosition +from coordinax._coordinax._mixins import AvalMixin +from coordinax._coordinax._utils import classproperty @final diff --git a/src/coordinax/_d1/compat.py b/src/coordinax/_coordinax/_d1/compat.py similarity index 95% rename from src/coordinax/_d1/compat.py rename to src/coordinax/_coordinax/_d1/compat.py index cb1c5a2..81cbfe1 100644 --- a/src/coordinax/_d1/compat.py +++ b/src/coordinax/_coordinax/_d1/compat.py @@ -12,7 +12,7 @@ from .base import AbstractPosition1D from .cartesian import CartesianAcceleration1D, CartesianPosition1D, CartesianVelocity1D -from coordinax._utils import full_shaped +from coordinax._coordinax._utils import full_shaped @conversion_method(type_from=AbstractPosition1D, type_to=Quantity) # type: ignore[misc] diff --git a/src/coordinax/_d1/operate.py b/src/coordinax/_coordinax/_d1/operate.py similarity index 83% rename from src/coordinax/_d1/operate.py rename to src/coordinax/_coordinax/_d1/operate.py index 1a27e4e..4fac4c4 100644 --- a/src/coordinax/_d1/operate.py +++ b/src/coordinax/_coordinax/_d1/operate.py @@ -11,8 +11,8 @@ from unxt import Quantity from .cartesian import CartesianPosition1D -from coordinax._typing import TimeBatchOrScalar -from coordinax.operators._base import AbstractOperator, op_call_dispatch +from coordinax._coordinax._typing import TimeBatchOrScalar +from coordinax._coordinax.operators._base import AbstractOperator, op_call_dispatch Q1: TypeAlias = Shaped[Quantity["length"], "*#batch 1"] diff --git a/src/coordinax/_d1/radial.py b/src/coordinax/_coordinax/_d1/radial.py similarity index 91% rename from src/coordinax/_d1/radial.py rename to src/coordinax/_coordinax/_d1/radial.py index 3f8a54a..33fe0d7 100644 --- a/src/coordinax/_d1/radial.py +++ b/src/coordinax/_coordinax/_d1/radial.py @@ -8,10 +8,10 @@ from unxt import AbstractDistance, Distance, Quantity -import coordinax._typing as ct +import coordinax._coordinax._typing as ct from .base import AbstractAcceleration1D, AbstractPosition1D, AbstractVelocity1D -from coordinax._checks import check_r_non_negative -from coordinax._utils import classproperty +from coordinax._coordinax._checks import check_r_non_negative +from coordinax._coordinax._utils import classproperty @final diff --git a/src/coordinax/_d1/transform.py b/src/coordinax/_coordinax/_d1/transform.py similarity index 97% rename from src/coordinax/_d1/transform.py rename to src/coordinax/_coordinax/_d1/transform.py index c46b84d..2707f61 100644 --- a/src/coordinax/_d1/transform.py +++ b/src/coordinax/_coordinax/_d1/transform.py @@ -9,8 +9,8 @@ from .base import AbstractAcceleration1D, AbstractPosition1D, AbstractVelocity1D from .cartesian import CartesianAcceleration1D, CartesianPosition1D, CartesianVelocity1D from .radial import RadialAcceleration, RadialPosition, RadialVelocity -from coordinax._base_pos import AbstractPosition -from coordinax._base_vel import AbstractVelocity +from coordinax._coordinax._base_pos import AbstractPosition +from coordinax._coordinax._base_vel import AbstractVelocity ############################################################################### # 1D diff --git a/src/coordinax/_d2/__init__.py b/src/coordinax/_coordinax/_d2/__init__.py similarity index 100% rename from src/coordinax/_d2/__init__.py rename to src/coordinax/_coordinax/_d2/__init__.py diff --git a/src/coordinax/_d2/base.py b/src/coordinax/_coordinax/_d2/base.py similarity index 84% rename from src/coordinax/_d2/base.py rename to src/coordinax/_coordinax/_d2/base.py index 7797312..cf56c56 100644 --- a/src/coordinax/_d2/base.py +++ b/src/coordinax/_coordinax/_d2/base.py @@ -5,11 +5,11 @@ from abc import abstractmethod -from coordinax._base import AbstractVector -from coordinax._base_acc import AbstractAcceleration -from coordinax._base_pos import AbstractPosition -from coordinax._base_vel import AbstractVelocity -from coordinax._utils import classproperty +from coordinax._coordinax._base import AbstractVector +from coordinax._coordinax._base_acc import AbstractAcceleration +from coordinax._coordinax._base_pos import AbstractPosition +from coordinax._coordinax._base_vel import AbstractVelocity +from coordinax._coordinax._utils import classproperty class AbstractPosition2D(AbstractPosition): diff --git a/src/coordinax/_d2/cartesian.py b/src/coordinax/_coordinax/_d2/cartesian.py similarity index 97% rename from src/coordinax/_d2/cartesian.py rename to src/coordinax/_coordinax/_d2/cartesian.py index 6954874..fc7e618 100644 --- a/src/coordinax/_d2/cartesian.py +++ b/src/coordinax/_coordinax/_d2/cartesian.py @@ -19,11 +19,11 @@ from quaxed import lax as qlax from unxt import Quantity -import coordinax._typing as ct +import coordinax._coordinax._typing as ct from .base import AbstractAcceleration2D, AbstractPosition2D, AbstractVelocity2D -from coordinax._base_pos import AbstractPosition -from coordinax._mixins import AvalMixin -from coordinax._utils import classproperty +from coordinax._coordinax._base_pos import AbstractPosition +from coordinax._coordinax._mixins import AvalMixin +from coordinax._coordinax._utils import classproperty @final diff --git a/src/coordinax/_d2/compat.py b/src/coordinax/_coordinax/_d2/compat.py similarity index 95% rename from src/coordinax/_d2/compat.py rename to src/coordinax/_coordinax/_d2/compat.py index 034632c..edab77a 100644 --- a/src/coordinax/_d2/compat.py +++ b/src/coordinax/_coordinax/_d2/compat.py @@ -12,7 +12,7 @@ from .base import AbstractPosition2D from .cartesian import CartesianAcceleration2D, CartesianPosition2D, CartesianVelocity2D -from coordinax._utils import full_shaped +from coordinax._coordinax._utils import full_shaped ##################################################################### # Quantity diff --git a/src/coordinax/_d2/operate.py b/src/coordinax/_coordinax/_d2/operate.py similarity index 83% rename from src/coordinax/_d2/operate.py rename to src/coordinax/_coordinax/_d2/operate.py index 68d69f5..93b05b5 100644 --- a/src/coordinax/_d2/operate.py +++ b/src/coordinax/_coordinax/_d2/operate.py @@ -11,8 +11,8 @@ from unxt import Quantity from .cartesian import CartesianPosition2D -from coordinax._typing import TimeBatchOrScalar -from coordinax.operators._base import AbstractOperator, op_call_dispatch +from coordinax._coordinax._typing import TimeBatchOrScalar +from coordinax._coordinax.operators._base import AbstractOperator, op_call_dispatch Q2: TypeAlias = Shaped[Quantity["length"], "*#batch 2"] diff --git a/src/coordinax/_d2/polar.py b/src/coordinax/_coordinax/_d2/polar.py similarity index 93% rename from src/coordinax/_d2/polar.py rename to src/coordinax/_coordinax/_d2/polar.py index 38850f0..8ec53a1 100644 --- a/src/coordinax/_d2/polar.py +++ b/src/coordinax/_coordinax/_d2/polar.py @@ -17,11 +17,11 @@ from dataclassish import replace from unxt import AbstractDistance, Distance, Quantity -import coordinax._typing as ct +import coordinax._coordinax._typing as ct from .base import AbstractAcceleration2D, AbstractPosition2D, AbstractVelocity2D -from coordinax._checks import check_azimuth_range, check_r_non_negative -from coordinax._converters import converter_azimuth_to_range -from coordinax._utils import classproperty +from coordinax._coordinax._checks import check_azimuth_range, check_r_non_negative +from coordinax._coordinax._converters import converter_azimuth_to_range +from coordinax._coordinax._utils import classproperty @final diff --git a/src/coordinax/_d2/transform.py b/src/coordinax/_coordinax/_d2/transform.py similarity index 98% rename from src/coordinax/_d2/transform.py rename to src/coordinax/_coordinax/_d2/transform.py index ef1b29d..7976cb6 100644 --- a/src/coordinax/_d2/transform.py +++ b/src/coordinax/_coordinax/_d2/transform.py @@ -11,7 +11,7 @@ from .base import AbstractPosition2D, AbstractVelocity2D from .cartesian import CartesianAcceleration2D, CartesianPosition2D, CartesianVelocity2D from .polar import PolarPosition, PolarVelocity -from coordinax._base_pos import AbstractPosition +from coordinax._coordinax._base_pos import AbstractPosition @dispatch diff --git a/src/coordinax/_d3/__init__.py b/src/coordinax/_coordinax/_d3/__init__.py similarity index 100% rename from src/coordinax/_d3/__init__.py rename to src/coordinax/_coordinax/_d3/__init__.py diff --git a/src/coordinax/_d3/base.py b/src/coordinax/_coordinax/_d3/base.py similarity index 85% rename from src/coordinax/_d3/base.py rename to src/coordinax/_coordinax/_d3/base.py index cc069ac..f200b9c 100644 --- a/src/coordinax/_d3/base.py +++ b/src/coordinax/_coordinax/_d3/base.py @@ -6,11 +6,11 @@ from abc import abstractmethod from typing_extensions import override -from coordinax._base import AbstractVector -from coordinax._base_acc import AbstractAcceleration -from coordinax._base_pos import AbstractPosition -from coordinax._base_vel import AbstractVelocity -from coordinax._utils import classproperty +from coordinax._coordinax._base import AbstractVector +from coordinax._coordinax._base_acc import AbstractAcceleration +from coordinax._coordinax._base_pos import AbstractPosition +from coordinax._coordinax._base_vel import AbstractVelocity +from coordinax._coordinax._utils import classproperty class AbstractPosition3D(AbstractPosition): diff --git a/src/coordinax/_d3/cartesian.py b/src/coordinax/_coordinax/_d3/cartesian.py similarity index 97% rename from src/coordinax/_d3/cartesian.py rename to src/coordinax/_coordinax/_d3/cartesian.py index ae2e9ef..cdabe29 100644 --- a/src/coordinax/_d3/cartesian.py +++ b/src/coordinax/_coordinax/_d3/cartesian.py @@ -20,11 +20,11 @@ from dataclassish import field_items from unxt import Quantity -import coordinax._typing as ct +import coordinax._coordinax._typing as ct from .base import AbstractAcceleration3D, AbstractPosition3D, AbstractVelocity3D -from coordinax._base_pos import AbstractPosition -from coordinax._mixins import AvalMixin -from coordinax._utils import classproperty +from coordinax._coordinax._base_pos import AbstractPosition +from coordinax._coordinax._mixins import AvalMixin +from coordinax._coordinax._utils import classproperty @final diff --git a/src/coordinax/_d3/compat.py b/src/coordinax/_coordinax/_d3/compat.py similarity index 98% rename from src/coordinax/_d3/compat.py rename to src/coordinax/_coordinax/_d3/compat.py index 6a4601a..9acff28 100644 --- a/src/coordinax/_d3/compat.py +++ b/src/coordinax/_coordinax/_d3/compat.py @@ -12,7 +12,7 @@ from .base import AbstractPosition3D from .cartesian import CartesianAcceleration3D, CartesianPosition3D, CartesianVelocity3D -from coordinax._utils import full_shaped +from coordinax._coordinax._utils import full_shaped ##################################################################### # Quantity diff --git a/src/coordinax/_d3/cylindrical.py b/src/coordinax/_coordinax/_d3/cylindrical.py similarity index 93% rename from src/coordinax/_d3/cylindrical.py rename to src/coordinax/_coordinax/_d3/cylindrical.py index b9a51e8..317ee13 100644 --- a/src/coordinax/_d3/cylindrical.py +++ b/src/coordinax/_coordinax/_d3/cylindrical.py @@ -15,11 +15,11 @@ import quaxed.array_api as xp from unxt import Quantity -import coordinax._typing as ct +import coordinax._coordinax._typing as ct from .base import AbstractAcceleration3D, AbstractPosition3D, AbstractVelocity3D -from coordinax._checks import check_azimuth_range, check_r_non_negative -from coordinax._converters import converter_azimuth_to_range -from coordinax._utils import classproperty +from coordinax._coordinax._checks import check_azimuth_range, check_r_non_negative +from coordinax._coordinax._converters import converter_azimuth_to_range +from coordinax._coordinax._utils import classproperty @final diff --git a/src/coordinax/_d3/operate.py b/src/coordinax/_coordinax/_d3/operate.py similarity index 94% rename from src/coordinax/_d3/operate.py rename to src/coordinax/_coordinax/_d3/operate.py index 0d060b3..2ca5746 100644 --- a/src/coordinax/_d3/operate.py +++ b/src/coordinax/_coordinax/_d3/operate.py @@ -11,8 +11,8 @@ from unxt import Quantity from .cartesian import CartesianPosition3D -from coordinax._typing import TimeBatchOrScalar -from coordinax.operators._base import AbstractOperator, op_call_dispatch +from coordinax._coordinax._typing import TimeBatchOrScalar +from coordinax._coordinax.operators._base import AbstractOperator, op_call_dispatch Q3: TypeAlias = Shaped[Quantity["length"], "*#batch 3"] diff --git a/src/coordinax/_d3/sphere.py b/src/coordinax/_coordinax/_d3/sphere.py similarity index 99% rename from src/coordinax/_d3/sphere.py rename to src/coordinax/_coordinax/_d3/sphere.py index 88d95cb..edbea14 100644 --- a/src/coordinax/_d3/sphere.py +++ b/src/coordinax/_coordinax/_d3/sphere.py @@ -34,16 +34,16 @@ from dataclassish import replace from unxt import AbstractDistance, AbstractQuantity, Distance, Quantity -import coordinax._typing as ct +import coordinax._coordinax._typing as ct from .base import AbstractAcceleration3D, AbstractPosition3D, AbstractVelocity3D -from coordinax._base_acc import AbstractAcceleration -from coordinax._checks import ( +from coordinax._coordinax._base_acc import AbstractAcceleration +from coordinax._coordinax._checks import ( check_azimuth_range, check_polar_range, check_r_non_negative, ) -from coordinax._converters import converter_azimuth_to_range -from coordinax._utils import classproperty +from coordinax._coordinax._converters import converter_azimuth_to_range +from coordinax._coordinax._utils import classproperty _90d = Quantity(90, "deg") _180d = Quantity(180, "deg") diff --git a/src/coordinax/_d3/transform.py b/src/coordinax/_coordinax/_d3/transform.py similarity index 99% rename from src/coordinax/_d3/transform.py rename to src/coordinax/_coordinax/_d3/transform.py index 429cf5c..a472de7 100644 --- a/src/coordinax/_d3/transform.py +++ b/src/coordinax/_coordinax/_d3/transform.py @@ -22,7 +22,7 @@ SphericalPosition, SphericalVelocity, ) -from coordinax._base_pos import AbstractPosition +from coordinax._coordinax._base_pos import AbstractPosition ############################################################################### # 3D diff --git a/src/coordinax/_d4/__init__.py b/src/coordinax/_coordinax/_d4/__init__.py similarity index 100% rename from src/coordinax/_d4/__init__.py rename to src/coordinax/_coordinax/_d4/__init__.py diff --git a/src/coordinax/_d4/base.py b/src/coordinax/_coordinax/_d4/base.py similarity index 79% rename from src/coordinax/_d4/base.py rename to src/coordinax/_coordinax/_d4/base.py index 6f67d26..2a6f2bf 100644 --- a/src/coordinax/_d4/base.py +++ b/src/coordinax/_coordinax/_d4/base.py @@ -6,9 +6,9 @@ from abc import abstractmethod from typing import TYPE_CHECKING -from coordinax._base import AbstractVector -from coordinax._base_pos import AbstractPosition -from coordinax._utils import classproperty +from coordinax._coordinax._base import AbstractVector +from coordinax._coordinax._base_pos import AbstractPosition +from coordinax._coordinax._utils import classproperty if TYPE_CHECKING: from typing_extensions import Never diff --git a/src/coordinax/_d4/compat.py b/src/coordinax/_coordinax/_d4/compat.py similarity index 100% rename from src/coordinax/_d4/compat.py rename to src/coordinax/_coordinax/_d4/compat.py diff --git a/src/coordinax/_d4/operate.py b/src/coordinax/_coordinax/_d4/operate.py similarity index 96% rename from src/coordinax/_d4/operate.py rename to src/coordinax/_coordinax/_d4/operate.py index 2192b31..e284cfb 100644 --- a/src/coordinax/_d4/operate.py +++ b/src/coordinax/_coordinax/_d4/operate.py @@ -9,7 +9,7 @@ from unxt import Quantity from .spacetime import FourVector -from coordinax.operators._base import AbstractOperator, op_call_dispatch +from coordinax._coordinax.operators._base import AbstractOperator, op_call_dispatch @op_call_dispatch diff --git a/src/coordinax/_d4/spacetime.py b/src/coordinax/_coordinax/_d4/spacetime.py similarity index 96% rename from src/coordinax/_d4/spacetime.py rename to src/coordinax/_coordinax/_d4/spacetime.py index 6e0e807..8e6fb63 100644 --- a/src/coordinax/_d4/spacetime.py +++ b/src/coordinax/_coordinax/_d4/spacetime.py @@ -17,11 +17,11 @@ from unxt import Quantity from .base import AbstractPosition4D -from coordinax._base import AbstractVector -from coordinax._d3.base import AbstractPosition3D -from coordinax._d3.cartesian import CartesianPosition3D -from coordinax._typing import BatchableLength, BatchableTime, ScalarTime -from coordinax._utils import classproperty +from coordinax._coordinax._base import AbstractVector +from coordinax._coordinax._d3.base import AbstractPosition3D +from coordinax._coordinax._d3.cartesian import CartesianPosition3D +from coordinax._coordinax._typing import BatchableLength, BatchableTime, ScalarTime +from coordinax._coordinax._utils import classproperty if TYPE_CHECKING: from typing_extensions import Never diff --git a/src/coordinax/_dn/__init__.py b/src/coordinax/_coordinax/_dn/__init__.py similarity index 100% rename from src/coordinax/_dn/__init__.py rename to src/coordinax/_coordinax/_dn/__init__.py diff --git a/src/coordinax/_dn/base.py b/src/coordinax/_coordinax/_dn/base.py similarity index 97% rename from src/coordinax/_dn/base.py rename to src/coordinax/_coordinax/_dn/base.py index 125c540..6362ca5 100644 --- a/src/coordinax/_dn/base.py +++ b/src/coordinax/_coordinax/_dn/base.py @@ -12,11 +12,11 @@ import quaxed.lax as qlax import quaxed.numpy as qnp -from coordinax._base import AbstractVector -from coordinax._base_acc import AbstractAcceleration -from coordinax._base_pos import AbstractPosition -from coordinax._base_vel import AbstractVelocity -from coordinax._utils import classproperty +from coordinax._coordinax._base import AbstractVector +from coordinax._coordinax._base_acc import AbstractAcceleration +from coordinax._coordinax._base_pos import AbstractPosition +from coordinax._coordinax._base_vel import AbstractVelocity +from coordinax._coordinax._utils import classproperty if TYPE_CHECKING: from typing_extensions import Never diff --git a/src/coordinax/_dn/cartesian.py b/src/coordinax/_coordinax/_dn/cartesian.py similarity index 98% rename from src/coordinax/_dn/cartesian.py rename to src/coordinax/_coordinax/_dn/cartesian.py index a05e7c8..651bcc3 100644 --- a/src/coordinax/_dn/cartesian.py +++ b/src/coordinax/_coordinax/_dn/cartesian.py @@ -17,12 +17,12 @@ import quaxed.numpy as jnp from unxt import Quantity -import coordinax._typing as ct +import coordinax._coordinax._typing as ct from .base import AbstractAccelerationND, AbstractPositionND, AbstractVelocityND -from coordinax._base import AbstractVector -from coordinax._base_pos import AbstractPosition -from coordinax._mixins import AvalMixin -from coordinax._utils import classproperty +from coordinax._coordinax._base import AbstractVector +from coordinax._coordinax._base_pos import AbstractPosition +from coordinax._coordinax._mixins import AvalMixin +from coordinax._coordinax._utils import classproperty ############################################################################## # Position diff --git a/src/coordinax/_dn/poincare.py b/src/coordinax/_coordinax/_dn/poincare.py similarity index 88% rename from src/coordinax/_dn/poincare.py rename to src/coordinax/_coordinax/_dn/poincare.py index 4f1afc3..b2b23c5 100644 --- a/src/coordinax/_dn/poincare.py +++ b/src/coordinax/_coordinax/_dn/poincare.py @@ -10,10 +10,10 @@ from unxt import Quantity -import coordinax._typing as ct -from coordinax._base_pos import AbstractPosition -from coordinax._base_vel import AbstractVelocity -from coordinax._utils import classproperty +import coordinax._coordinax._typing as ct +from coordinax._coordinax._base_pos import AbstractPosition +from coordinax._coordinax._base_vel import AbstractVelocity +from coordinax._coordinax._utils import classproperty @final diff --git a/src/coordinax/_dn/transform.py b/src/coordinax/_coordinax/_dn/transform.py similarity index 100% rename from src/coordinax/_dn/transform.py rename to src/coordinax/_coordinax/_dn/transform.py diff --git a/src/coordinax/_exceptions.py b/src/coordinax/_coordinax/_exceptions.py similarity index 100% rename from src/coordinax/_exceptions.py rename to src/coordinax/_coordinax/_exceptions.py diff --git a/src/coordinax/_funcs.py b/src/coordinax/_coordinax/_funcs.py similarity index 100% rename from src/coordinax/_funcs.py rename to src/coordinax/_coordinax/_funcs.py diff --git a/src/coordinax/_interop/__init__.py b/src/coordinax/_coordinax/_interop/__init__.py similarity index 100% rename from src/coordinax/_interop/__init__.py rename to src/coordinax/_coordinax/_interop/__init__.py diff --git a/src/coordinax/_interop/coordinax_interop_astropy.py b/src/coordinax/_coordinax/_interop/coordinax_interop_astropy.py similarity index 99% rename from src/coordinax/_interop/coordinax_interop_astropy.py rename to src/coordinax/_coordinax/_interop/coordinax_interop_astropy.py index 60b7e8d..ce40f92 100644 --- a/src/coordinax/_interop/coordinax_interop_astropy.py +++ b/src/coordinax/_coordinax/_interop/coordinax_interop_astropy.py @@ -10,14 +10,17 @@ import unxt as ux -from coordinax._d3.base import AbstractPosition3D -from coordinax._d3.cartesian import ( +from coordinax._coordinax._d3.base import AbstractPosition3D +from coordinax._coordinax._d3.cartesian import ( CartesianAcceleration3D, CartesianPosition3D, CartesianVelocity3D, ) -from coordinax._d3.cylindrical import CylindricalPosition, CylindricalVelocity -from coordinax._d3.sphere import ( +from coordinax._coordinax._d3.cylindrical import ( + CylindricalPosition, + CylindricalVelocity, +) +from coordinax._coordinax._d3.sphere import ( LonCosLatSphericalVelocity, LonLatSphericalPosition, LonLatSphericalVelocity, diff --git a/src/coordinax/_mixins.py b/src/coordinax/_coordinax/_mixins.py similarity index 100% rename from src/coordinax/_mixins.py rename to src/coordinax/_coordinax/_mixins.py diff --git a/src/coordinax/_space.py b/src/coordinax/_coordinax/_space.py similarity index 97% rename from src/coordinax/_space.py rename to src/coordinax/_coordinax/_space.py index 0696c62..b81264a 100644 --- a/src/coordinax/_space.py +++ b/src/coordinax/_coordinax/_space.py @@ -14,18 +14,18 @@ from astropy.units import PhysicalType as Dimension, get_physical_type from jax import Device from plum import dispatch -from xmmutablemap import ImmutableMap import quaxed.numpy as jnp from unxt import Quantity +from xmmutablemap import ImmutableMap -from ._base import AbstractVector -from ._base_acc import AbstractAcceleration -from ._base_pos import AbstractPosition -from ._base_vel import AbstractVelocity -from ._funcs import represent_as -from ._utils import classproperty -from coordinax._typing import Unit +from coordinax._coordinax._base import AbstractVector +from coordinax._coordinax._base_acc import AbstractAcceleration +from coordinax._coordinax._base_pos import AbstractPosition +from coordinax._coordinax._base_vel import AbstractVelocity +from coordinax._coordinax._funcs import represent_as +from coordinax._coordinax._typing import Unit +from coordinax._coordinax._utils import classproperty DimensionLike: TypeAlias = Dimension | str diff --git a/src/coordinax/_transform/__init__.py b/src/coordinax/_coordinax/_transform/__init__.py similarity index 100% rename from src/coordinax/_transform/__init__.py rename to src/coordinax/_coordinax/_transform/__init__.py diff --git a/src/coordinax/_transform/accelerations.py b/src/coordinax/_coordinax/_transform/accelerations.py similarity index 94% rename from src/coordinax/_transform/accelerations.py rename to src/coordinax/_coordinax/_transform/accelerations.py index 454a649..584625b 100644 --- a/src/coordinax/_transform/accelerations.py +++ b/src/coordinax/_coordinax/_transform/accelerations.py @@ -13,12 +13,12 @@ from dataclassish import field_items from unxt import AbstractDistance, Quantity -from coordinax._base_acc import AbstractAcceleration -from coordinax._base_pos import AbstractPosition -from coordinax._base_vel import AbstractVelocity -from coordinax._d1.base import AbstractAcceleration1D -from coordinax._d2.base import AbstractAcceleration2D -from coordinax._d3.base import AbstractAcceleration3D +from coordinax._coordinax._base_acc import AbstractAcceleration +from coordinax._coordinax._base_pos import AbstractPosition +from coordinax._coordinax._base_vel import AbstractVelocity +from coordinax._coordinax._d1.base import AbstractAcceleration1D +from coordinax._coordinax._d2.base import AbstractAcceleration2D +from coordinax._coordinax._d3.base import AbstractAcceleration3D # TODO: implement for cross-representations diff --git a/src/coordinax/_transform/d1.py b/src/coordinax/_coordinax/_transform/d1.py similarity index 96% rename from src/coordinax/_transform/d1.py rename to src/coordinax/_coordinax/_transform/d1.py index 2b0267f..9e44668 100644 --- a/src/coordinax/_transform/d1.py +++ b/src/coordinax/_coordinax/_transform/d1.py @@ -9,13 +9,13 @@ import quaxed.array_api as xp from unxt import Quantity -from coordinax._d1.cartesian import CartesianPosition1D -from coordinax._d1.radial import RadialPosition -from coordinax._d2.cartesian import CartesianPosition2D -from coordinax._d2.polar import PolarPosition -from coordinax._d3.cartesian import CartesianPosition3D -from coordinax._d3.cylindrical import CylindricalPosition -from coordinax._d3.sphere import MathSphericalPosition, SphericalPosition +from coordinax._coordinax._d1.cartesian import CartesianPosition1D +from coordinax._coordinax._d1.radial import RadialPosition +from coordinax._coordinax._d2.cartesian import CartesianPosition2D +from coordinax._coordinax._d2.polar import PolarPosition +from coordinax._coordinax._d3.cartesian import CartesianPosition3D +from coordinax._coordinax._d3.cylindrical import CylindricalPosition +from coordinax._coordinax._d3.sphere import MathSphericalPosition, SphericalPosition # ============================================================================= # CartesianPosition1D diff --git a/src/coordinax/_transform/d2.py b/src/coordinax/_coordinax/_transform/d2.py similarity index 94% rename from src/coordinax/_transform/d2.py rename to src/coordinax/_coordinax/_transform/d2.py index d681dc9..48a9b9a 100644 --- a/src/coordinax/_transform/d2.py +++ b/src/coordinax/_coordinax/_transform/d2.py @@ -11,16 +11,16 @@ import quaxed.array_api as xp from unxt import Quantity -from coordinax._d1.cartesian import CartesianPosition1D -from coordinax._d1.radial import RadialPosition -from coordinax._d2.base import AbstractPosition2D -from coordinax._d2.cartesian import CartesianPosition2D -from coordinax._d2.polar import PolarPosition -from coordinax._d3.base import AbstractPosition3D -from coordinax._d3.cartesian import CartesianPosition3D -from coordinax._d3.cylindrical import CylindricalPosition -from coordinax._d3.sphere import MathSphericalPosition, SphericalPosition -from coordinax._exceptions import IrreversibleDimensionChange +from coordinax._coordinax._d1.cartesian import CartesianPosition1D +from coordinax._coordinax._d1.radial import RadialPosition +from coordinax._coordinax._d2.base import AbstractPosition2D +from coordinax._coordinax._d2.cartesian import CartesianPosition2D +from coordinax._coordinax._d2.polar import PolarPosition +from coordinax._coordinax._d3.base import AbstractPosition3D +from coordinax._coordinax._d3.cartesian import CartesianPosition3D +from coordinax._coordinax._d3.cylindrical import CylindricalPosition +from coordinax._coordinax._d3.sphere import MathSphericalPosition, SphericalPosition +from coordinax._coordinax._exceptions import IrreversibleDimensionChange @dispatch.multi( diff --git a/src/coordinax/_transform/d3.py b/src/coordinax/_coordinax/_transform/d3.py similarity index 96% rename from src/coordinax/_transform/d3.py rename to src/coordinax/_coordinax/_transform/d3.py index 5aac4e4..81e4052 100644 --- a/src/coordinax/_transform/d3.py +++ b/src/coordinax/_coordinax/_transform/d3.py @@ -9,15 +9,15 @@ import quaxed.array_api as xp -from coordinax._d1.cartesian import CartesianPosition1D -from coordinax._d1.radial import RadialPosition -from coordinax._d2.base import AbstractPosition2D -from coordinax._d2.cartesian import CartesianPosition2D -from coordinax._d2.polar import PolarPosition -from coordinax._d3.cartesian import CartesianPosition3D -from coordinax._d3.cylindrical import CylindricalPosition -from coordinax._d3.sphere import MathSphericalPosition, SphericalPosition -from coordinax._exceptions import IrreversibleDimensionChange +from coordinax._coordinax._d1.cartesian import CartesianPosition1D +from coordinax._coordinax._d1.radial import RadialPosition +from coordinax._coordinax._d2.base import AbstractPosition2D +from coordinax._coordinax._d2.cartesian import CartesianPosition2D +from coordinax._coordinax._d2.polar import PolarPosition +from coordinax._coordinax._d3.cartesian import CartesianPosition3D +from coordinax._coordinax._d3.cylindrical import CylindricalPosition +from coordinax._coordinax._d3.sphere import MathSphericalPosition, SphericalPosition +from coordinax._coordinax._exceptions import IrreversibleDimensionChange # ============================================================================= # CartesianPosition3D diff --git a/src/coordinax/_transform/differentials.py b/src/coordinax/_coordinax/_transform/differentials.py similarity index 94% rename from src/coordinax/_transform/differentials.py rename to src/coordinax/_coordinax/_transform/differentials.py index e8d6d8a..d16060b 100644 --- a/src/coordinax/_transform/differentials.py +++ b/src/coordinax/_coordinax/_transform/differentials.py @@ -13,11 +13,11 @@ from dataclassish import field_items from unxt import AbstractDistance, Quantity -from coordinax._base_pos import AbstractPosition -from coordinax._base_vel import AbstractVelocity -from coordinax._d1.base import AbstractVelocity1D -from coordinax._d2.base import AbstractVelocity2D -from coordinax._d3.base import AbstractVelocity3D +from coordinax._coordinax._base_pos import AbstractPosition +from coordinax._coordinax._base_vel import AbstractVelocity +from coordinax._coordinax._d1.base import AbstractVelocity1D +from coordinax._coordinax._d2.base import AbstractVelocity2D +from coordinax._coordinax._d3.base import AbstractVelocity3D # TODO: implement for cross-representations diff --git a/src/coordinax/_transform/dn.py b/src/coordinax/_coordinax/_transform/dn.py similarity index 89% rename from src/coordinax/_transform/dn.py rename to src/coordinax/_coordinax/_transform/dn.py index 1cbe548..14df002 100644 --- a/src/coordinax/_transform/dn.py +++ b/src/coordinax/_coordinax/_transform/dn.py @@ -7,9 +7,12 @@ import quaxed.array_api as xp -from coordinax._d3.cylindrical import CylindricalPosition, CylindricalVelocity -from coordinax._dn.poincare import PoincarePolarVector -from coordinax._space import Space +from coordinax._coordinax._d3.cylindrical import ( + CylindricalPosition, + CylindricalVelocity, +) +from coordinax._coordinax._dn.poincare import PoincarePolarVector +from coordinax._coordinax._space import Space @dispatch # type: ignore[misc] diff --git a/src/coordinax/_transform/space.py b/src/coordinax/_coordinax/_transform/space.py similarity index 90% rename from src/coordinax/_transform/space.py rename to src/coordinax/_coordinax/_transform/space.py index bb5273a..26b833d 100644 --- a/src/coordinax/_transform/space.py +++ b/src/coordinax/_coordinax/_transform/space.py @@ -7,9 +7,12 @@ import quaxed.array_api as xp -from coordinax._d3.cylindrical import CylindricalPosition, CylindricalVelocity -from coordinax._dn.poincare import PoincarePolarVector -from coordinax._space import Space +from coordinax._coordinax._d3.cylindrical import ( + CylindricalPosition, + CylindricalVelocity, +) +from coordinax._coordinax._dn.poincare import PoincarePolarVector +from coordinax._coordinax._space import Space @dispatch diff --git a/src/coordinax/_typing.py b/src/coordinax/_coordinax/_typing.py similarity index 100% rename from src/coordinax/_typing.py rename to src/coordinax/_coordinax/_typing.py diff --git a/src/coordinax/_utils.py b/src/coordinax/_coordinax/_utils.py similarity index 96% rename from src/coordinax/_utils.py rename to src/coordinax/_coordinax/_utils.py index 942a87d..b5e85d7 100644 --- a/src/coordinax/_utils.py +++ b/src/coordinax/_coordinax/_utils.py @@ -10,7 +10,7 @@ from dataclassish import field_values if TYPE_CHECKING: - from coordinax._base import AbstractVector + from coordinax._coordinax._base import AbstractVector def full_shaped(obj: "AbstractVector", /) -> "AbstractVector": diff --git a/src/coordinax/_coordinax/operators/__init__.py b/src/coordinax/_coordinax/operators/__init__.py new file mode 100644 index 0000000..cfd4b33 --- /dev/null +++ b/src/coordinax/_coordinax/operators/__init__.py @@ -0,0 +1,4 @@ +"""Coordinax Operator package.""" +# ruff: noqa: F401 + +from . import _base, _composite, _funcs, _galilean, _identity, _sequential diff --git a/src/coordinax/operators/_base.py b/src/coordinax/_coordinax/operators/_base.py similarity index 98% rename from src/coordinax/operators/_base.py rename to src/coordinax/_coordinax/operators/_base.py index 77a07a4..f61edbe 100644 --- a/src/coordinax/operators/_base.py +++ b/src/coordinax/_coordinax/operators/_base.py @@ -12,7 +12,7 @@ from dataclassish import field_items from unxt import Quantity -from coordinax._base_pos import AbstractPosition +from coordinax._coordinax._base_pos import AbstractPosition if TYPE_CHECKING: from ._sequential import OperatorSequence diff --git a/src/coordinax/operators/_composite.py b/src/coordinax/_coordinax/operators/_composite.py similarity index 97% rename from src/coordinax/operators/_composite.py rename to src/coordinax/_coordinax/operators/_composite.py index 7604192..f25ef86 100644 --- a/src/coordinax/operators/_composite.py +++ b/src/coordinax/_coordinax/operators/_composite.py @@ -10,7 +10,7 @@ from unxt import Quantity from ._base import AbstractOperator, op_call_dispatch -from coordinax._base_pos import AbstractPosition +from coordinax._coordinax._base_pos import AbstractPosition if TYPE_CHECKING: from typing_extensions import Self diff --git a/src/coordinax/operators/_funcs.py b/src/coordinax/_coordinax/operators/_funcs.py similarity index 100% rename from src/coordinax/operators/_funcs.py rename to src/coordinax/_coordinax/operators/_funcs.py diff --git a/src/coordinax/operators/_galilean/__init__.py b/src/coordinax/_coordinax/operators/_galilean/__init__.py similarity index 100% rename from src/coordinax/operators/_galilean/__init__.py rename to src/coordinax/_coordinax/operators/_galilean/__init__.py diff --git a/src/coordinax/operators/_galilean/base.py b/src/coordinax/_coordinax/operators/_galilean/base.py similarity index 89% rename from src/coordinax/operators/_galilean/base.py rename to src/coordinax/_coordinax/operators/_galilean/base.py index 41dddf8..960e08f 100644 --- a/src/coordinax/operators/_galilean/base.py +++ b/src/coordinax/_coordinax/operators/_galilean/base.py @@ -6,7 +6,7 @@ from abc import abstractmethod -from coordinax.operators._base import AbstractOperator +from coordinax._coordinax.operators._base import AbstractOperator class AbstractGalileanOperator(AbstractOperator): diff --git a/src/coordinax/operators/_galilean/boost.py b/src/coordinax/_coordinax/operators/_galilean/boost.py similarity index 91% rename from src/coordinax/operators/_galilean/boost.py rename to src/coordinax/_coordinax/operators/_galilean/boost.py index c763304..1c0c5c1 100644 --- a/src/coordinax/operators/_galilean/boost.py +++ b/src/coordinax/_coordinax/operators/_galilean/boost.py @@ -15,12 +15,12 @@ from unxt import Quantity from .base import AbstractGalileanOperator -from coordinax._d3.base import AbstractPosition3D -from coordinax._d3.cartesian import CartesianVelocity3D -from coordinax._d4.spacetime import FourVector -from coordinax.operators._base import AbstractOperator, op_call_dispatch -from coordinax.operators._funcs import simplify_op -from coordinax.operators._identity import IdentityOperator +from coordinax._coordinax._d3.base import AbstractPosition3D +from coordinax._coordinax._d3.cartesian import CartesianVelocity3D +from coordinax._coordinax._d4.spacetime import FourVector +from coordinax._coordinax.operators._base import AbstractOperator, op_call_dispatch +from coordinax._coordinax.operators._funcs import simplify_op +from coordinax._coordinax.operators._identity import IdentityOperator @final diff --git a/src/coordinax/operators/_galilean/composite.py b/src/coordinax/_coordinax/operators/_galilean/composite.py similarity index 95% rename from src/coordinax/operators/_galilean/composite.py rename to src/coordinax/_coordinax/operators/_galilean/composite.py index a3e6eeb..05cecca 100644 --- a/src/coordinax/operators/_galilean/composite.py +++ b/src/coordinax/_coordinax/operators/_galilean/composite.py @@ -15,11 +15,11 @@ from .boost import GalileanBoostOperator from .rotation import GalileanRotationOperator from .translation import GalileanTranslationOperator -from coordinax.operators._base import AbstractOperator -from coordinax.operators._composite import AbstractCompositeOperator -from coordinax.operators._funcs import simplify_op -from coordinax.operators._identity import IdentityOperator -from coordinax.operators._sequential import OperatorSequence +from coordinax._coordinax.operators._base import AbstractOperator +from coordinax._coordinax.operators._composite import AbstractCompositeOperator +from coordinax._coordinax.operators._funcs import simplify_op +from coordinax._coordinax.operators._identity import IdentityOperator +from coordinax._coordinax.operators._sequential import OperatorSequence if TYPE_CHECKING: from typing_extensions import Self diff --git a/src/coordinax/operators/_galilean/rotation.py b/src/coordinax/_coordinax/operators/_galilean/rotation.py similarity index 95% rename from src/coordinax/operators/_galilean/rotation.py rename to src/coordinax/_coordinax/operators/_galilean/rotation.py index e61cc96..3eaef26 100644 --- a/src/coordinax/operators/_galilean/rotation.py +++ b/src/coordinax/_coordinax/operators/_galilean/rotation.py @@ -18,12 +18,12 @@ from unxt import Quantity from .base import AbstractGalileanOperator -from coordinax._base import ToUnitsOptions -from coordinax._d3.base import AbstractPosition3D -from coordinax._d3.cartesian import CartesianPosition3D -from coordinax.operators._base import AbstractOperator, op_call_dispatch -from coordinax.operators._funcs import simplify_op -from coordinax.operators._identity import IdentityOperator +from coordinax._coordinax._base import ToUnitsOptions +from coordinax._coordinax._d3.base import AbstractPosition3D +from coordinax._coordinax._d3.cartesian import CartesianPosition3D +from coordinax._coordinax.operators._base import AbstractOperator, op_call_dispatch +from coordinax._coordinax.operators._funcs import simplify_op +from coordinax._coordinax.operators._identity import IdentityOperator vec_matmul = quaxify(jnp.vectorize(jnp.matmul, signature="(3,3),(3)->(3)")) diff --git a/src/coordinax/operators/_galilean/translation.py b/src/coordinax/_coordinax/operators/_galilean/translation.py similarity index 96% rename from src/coordinax/operators/_galilean/translation.py rename to src/coordinax/_coordinax/operators/_galilean/translation.py index 145cbb5..a27f2a3 100644 --- a/src/coordinax/operators/_galilean/translation.py +++ b/src/coordinax/_coordinax/operators/_galilean/translation.py @@ -15,15 +15,15 @@ from unxt import Quantity from .base import AbstractGalileanOperator -from coordinax._base_pos import AbstractPosition -from coordinax._d1.cartesian import CartesianPosition1D -from coordinax._d2.cartesian import CartesianPosition2D -from coordinax._d3.base import AbstractPosition3D -from coordinax._d3.cartesian import CartesianPosition3D -from coordinax._d4.spacetime import FourVector -from coordinax.operators._base import AbstractOperator, op_call_dispatch -from coordinax.operators._funcs import simplify_op -from coordinax.operators._identity import IdentityOperator +from coordinax._coordinax._base_pos import AbstractPosition +from coordinax._coordinax._d1.cartesian import CartesianPosition1D +from coordinax._coordinax._d2.cartesian import CartesianPosition2D +from coordinax._coordinax._d3.base import AbstractPosition3D +from coordinax._coordinax._d3.cartesian import CartesianPosition3D +from coordinax._coordinax._d4.spacetime import FourVector +from coordinax._coordinax.operators._base import AbstractOperator, op_call_dispatch +from coordinax._coordinax.operators._funcs import simplify_op +from coordinax._coordinax.operators._identity import IdentityOperator ############################################################################## # Spatial Translations diff --git a/src/coordinax/operators/_identity.py b/src/coordinax/_coordinax/operators/_identity.py similarity index 98% rename from src/coordinax/operators/_identity.py rename to src/coordinax/_coordinax/operators/_identity.py index b1a706e..c7eeb56 100644 --- a/src/coordinax/operators/_identity.py +++ b/src/coordinax/_coordinax/operators/_identity.py @@ -9,7 +9,7 @@ from unxt import Quantity from ._base import AbstractOperator, op_call_dispatch -from coordinax._base_pos import AbstractPosition +from coordinax._coordinax._base_pos import AbstractPosition @final diff --git a/src/coordinax/operators/_sequential.py b/src/coordinax/_coordinax/operators/_sequential.py similarity index 100% rename from src/coordinax/operators/_sequential.py rename to src/coordinax/_coordinax/operators/_sequential.py diff --git a/src/coordinax/operators.py b/src/coordinax/operators.py new file mode 100644 index 0000000..8ceb882 --- /dev/null +++ b/src/coordinax/operators.py @@ -0,0 +1,31 @@ +"""Transformations of the coordinate reference frame. + +E.g. a translation. +""" +# pylint: disable=unused-wildcard-import,wildcard-import + +from ._coordinax.operators import ( + _base, + _composite, + _funcs, + _galilean, + _identity, + _sequential, +) +from ._coordinax.operators._base import * # noqa: F403 +from ._coordinax.operators._composite import * # noqa: F403 +from ._coordinax.operators._funcs import * # noqa: F403 +from ._coordinax.operators._galilean import * # noqa: F403 +from ._coordinax.operators._identity import * # noqa: F403 +from ._coordinax.operators._sequential import * # noqa: F403 + +__all__: list[str] = [] +__all__ += _base.__all__ +__all__ += _composite.__all__ +__all__ += _sequential.__all__ +__all__ += _identity.__all__ +__all__ += _galilean.__all__ +__all__ += _funcs.__all__ + +# Cleanup +del _base, _composite, _funcs, _galilean, _identity, _sequential diff --git a/src/coordinax/operators/__init__.py b/src/coordinax/operators/__init__.py deleted file mode 100644 index 314e454..0000000 --- a/src/coordinax/operators/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -"""Transformations of the coordinate reference frame. - -E.g. a translation. -""" - -from . import _base, _composite, _funcs, _galilean, _identity, _sequential -from ._base import * -from ._composite import * -from ._funcs import * -from ._galilean import * -from ._identity import * -from ._sequential import * - -__all__: list[str] = [] -__all__ += _base.__all__ -__all__ += _composite.__all__ -__all__ += _sequential.__all__ -__all__ += _identity.__all__ -__all__ += _galilean.__all__ -__all__ += _funcs.__all__ diff --git a/tests/test_exceptions.py b/tests/test_exceptions.py index e5ba16c..6a2b2d2 100644 --- a/tests/test_exceptions.py +++ b/tests/test_exceptions.py @@ -4,7 +4,7 @@ import pytest -from coordinax._exceptions import IrreversibleDimensionChange +from coordinax._coordinax._exceptions import IrreversibleDimensionChange def test_warning_irreversibledimensionchange(): diff --git a/tests/test_jax_ops.py b/tests/test_jax_ops.py index ade21ca..9f546c1 100644 --- a/tests/test_jax_ops.py +++ b/tests/test_jax_ops.py @@ -9,7 +9,7 @@ from unxt import AbstractQuantity import coordinax as cx -from coordinax._base_pos import VECTOR_CLASSES +from coordinax._coordinax._base_pos import VECTOR_CLASSES VECTOR_CLASSES_3D = [c for c in VECTOR_CLASSES if issubclass(c, cx.AbstractPosition3D)]