Skip to content

Commit

Permalink
SCF
Browse files Browse the repository at this point in the history
Signed-off-by: nstarman <[email protected]>
  • Loading branch information
nstarman committed Dec 13, 2023
1 parent 3507c84 commit 979b995
Show file tree
Hide file tree
Showing 18 changed files with 1,009 additions and 58 deletions.
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ scf = [
"sympy2jax",
]
test = [
"gala",
"hypothesis[numpy]",
"pytest >=6",
"pytest-cov >=3",
Expand Down Expand Up @@ -159,6 +160,7 @@ ignore = [
"F821", # undefined name <- jaxtyping
"FIX002", # Line contains TODO, consider resolving the issue
"N80", # Naming conventions.
"N816", # Variable in global scope should not be mixedCase
"PD", # pandas-vet
"PLR", # Design related pylint codes
"PYI041", # Use `float` instead of `int | float` <- beartype is more strict
Expand Down
4 changes: 2 additions & 2 deletions src/galax/dynamics/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def shape(self) -> tuple[int, ...]:
@property
@partial_jit()
def qp(self) -> BatchVec6:
"""Return as a single Array[(*batch, Q + P),]."""
"""Return as a single Array[float, (*batch, Q + P),]."""
batch_shape, component_shapes = self._shape_tuple
q = xp.broadcast_to(self.q, batch_shape + component_shapes[0:1])
p = xp.broadcast_to(self.p, batch_shape + component_shapes[1:2])
Expand Down Expand Up @@ -99,7 +99,7 @@ def _shape_tuple(self) -> tuple[tuple[int, ...], tuple[int, int, int]]:
@property
@partial_jit()
def w(self) -> BatchVec7:
"""Return as a single Array[(*batch, Q + P + T),]."""
"""Return as a single Array[float, (*batch, Q + P + T)]."""
batch_shape, component_shapes = self._shape_tuple
q = xp.broadcast_to(self.q, batch_shape + component_shapes[0:1])
p = xp.broadcast_to(self.p, batch_shape + component_shapes[1:2])
Expand Down
2 changes: 1 addition & 1 deletion src/galax/dynamics/mockstream/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def _shape_tuple(self) -> tuple[tuple[int, ...], tuple[int, int, int]]:
@property
@partial_jit()
def w(self) -> BatchVec7:
"""Return as a single Array[(*batch, Q + P + T),]."""
"""Return as a single Array[float, (*batch, Q + P + T)]."""
batch_shape, component_shapes = self._shape_tuple
q = xp.broadcast_to(self.q, batch_shape + component_shapes[0:1])
p = xp.broadcast_to(self.p, batch_shape + component_shapes[1:2])
Expand Down
12 changes: 6 additions & 6 deletions src/galax/dynamics/mockstream/_df/fardal.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def dphidr(potential: AbstractPotentialBase, x: Vec3, t: FloatScalar) -> Vec3:
----------
potential: AbstractPotentialBase
The gravitational potential.
x: Array[(3,), Any]
x: Array[Any, (3,)]
3d position (x, y, z) in [kpc]
t: Numeric
Time in [Myr]
Expand All @@ -143,7 +143,7 @@ def d2phidr2(
----------
potential: AbstractPotentialBase
The gravitational potential.
x: Array[(3,), Any]
x: Array[Any, (3,)]
3d position (x, y, z) in [kpc]
t: Numeric
Time in [Myr]
Expand Down Expand Up @@ -172,9 +172,9 @@ def orbital_angular_velocity(x: Vec3, v: Vec3, /) -> Vec3:
Arguments:
---------
x: Array[(3,), Any]
x: Array[Any, (3,)]
3d position (x, y, z) in [length]
v: Array[(3,), Any]
v: Array[Any, (3,)]
3d velocity (v_x, v_y, v_z) in [length/time]
Returns:
Expand All @@ -199,9 +199,9 @@ def orbital_angular_velocity_mag(x: Vec3, v: Vec3, /) -> FloatScalar:
Arguments:
---------
x: Array[(3,), Any]
x: Array[Any, (3,)]
3d position (x, y, z) in [kpc]
v: Array[(3,), Any]
v: Array[Any, (3,)]
3d velocity (v_x, v_y, v_z) in [kpc/Myr]
Returns:
Expand Down
3 changes: 2 additions & 1 deletion src/galax/potential/_potential/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
from .composite import *
from .core import *
from .param import *
from .scf import SCFPotential

__all__: list[str] = []
__all__ += base.__all__
__all__ += core.__all__
__all__ += composite.__all__
__all__ += param.__all__
__all__ += builtin.__all__
__all__ += ["scf"]
__all__ += ["scf", "SCFPotential"]
14 changes: 7 additions & 7 deletions src/galax/potential/_potential/param/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ def __call__(self, t: FloatScalar, **kwargs: Any) -> FloatArrayAnyShape:
Parameters
----------
t : Array
t : float | Array[float, ()]
The time(s) at which to compute the parameter value.
**kwargs
**kwargs : Any
Additional parameters to pass to the parameter function.
Returns
-------
Array
Array[float, "*shape"]
The parameter value at times ``t``.
"""
...
Expand All @@ -74,7 +74,7 @@ def __call__(
Parameters
----------
t : Array, optional
t : float | Array[float, ()], optional
This is ignored and is thus optional.
Note that for most :class:`~galax.potential.AbstractParameter`
the time is required.
Expand All @@ -83,7 +83,7 @@ def __call__(
Returns
-------
Array
Array[float, "*shape"]
The constant parameter value.
"""
# Vectorization to enable broadcasting over the time dimension.
Expand All @@ -107,14 +107,14 @@ def __call__(self, t: FloatScalar, **kwargs: Any) -> FloatArrayAnyShape:
Parameters
----------
t : Array
t : float | Array[float, ()]
Time(s) at which to compute the parameter value.
**kwargs : Any
Additional parameters to pass to the parameter function.
Returns
-------
Array
Array[float, "*shape"]
Parameter value(s) at the given time(s).
"""
...
Expand Down
14 changes: 9 additions & 5 deletions src/galax/potential/_potential/scf/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
from __future__ import annotations

from . import gegenbauer
from .gegenbauer import *
from . import bfe, bfe_helper, coeffs, coeffs_helper
from .bfe import *
from .bfe_helper import *
from .coeffs import *
from .coeffs_helper import *

__all__: list[str] = []
__all__ += gegenbauer.__all__
__all__ += bfe.__all__
__all__ += bfe_helper.__all__
__all__ += coeffs.__all__
__all__ += coeffs_helper.__all__
Loading

0 comments on commit 979b995

Please sign in to comment.