-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: AbstractVectorDifferential * feat: Abstract1DVectorDifferential * feat: CartesianDifferential1D, RadialDifferential * feat: Abstract2DVectorDifferential * feat: CartesianDifferential2D, PolarDifferential * feat: Abstract3DVectorDifferential * feat: CartesianDifferential3D, SphericalDifferential, CylindricalDifferential * feat: support some differential transformations * tests: add for all the differential classes * ci: coverage ignores Signed-off-by: nstarman <nstarman@users.noreply.github.com>
- Loading branch information
Showing
15 changed files
with
1,461 additions
and
699 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,34 @@ | ||
"""Representation of coordinates in different systems.""" | ||
|
||
__all__ = ["AbstractVector"] | ||
__all__ = ["AbstractVector", "AbstractVectorDifferential"] | ||
|
||
from typing import Any, TypeVar | ||
|
||
import equinox as eqx | ||
|
||
T = TypeVar("T", bound="AbstractVector") | ||
DT = TypeVar("DT", bound="AbstractVectorDifferential") | ||
|
||
|
||
class AbstractVector(eqx.Module): # type: ignore[misc] | ||
"""Abstract representation of coordinates in different systems.""" | ||
|
||
def represent_as(self, target: type[T], **kwargs: Any) -> T: | ||
def represent_as(self, target: type[T], /, **kwargs: Any) -> T: | ||
"""Represent the vector as another type.""" | ||
from ._transform import represent_as # pylint: disable=import-outside-toplevel | ||
|
||
return represent_as(self, target, **kwargs) | ||
|
||
|
||
class AbstractVectorDifferential(eqx.Module): # type: ignore[misc] | ||
"""Abstract representation of vector differentials in different systems.""" | ||
|
||
vector_cls: eqx.AbstractClassVar[type[AbstractVector]] | ||
|
||
def represent_as( | ||
self, target: type[DT], position: AbstractVector, /, **kwargs: Any | ||
) -> DT: | ||
"""Represent the vector as another type.""" | ||
from ._transform import represent_as # pylint: disable=import-outside-toplevel | ||
|
||
return represent_as(self, target, position, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
"""Representation of coordinates in different systems.""" | ||
|
||
__all__ = ["Abstract1DVector"] | ||
__all__ = ["Abstract1DVector", "Abstract1DVectorDifferential"] | ||
|
||
from typing import TypeVar | ||
|
||
from vector._base import AbstractVector | ||
import equinox as eqx | ||
|
||
T = TypeVar("T", bound="AbstractVector") | ||
from vector._base import AbstractVector, AbstractVectorDifferential | ||
|
||
|
||
class Abstract1DVector(AbstractVector): | ||
"""Abstract representation of 1D coordinates in different systems.""" | ||
|
||
|
||
class Abstract1DVectorDifferential(AbstractVectorDifferential): | ||
"""Abstract representation of 1D differentials in different systems.""" | ||
|
||
vector_cls: eqx.AbstractClassVar[type[Abstract1DVector]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
"""Representation of coordinates in different systems.""" | ||
|
||
__all__ = ["Abstract2DVector"] | ||
__all__ = ["Abstract2DVector", "Abstract2DVectorDifferential"] | ||
|
||
from typing import TypeVar | ||
|
||
from vector._base import AbstractVector | ||
import equinox as eqx | ||
|
||
T = TypeVar("T", bound="AbstractVector") | ||
from vector._base import AbstractVector, AbstractVectorDifferential | ||
|
||
|
||
class Abstract2DVector(AbstractVector): | ||
"""Abstract representation of 2D coordinates in different systems.""" | ||
|
||
|
||
class Abstract2DVectorDifferential(AbstractVectorDifferential): | ||
"""Abstract representation of 2D vector differentials.""" | ||
|
||
vector_cls: eqx.AbstractClassVar[type[Abstract2DVector]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
"""Representation of coordinates in different systems.""" | ||
|
||
__all__ = ["Abstract3DVector"] | ||
__all__ = ["Abstract3DVector", "Abstract3DVectorDifferential"] | ||
|
||
from typing import TypeVar | ||
|
||
from vector._base import AbstractVector | ||
import equinox as eqx | ||
|
||
T = TypeVar("T", bound="AbstractVector") | ||
from vector._base import AbstractVector, AbstractVectorDifferential | ||
|
||
|
||
class Abstract3DVector(AbstractVector): | ||
"""Abstract representation of 3D coordinates in different systems.""" | ||
|
||
|
||
class Abstract3DVectorDifferential(AbstractVectorDifferential): | ||
"""Abstract representation of 3D vector differentials.""" | ||
|
||
vector_cls: eqx.AbstractClassVar[type[Abstract3DVector]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.