yaw.core.coordinates.Coord3D#

class yaw.core.coordinates.Coord3D(x: ArrayLike, y: ArrayLike, z: ArrayLike)[source]#

Bases: Coordinate

A representation of a vector of 3-dim Euclidean coordiantes (x, y, z).

Create a new coordinate vector.

Parameters:
  • x (float, NDArray) – The x-coordiante(s).

  • y (float, NDArray) – The y-coordiante(s).

  • z (float, NDArray) – The z-coordiante(s).

Note

The coordinate vector has a length, supports numpy-style indexing and iteration over the elements (always returning new coordinate vector instances).

Methods

__init__(x, y, z)

Create a new coordinate vector.

distance(other)

Compute the Euclidean distance between two coordinate vectors.

from_array(array)

Create a new coordinate vector from an array of tuples of (x, y, z).

from_coords(coords)

Concatenate a sequence of coordinates into a new vector of coordates.

mean()

The mean coordinate (mean over all dimensions).

to_3d()

Get the coordinates as 3-dim Euclidean coordiante Coord3D.

to_sky()

Get the coordinates as angular coordiante CoordSky in radian.

Attributes

dim

A list of names of coordinates in the coordinate system.

ndim

The number of coordinates in the coordinate system.

values

The coordinate values cast into a numpy array with shape (N, ndim) or (ndim,) if there is only a single entry.

x

The x-coordiante(s).

y

The y-coordiante(s).

z

The z-coordiante(s).

property dim: tuple[str]#

A list of names of coordinates in the coordinate system.

distance(other: Coordinate) Dist3D[source]#

Compute the Euclidean distance between two coordinate vectors.

Coordinates are automatically converted before distance calculation.

Parameters:

other (Coordinate) – Second coordinate vector.

Returns:

Euclidean distance between points in this and the other vector.

Return type:

Dist3D

classmethod from_array(array) Coord3D[source]#

Create a new coordinate vector from an array of tuples of (x, y, z).

classmethod from_coords(coords: Sequence[Coord3D]) Coord3D[source]#

Concatenate a sequence of coordinates into a new vector of coordates.

mean() Coord3D[source]#

The mean coordinate (mean over all dimensions).

property ndim: int#

The number of coordinates in the coordinate system.

to_3d() Coord3D[source]#

Get the coordinates as 3-dim Euclidean coordiante Coord3D.

to_sky() CoordSky[source]#

Get the coordinates as angular coordiante CoordSky in radian.

Warning

During conversion, points loose their radial information. After back-transformation to Coord3D they lie on the unit sphere.

property values: NDArray[np.float64]#

The coordinate values cast into a numpy array with shape (N, ndim) or (ndim,) if there is only a single entry.

x: NDArray#

The x-coordiante(s).

y: NDArray#

The y-coordiante(s).

z: NDArray#

The z-coordiante(s).