forked from GalacticDynamics/galax
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reference Frame Transformation Operators (GalacticDynamics#135)
* feat: frame operations * feat: not public time-dep translation class * fix: tests Signed-off-by: nstarman <nstarman@users.noreply.github.com>
- Loading branch information
Showing
13 changed files
with
320 additions
and
21 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
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
"""Moving object. TEMPORARY CLASS. | ||
This class adds time-dependent translations to a potential. | ||
It is NOT careful about the implied changes to velocity, etc. | ||
""" | ||
|
||
__all__: list[str] = [] | ||
|
||
|
||
from collections.abc import Callable | ||
from typing import Literal, final | ||
|
||
import equinox as eqx | ||
|
||
from galax.coordinates.operators import AbstractOperator | ||
from galax.typing import FloatScalar, RealScalar, Vec3 | ||
|
||
|
||
@final | ||
class TimeDependentSpatialTranslationOperator(AbstractOperator): | ||
r"""Operator for time-dependent translation.""" | ||
|
||
translation: Callable[[FloatScalar], Vec3] = eqx.field() | ||
"""The spatial translation.""" | ||
|
||
def __call__(self, q: Vec3, t: RealScalar) -> tuple[Vec3, RealScalar]: | ||
"""Do.""" | ||
return (q + self.translation(t), t) | ||
|
||
@property | ||
def is_inertial(self) -> Literal[False]: | ||
"""Galilean translation is an inertial frame-preserving transformation.""" | ||
return False | ||
|
||
@property | ||
def inverse(self) -> "TimeDependentSpatialTranslationOperator": | ||
"""The inverse of the operator.""" | ||
return TimeDependentSpatialTranslationOperator( | ||
translation=lambda t: -self.translation(t) | ||
) |
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
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
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.