yaw.AngularDistances#

class yaw.AngularDistances(data: ArrayLike)[source]#

Bases: CustomNumpyArray

Container for angular distances in radian.

Provides convenience methods to convert from and to 3-dim Euclidean (xyz) distances and finding minima and maxima. Additionally implements len(), element-wise comparison with ==/!=/</<=/>/>= operators, addition with +/-, iteration over the contained distances, and indexing/slicing.

Parameters:

data – Input distances in radian that are broadcastable to a 1-dim numpy array.

Methods

__init__(data)

copy()

Create a copy of this instance.

from_3d(dists)

Convert angular distances from 3-dim Euclidean (xyz) distances.

from_dists(dists)

Concatenate a set of angular distances with arbitrary length.

max()

Get the maximum contained distance.

min()

Get the minimum contained distance.

to_3d()

Convert angular to Eudlidean (xyz) chord distance.

tolist()

Convert the underlying data array to a python list.

Attributes

data

Distance array with length N.

copy() Self#

Create a copy of this instance.

data: NDArray#

Distance array with length N.

classmethod from_3d(dists: ArrayLike) Self[source]#

Convert angular distances from 3-dim Euclidean (xyz) distances.

Assumes that distances are chord distances measured between points on the surface of the unit-sphere.

Parameters:

dists – Input Euclidean distances that are broadcastable to a 1-dim numpy array.

Returns:

New instance of AngularDistances.

Raises:

ValueError – If any input distance exceeds 2, the diameter of the unit-sphere.

classmethod from_dists(dists: Iterable[AngularDistances]) Self[source]#

Concatenate a set of angular distances with arbitrary length.

Parameters:

dists – Any iterable of AngularDistances to concatenate.

Returns:

New instance of AngularDistances.

max() Self[source]#

Get the maximum contained distance.

Returns:

AngularDistances with single entry.

min() Self[source]#

Get the minimum contained distance.

Returns:

AngularDistances with single entry.

to_3d() NDArray[source]#

Convert angular to Eudlidean (xyz) chord distance.

Returns:

1-dim numpy array.

tolist() list#

Convert the underlying data array to a python list.