yaw.AngularCoordinates#

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

Bases: CustomNumpyArray

Container for angular coordinates in radian.

Provides convenience methods to convert from and to 3-dim Euclidean (xyz) coordinates and computing distances between coordinates. Additionally implements len(), element-wise comparison with == operator, iteration over the contained coordinates, and indexing/slicing.

Parameters:

data – Input coordinates in radian that are broadcastable to a 2-dim numpy array with shape (2, N).

Methods

__init__(data)

copy()

Create a copy of this instance.

distance(other)

Compute the angular distance to another set of angular coordinates.

from_3d(xyz)

Compute angular coordinates from 3-dim Euclidean (xyz) coordinates.

from_coords(coords)

Concatenate a set of angular coordinates with arbitrary length.

mean([weights])

Compute the mean angular coordinate.

to_3d()

Convert angular to Eudlidean (xyz) coordinates.

tolist()

Convert the underlying data array to a python list.

Attributes

data

Corrdinate array with shape (N, 2).

dec

Accessor for array of declination in radian.

ra

Accessor for array of right ascension in radian.

copy() Self#

Create a copy of this instance.

data: NDArray#

Corrdinate array with shape (N, 2).

property dec: NDArray[np.float64]#

Accessor for array of declination in radian.

distance(other: AngularCoordinates) Self[source]#

Compute the angular distance to another set of angular coordinates.

The coordinates must have either the same length or

Parameters:

weights – Optional weights for the coordinates when computing the mean.

Returns:

Angular distance between both sets of coordinates, represented as AngularDistances.

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

Compute angular coordinates from 3-dim Euclidean (xyz) coordinates.

Parameters:

xyz – Input Euclidean coordinates that are broadcastable to a 2-dim numpy array with shape (3, N).

Returns:

New instance of AngularCoordinates.

classmethod from_coords(coords: Iterable[AngularCoordinates]) Self[source]#

Concatenate a set of angular coordinates with arbitrary length.

Parameters:

coords – Any iterable of AngularCoordinates to concatenate.

Returns:

New instance of AngularCoordinates.

mean(weights: ArrayLike | None = None) Self[source]#

Compute the mean angular coordinate.

The mean is computed in Euclidean coordinates which are converted back to angular coordinates.

Parameters:

weights – Optional weights for the coordinates when computing the mean.

Returns:

AngularCoordinates with single coordinate reprensenting the mean.

property ra: NDArray[np.float64]#

Accessor for array of right ascension in radian.

to_3d() NDArray[source]#

Convert angular to Eudlidean (xyz) coordinates.

Coordinates are projected onto the unit-sphere.

Returns:

2-dim numpy array with shape (3, N).

tolist() list#

Convert the underlying data array to a python list.