Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/guides/quantities.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Specialized Quantity Objects
# Specialized Quantities

<!-- invisible-code-block: python

Expand Down Expand Up @@ -97,6 +97,8 @@ The {meth}`~coordinax.angle.Angle.wrap_to` method has a function counterpart
Angle(Array(10, dtype=int32, weak_type=True), unit='deg')
```

---

## Working with `Distance` Objects

The {class}`~coordinax.distance.Distance` class in {mod}`coordinax.distance` is
Expand Down
27 changes: 21 additions & 6 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,13 @@ transforming coordinate objects, such as:
- time-differential vector objects, like velocities and accelerations (e.g.,
{class}`~coordinax.vecs.CartesianVel3D`,
{class}`~coordinax.vecs.SphericalVel`, etc.)
- collections of vector objects
- transformations on vectors ({func}`~coordinax.vecs.vconvert`)
- reference frames <!-- TODO: add e.g., links to classes -->
- collections of vector objects like {class}`~coordinax.vecs.KinematicSpace`
- transformations of vector types ({func}`~coordinax.vecs.vconvert`)
- operations on vectors ({mod}`~coordinax.ops`)
- reference frames and coordinate systems ({mod}`~coordinax.frames`)
- coordinates that combine vectors and frames
({class}`~coordinax.frames.Coordinate`)
- and more!

This functionality is organized into submodules, which are imported into the
top-level `coordinax` namespace. You can import them directly, or use the
Expand All @@ -143,7 +147,7 @@ top-level `coordinax` namespace. You can import them directly, or use the
>>> import coordinax as cx

>>> from inspect import ismodule
>>> [x for x in cx.__all__ if ismodule(getattr(cx, x))]
>>> [name for name in cx.__all__ if ismodule(getattr(cx, name))]
['angle', 'distance', 'vecs', 'ops', 'frames']
```

Expand Down Expand Up @@ -234,6 +238,17 @@ specifying values for all components:
[1 2 3]>
```

The most flexible way to create vectors is to use the
{meth}`~coordinax.vecs.vector` method, which infers the appropriate vector class
based on the provided inputs:

```{code-block} python
>>> q = cxv.vector([1, 2, 3], "kpc")
>>> print(q)
<CartesianPos3D: (x, y, z) [kpc]
[1 2 3]>
```

#### Vector Conversion

Vectors can be converted between different coordinate representations using the
Expand Down Expand Up @@ -365,9 +380,9 @@ Coordinate(
>>> coord.vconvert(cxv.SphericalPos)
Coordinate(
KinematicSpace({ 'length': SphericalPos(
r=Distance(weak_f32[], unit='kpc'),
r=Distance(f32[], unit='kpc'),
theta=Angle(f32[], unit='rad'),
phi=Angle(weak_f32[], unit='rad')
phi=Angle(f32[], unit='rad')
) }),
frame=Alice()
)
Expand Down
Loading