src.geometry package

Subpackages

Submodules

src.geometry.normalize module

src.geometry.normalize.normalize(arr, axis=1, degree_exp=1.0, sym_norm=False, in_place=False)
Parameters:
  • arr (T)

  • axis (int | None)

  • degree_exp (float)

  • sym_norm (bool)

  • in_place (bool)

Return type:

T

src.geometry.points module

class src.geometry.points.Coordinates(*args, **kwargs)

Bases: PointsMixin, DenseArray

Parameters:
  • args (Any)

  • kwargs (Any)

classmethod concat_with_metadata(arrs, axis=0)

Concatenates a Sequence of this class, retaining the metadata of the first in the sequence. Returns an instance of this class with data concatentated.

Parameters:
  • arrs (Sequence[Self]) – Sequence of instances to concatenate.

  • axis (int) – Axis to concatentate on. Axis must exist for each instance in arrs.

Returns:

An instance of this class with data concatentated.

Return type:

Self

property d: int
class src.geometry.points.Data(*args, **kwargs)

Bases: Points

Parameters:
  • args (Any)

  • kwargs (Any)

property D: int
class src.geometry.points.Embedding(*args, **kwargs)

Bases: Points

Parameters:
  • args (Any)

  • kwargs (Any)

property p: int
class src.geometry.points.Points(*args, **kwargs)

Bases: PointsMixin, DenseArray

Parameters:
  • args (Any)

  • kwargs (Any)

classmethod concat_with_metadata(arrs, axis=0)

Concatenates a Sequence of this class, retaining the metadata of the first in the sequence. Returns an instance of this class with data concatentated.

Parameters:
  • arrs (Sequence[Self]) – Sequence of instances to concatenate.

  • axis (int) – Axis to concatentate on. Axis must exist for each instance in arrs.

Returns:

An instance of this class with data concatentated.

Return type:

Self

demean(mean_pt=None, weights=None, needs_norm=True, in_place_demean=False, in_place_norm=False)
Parameters:
  • mean_pt (DenseArray | int | bool | None)

  • weights (BaseArray | None)

  • needs_norm (bool)

  • in_place_demean (bool)

  • in_place_norm (bool)

Return type:

Tuple[Points, DenseArray | None, BaseArray | None]

pairwise_distance(y_pts=None, dist_type='euclidean')

Compute the pairwise distance matrix between points.

If y_pts is provided, computes distances between self and y_pts. Otherwise, computes distances among points in self.

Parameters:
  • y_pts (Optional[Points]) – Another Points object to compute distances to. If None, distances are computed within self.

  • dist_type (DistanceType) – The type of distance metric to use (“euclidean”, “cityblock”, “sqeuclidian”). Name of metric is stored in metadata. (default: “euclidian”)

Returns:

A DistanceMatrix containing pairwise distances. The matrix name is constructed from the metadata of the points involved.

Return type:

DistanceMatrix

class src.geometry.points.PointsMixin(*args, **kwargs)

Bases: ObjectMixin, BaseArray, ABC

Mixin class for point cloud objects.

Adds fixed dimensionality and dtype constraints, metadata handling, and distance computation functionality to point cloud classes.

Parameters:
  • args (Any)

  • kwargs (Any)

fixed_dtype

alias of float64

fixed_ndim: int = 2
metadata: Metadata
property nfeats: int

Number of features (dimensions) per point.

Returns:

Number of features per point.

Return type:

int

property npts: int

Number of points in the point set.

Returns:

Number of points.

Return type:

int

Module contents

class src.geometry.Coordinates(*args, **kwargs)

Bases: PointsMixin, DenseArray

Parameters:
  • args (Any)

  • kwargs (Any)

classmethod concat_with_metadata(arrs, axis=0)

Concatenates a Sequence of this class, retaining the metadata of the first in the sequence. Returns an instance of this class with data concatentated.

Parameters:
  • arrs (Sequence[Self]) – Sequence of instances to concatenate.

  • axis (int) – Axis to concatentate on. Axis must exist for each instance in arrs.

Returns:

An instance of this class with data concatentated.

Return type:

Self

property d: int
class src.geometry.Data(*args, **kwargs)

Bases: Points

Parameters:
  • args (Any)

  • kwargs (Any)

property D: int
class src.geometry.EigenSystem(iterable, **kwargs)

Bases: Eigen

This class represents a pair of eigenvalues and eigenvectors aka an eigensystem. EigenSystem behaves as a Tuple with extra methods. An eigenvalue’s corresponding eigenvector is stored at the same index.

Parameters:
  • iterable (Iterable[Any])

  • kwargs (Any)

Return type:

Eigen

drop_first()

Drops the first eigenvalue and eigenvector of the system.

Returns:

An EigenSystem with the first eigenvalue and eigenvector dropped.

Return type:

EigenSystem

get_comp(ncomp)

Gets the first ncomp number of eigenvalues and eigenvectors.

Parameters:

ncomp (int) – The number of eigenvalues and eigenvectors to return.

Returns:

An EigenSystem with the ncomp number of eigenvalues and eigenvectors.

Return type:

EigenSystem

class src.geometry.Embedding(*args, **kwargs)

Bases: Points

Parameters:
  • args (Any)

  • kwargs (Any)

property p: int
class src.geometry.Points(*args, **kwargs)

Bases: PointsMixin, DenseArray

Parameters:
  • args (Any)

  • kwargs (Any)

classmethod concat_with_metadata(arrs, axis=0)

Concatenates a Sequence of this class, retaining the metadata of the first in the sequence. Returns an instance of this class with data concatentated.

Parameters:
  • arrs (Sequence[Self]) – Sequence of instances to concatenate.

  • axis (int) – Axis to concatentate on. Axis must exist for each instance in arrs.

Returns:

An instance of this class with data concatentated.

Return type:

Self

demean(mean_pt=None, weights=None, needs_norm=True, in_place_demean=False, in_place_norm=False)
Parameters:
  • mean_pt (DenseArray | int | bool | None)

  • weights (BaseArray | None)

  • needs_norm (bool)

  • in_place_demean (bool)

  • in_place_norm (bool)

Return type:

Tuple[Points, DenseArray | None, BaseArray | None]

pairwise_distance(y_pts=None, dist_type='euclidean')

Compute the pairwise distance matrix between points.

If y_pts is provided, computes distances between self and y_pts. Otherwise, computes distances among points in self.

Parameters:
  • y_pts (Optional[Points]) – Another Points object to compute distances to. If None, distances are computed within self.

  • dist_type (DistanceType) – The type of distance metric to use (“euclidean”, “cityblock”, “sqeuclidian”). Name of metric is stored in metadata. (default: “euclidian”)

Returns:

A DistanceMatrix containing pairwise distances. The matrix name is constructed from the metadata of the points involved.

Return type:

DistanceMatrix

src.geometry.normalize(arr, axis=1, degree_exp=1.0, sym_norm=False, in_place=False)
Parameters:
  • arr (T)

  • axis (int | None)

  • degree_exp (float)

  • sym_norm (bool)

  • in_place (bool)

Return type:

T