-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add MockStream class Signed-off-by: nstarman <nstarman@users.noreply.github.com> * include time as integrator output Signed-off-by: nstarman <nstarman@users.noreply.github.com> * move i in df sampler Signed-off-by: nstarman <nstarman@users.noreply.github.com> * add Orbit class Signed-off-by: nstarman <nstarman@users.noreply.github.com> * change private method name Signed-off-by: nstarman <nstarman@users.noreply.github.com> * Add example notebook Signed-off-by: nstarman <nstarman@users.noreply.github.com> --------- Signed-off-by: nstarman <nstarman@users.noreply.github.com>
- Loading branch information
Showing
13 changed files
with
924 additions
and
57 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
Large diffs are not rendered by default.
Oops, something went wrong.
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,46 @@ | ||
"""galdynamix: Galactic Dynamix in Jax""" | ||
|
||
from __future__ import annotations | ||
|
||
__all__ = ["Orbit"] | ||
|
||
|
||
import equinox as eqx | ||
import jax.numpy as xp | ||
import jax.typing as jt | ||
|
||
from galdynamix.potential._potential.base import AbstractPotentialBase | ||
|
||
|
||
class Orbit(eqx.Module): # type: ignore[misc] | ||
"""Orbit. | ||
TODO: | ||
- Units stuff | ||
- GR stuff | ||
""" | ||
|
||
q: jt.Array | ||
"""Position of the stream particles (x, y, z) [kpc].""" | ||
|
||
p: jt.Array | ||
"""Position of the stream particles (x, y, z) [kpc/Myr].""" | ||
|
||
t: jt.Array | ||
"""Release time of the stream particles [Myr].""" | ||
|
||
potential: AbstractPotentialBase | ||
"""Potential in which the orbit was integrated.""" | ||
|
||
def to_w(self) -> jt.Array: | ||
t = self.t[:, None] if self.t.ndim == 1 else self.t | ||
out = xp.empty( | ||
( | ||
self.q.shape[0], | ||
self.q.shape[1] + self.p.shape[1] + t.shape[1], | ||
) | ||
) | ||
out = out.at[:, : self.q.shape[1]].set(self.q) | ||
out = out.at[:, self.q.shape[1] : -1].set(self.p) | ||
out = out.at[:, -1:].set(t) | ||
return out # noqa: RET504 |
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,29 @@ | ||
"""galdynamix: Galactic Dynamix in Jax""" | ||
|
||
from __future__ import annotations | ||
|
||
__all__ = ["MockStream"] | ||
|
||
|
||
import equinox as eqx | ||
import jax.typing as jt | ||
|
||
|
||
class MockStream(eqx.Module): # type: ignore[misc] | ||
"""Mock stream object. | ||
TODO: | ||
- units stuff | ||
- change this to be a collection of sub-objects: progenitor, leading arm, | ||
trailing arm, 3-body ejecta, etc. | ||
- GR 4-vector stuff | ||
""" | ||
|
||
q: jt.Array | ||
"""Position of the stream particles (x, y, z) [kpc].""" | ||
|
||
p: jt.Array | ||
"""Position of the stream particles (x, y, z) [kpc/Myr].""" | ||
|
||
release_time: jt.Array | ||
"""Release time of the stream particles [Myr].""" |
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.