Skip to content

Commit 94f5f44

Browse files
committed
WIP
Signed-off-by: nstarman <nstarman@users.noreply.github.com>
1 parent 15b9170 commit 94f5f44

File tree

114 files changed

+7650
-6362
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+7650
-6362
lines changed

.github/copilot-instructions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ This is a UV workspace repository containing multiple packages:
1919
Before making _any_ change to:
2020

2121
- charts / geometries
22-
- roles (Point / Pos / Vel / Acc)
22+
- roles (Point / PhysDisp / PhysVel / PhysAcc)
2323
- metrics
2424
- embeddings / manifolds
2525
- operators / reference frames
26-
- Vector / FiberPoint / Coordinate semantics
26+
- Vector / PointedVector / Coordinate semantics
2727

2828
You MUST:
2929

@@ -409,7 +409,7 @@ def add_p_vec_qty(lhs: Vector, rhs: Quantity, /) -> Vector:
409409
"""Handle Vector + Quantity via desugaring to Vector + Vector."""
410410
# Desugar: convert Quantity to Vector with appropriate role
411411
if u.dimension_of(rhs) == u.dimension("length"):
412-
rhs_vec = Vector.from_(rhs, r.Pos)
412+
rhs_vec = Vector.from_(rhs, r.PhysDisp)
413413
else:
414414
rhs_vec = Vector.from_(rhs)
415415
return add(lhs.role, rhs_vec.role, lhs, rhs_vec, at=None)

README.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pip install coordinax
4444
dimensions). A rep does not store numerical values.
4545
- Vector: data + rep + role. Data are the coordinate values or physical
4646
components.
47-
- Role: semantic interpretation of vector data (Pos, Vel, Acc, etc.). A role is
47+
- Role: semantic interpretation of vector data (Pos, Vel, PhysAcc, etc.). A role is
4848
not a rep.
4949
- Metric: a bilinear form g on the tangent space defining inner products and
5050
norms (Euclidean, sphere intrinsic, Minkowski).
@@ -134,8 +134,8 @@ v = {
134134
"y": u.Q(5.0, "km/s"),
135135
"z": u.Q(6.0, "km/s"),
136136
}
137-
qvec = cx.Vector(data=q, chart=cx.charts.cart3d, role=cx.roles.Pos())
138-
vvec = cx.Vector(data=v, chart=cx.charts.cart3d, role=cx.roles.Vel())
137+
qvec = cx.Vector(data=q, chart=cx.charts.cart3d, role=cx.roles.PhysDisp())
138+
vvec = cx.Vector(data=v, chart=cx.charts.cart3d, role=cx.roles.PhysVel())
139139
v_sph = vvec.vconvert(cx.charts.sph3d, qvec)
140140
v_back = v_sph.vconvert(cx.charts.cart3d, qvec)
141141
bool(
@@ -150,19 +150,19 @@ Different vector roles transform via different mechanisms:
150150

151151
| Role | Transformation | Requires Base Point? |
152152
| -------------- | ----------------------------------- | -------------------- |
153-
| `Pos` | Position transform (coordinate map) | No |
154-
| `Displacement` | Tangent transform (physical vector) | Sometimes[^1] |
155-
| `Vel` | Tangent transform (physical vector) | Sometimes[^1] |
156-
| `Acc` | Tangent transform (physical vector) | Sometimes[^1] |
153+
| `Point` | Position transform (coordinate map) | No |
154+
| `PhysDisp` | Tangent transform (physical vector) | Sometimes[^1] |
155+
| `PhysVel` | Tangent transform (physical vector) | Sometimes[^1] |
156+
| `PhysAcc` | Tangent transform (physical vector) | Sometimes[^1] |
157157

158158
[^1]:
159159
Required when converting between representations (e.g., Cartesian ↔
160160
Spherical), not required for unit conversions within the same
161161
representation.
162162

163-
## FiberPoint: Ergonomic Tangent Vector Conversions
163+
## PointedVector: Ergonomic Tangent Vector Conversions
164164

165-
`FiberPoint` provides a container for vectors anchored at a common base point,
165+
`PointedVector` provides a container for vectors anchored at a common base point,
166166
automatically managing the base point dependency required for tangent vector
167167
transformations:
168168

@@ -174,7 +174,7 @@ vel = cx.Vector.from_([10, 20, 30], "km/s")
174174
acc = cx.Vector.from_([0.1, 0.2, 0.3], "km/s^2")
175175
176176
# Create bundle - base is explicit, fields are tangent vectors
177-
bundle = cx.FiberPoint(base=base, velocity=vel, acceleration=acc)
177+
bundle = cx.PointedVector(base=base, velocity=vel, acceleration=acc)
178178
179179
# Convert entire bundle - automatically handles `at=` for tangent vectors
180180
sph_bundle = bundle.vconvert(cx.charts.sph3d)
@@ -188,13 +188,13 @@ sph_bundle = bundle.vconvert(cx.charts.sph3d)
188188

189189
**Key features:**
190190

191-
- Base must have role `Pos`; fields must not (enforced at construction)
191+
- Base must have role `PhysDisp`; fields must not (enforced at construction)
192192
- Automatic `at=` parameter handling for tangent transformations
193193
- JAX-compatible (works with `jax.jit`, `vmap`)
194194
- Physical components with uniform units (not coordinate derivatives)
195195

196196
See the
197-
[FiberPoint guide](https://coordinax.readthedocs.io/en/latest/guides/anchored_vector_bundle.html)
197+
[PointedVector guide](https://coordinax.readthedocs.io/en/latest/guides/anchored_vector_bundle.html)
198198
for details.
199199

200200
## Vector Algebra: Points vs Displacements
@@ -238,33 +238,33 @@ disp_from_origin = cx.as_pos(new_pos)
238238

239239
| Operation | Result | Allowed? |
240240
| ----------------------------- | -------------- | -------- |
241-
| `Displacement + Displacement` | `Displacement` ||
242-
| `Pos + Displacement` | `Pos` ||
243-
| `Displacement + Pos` |||
244-
| `Pos + Pos` |||
241+
| `PhysDisp + PhysDisp` | `PhysDisp` ||
242+
| `Point + PhysDisp` | `Point` ||
243+
| `PhysDisp + Point` |||
244+
| `Point + Point` |||
245245

246246
> **⚠️ Critical: Physical Components with Uniform Units**
247247
>
248-
> `Displacement` stores **physical vector components in an orthonormal frame**,
248+
> `PhysDisp` stores **physical vector components in an orthonormal frame**,
249249
> not coordinate increments. All components must have uniform dimension
250250
> `[length]`.
251251
>
252252
> For example, in cylindrical coordinates:
253253
>
254-
> -**Correct**: `Displacement(rho=1m, phi=2m, z=3m)` — physical components,
254+
> -**Correct**: `PhysDisp(rho=1m, phi=2m, z=3m)` — physical components,
255255
> where `phi=2m` means "2 meters in the tangential direction"
256-
> -**Wrong**: `Displacement(rho=1m, phi=0.5rad, z=3m)` — coordinate
256+
> -**Wrong**: `PhysDisp(rho=1m, phi=0.5rad, z=3m)` — coordinate
257257
> increments with mixed units
258258
>
259-
> This applies to all tangent vectors (`Displacement`, `Vel`, `Acc`), which
259+
> This applies to all tangent vectors (`PhysDisp`, `PhysVel`, `PhysAcc`), which
260260
> transform via orthonormal frame transformations, not coordinate chart
261261
> transformations.
262262
263263
## Metrics and Representations
264264

265-
Representations are coordinate charts; roles (Pos, Vel, Acc, ...) give vectors
266-
their physical meaning. A chart’s default metric defines how physical components
267-
are interpreted.
265+
Representations are coordinate charts; roles (PhysDisp, PhysVel, PhysAcc, ...)
266+
give vectors their physical meaning. A chart’s default metric defines how
267+
physical components are interpreted.
268268

269269
- Euclidean charts are exposed in `cx.r` (Cart, Cylindrical, Spherical, etc.).
270270
- Manifold charts are exposed in `cx.r` (e.g. `TwoSphere`).

docs/api/objs.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ vectors and coordinates.
88
This module contains the main user-facing objects:
99

1010
- **Vector**: A geometric vector with data, chart, and role
11-
- **FiberPoint**: A collection of related vectors anchored at a common point
11+
- **PointedVector**: A collection of related vectors anchored at a common point
1212
- **Coordinate**: A vector attached to a reference frame
1313

1414
## Quick Start
@@ -21,22 +21,22 @@ import unxt as u
2121
q = cx.Vector(
2222
data={"x": u.Q(1.0, "kpc"), "y": u.Q(2.0, "kpc"), "z": u.Q(3.0, "kpc")},
2323
chart=cx.charts.cart3d,
24-
role=cx.roles.pos,
24+
role=cx.roles.phys_disp,
2525
)
2626

2727
# Create a velocity vector
2828
v = cx.Vector(
2929
data={"x": u.Q(4.0, "kpc/Myr"), "y": u.Q(5.0, "kpc/Myr"), "z": u.Q(6.0, "kpc/Myr")},
3030
chart=cx.charts.cart3d,
31-
role=cx.roles.vel,
31+
role=cx.roles.phys_vel,
3232
)
3333

3434
# Convert to spherical coordinates
3535
q_sph = q.vconvert(cx.charts.sph3d)
3636
v_sph = v.vconvert(cx.charts.sph3d, q)
3737

3838
# Group related vectors
39-
space = cx.FiberPoint(base=q, speed=v)
39+
space = cx.PointedVector(base=q, speed=v)
4040

4141
# Attach to a frame
4242
import coordinax.frames as cxf
@@ -53,14 +53,14 @@ The `Vector` class is the primary object for representing geometric vectors:
5353
q = cx.Vector(
5454
data={"x": u.Q(1.0, "kpc"), "y": u.Q(2.0, "kpc"), "z": u.Q(3.0, "kpc")},
5555
chart=cx.charts.cart3d,
56-
role=cx.roles.pos,
56+
role=cx.roles.phys_disp,
5757
)
5858

5959
# From array (auto-detect chart and role)
6060
q = cx.Vector.from_([1, 2, 3], "kpc")
6161

6262
# From array with explicit chart and role
63-
v = cx.Vector.from_([10, 20, 30], "km/s", cx.charts.cart3d, cx.roles.vel)
63+
v = cx.Vector.from_([10, 20, 30], "km/s", cx.charts.cart3d, cx.roles.phys_vel)
6464

6565
# Access components
6666
print(q["x"]) # Quantity
@@ -74,13 +74,13 @@ print(q.role) # Role instance
7474
- `vconvert(to_chart, at=None)`: Convert to a different chart
7575
- `uconvert(units)`: Convert units of components
7676

77-
## FiberPoint
77+
## PointedVector
7878

79-
The `FiberPoint` class groups related vectors (position, velocity, acceleration)
79+
The `PointedVector` class groups related vectors (position, velocity, acceleration)
8080
at a common point:
8181

8282
```python
83-
space = cx.FiberPoint(base=q, speed=v, acceleration=a)
83+
space = cx.PointedVector(base=q, speed=v, acceleration=a)
8484

8585
# Access vectors
8686
space.base # position
@@ -117,7 +117,7 @@ v_sph = cx.vconvert(cx.charts.sph3d, v, q)
117117

118118
## as_pos Function
119119

120-
Convert a Point role to a Pos role (interpret location as displacement from
120+
Convert a Point role to a PhysDisp role (interpret location as displacement from
121121
origin):
122122

123123
```python

docs/api/roles.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ A **role** defines what a vector represents mathematically and physically:
1010
- **Point**: A location in space (affine, not a vector space element)
1111
- **Pos** (Position): A displacement vector from an origin
1212
- **Vel** (Velocity): A tangent vector representing rate of change of position
13-
- **Acc** (Acceleration): A tangent vector representing rate of change of
13+
- **PhysAcc** (Acceleration): A tangent vector representing rate of change of
1414
velocity
1515

1616
Roles determine transformation laws: positions transform as points, while
@@ -24,13 +24,13 @@ import coordinax.roles as cxr
2424

2525
# Use predefined role instances
2626
point = cxr.point # Point role
27-
pos = cxr.pos # Position role
28-
vel = cxr.vel # Velocity role
29-
acc = cxr.acc # Acceleration role
27+
pos = cxr.phys_disp # Position role
28+
vel = cxr.phys_vel # Velocity role
29+
acc = cxr.phys_acc # Acceleration role
3030

3131
# Or instantiate classes directly
3232
point_role = cxr.Point()
33-
pos_role = cxr.Pos()
33+
pos_role = cxr.PhysDisp()
3434
```
3535

3636
## Role Hierarchy
@@ -39,9 +39,9 @@ pos_role = cxr.Pos()
3939
AbstractRole
4040
├── Point # Affine location (transforms via point_transform)
4141
└── AbstractPhysicalRole
42-
├── Pos # Position/displacement (transforms via point_transform)
43-
├── Vel # Velocity (transforms via physical_tangent_transform)
44-
└── Acc # Acceleration (transforms via physical_tangent_transform)
42+
├── PhysDisp # Position/displacement (transforms via point_transform)
43+
├── PhysVel # Velocity (transforms via physical_tangent_transform)
44+
└── PhysAcc # Acceleration (transforms via physical_tangent_transform)
4545
```
4646

4747
## Role Semantics
@@ -51,10 +51,10 @@ AbstractRole
5151
- **Point**: An absolute location; cannot be added to other points
5252
- **Pos**: A displacement from an origin; forms a vector space
5353

54-
Use `as_pos(point)` to convert a Point to a Pos (interpreting the point as a
54+
Use `as_pos(point)` to convert a Point to a PhysDisp (interpreting the point as a
5555
displacement from the origin).
5656

57-
### Physical Roles (Vel, Acc)
57+
### Physical Roles (Vel, PhysAcc)
5858

5959
Velocity and acceleration are **tangent vectors**. They transform using the
6060
Jacobian of the coordinate transformation, not by simple coordinate conversion.
@@ -66,12 +66,12 @@ import unxt as u
6666
q = cx.Vector.from_(
6767
{"x": u.Q(1, "kpc"), "y": u.Q(2, "kpc"), "z": u.Q(3, "kpc")},
6868
cx.charts.cart3d,
69-
cx.roles.pos,
69+
cx.roles.phys_disp,
7070
)
7171
v = cx.Vector.from_(
7272
{"x": u.Q(10, "km/s"), "y": u.Q(20, "km/s"), "z": u.Q(30, "km/s")},
7373
cx.charts.cart3d,
74-
cx.roles.vel,
74+
cx.roles.phys_vel,
7575
)
7676

7777
# Position converts directly

docs/api/transforms.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ Velocity transforms use the Jacobian:
121121

122122
$$v'^i = \frac{\partial q'^i}{\partial q^j} v^j$$
123123

124-
### Acceleration (Acc)
124+
### Acceleration (PhysAcc)
125125

126126
Acceleration transforms include connection terms for correct geometric behavior.
127127

docs/conventions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ avoid verbosity. Many of these are also found in the [Glossary](glossary.md).
1010
Concrete (or 'final') classes are not so prefixed. As a further rule, no
1111
abstract class inherits from a concrete class and no concrete class inherits
1212
from any other concrete class.
13-
- `Pos`: a shorthand for "position", used in class names for concision.
14-
- `Vel`: a shorthand for "velocity", used in class names for concision.
15-
- `Acc`: a shorthand for "acceleration", used in class names for concision.
13+
- `PhysDisp`: a shorthand for "position", used in class names for concision.
14+
- `PhysVel`: a shorthand for "velocity", used in class names for concision.
15+
- `PhysAcc`: a shorthand for "acceleration", used in class names for concision.
1616

1717
## Functional vs Object-Oriented APIs
1818

0 commit comments

Comments
 (0)