src.object package¶
Submodules¶
src.object.function module¶
- class src.object.function.Coordinate(*args, **metadata)¶
Bases:
CoordinateMixin,ABC- Parameters:
args (Any)
metadata (Metadata)
- class src.object.function.CoordinateMixin(*args, **metadata)¶
Bases:
FunctionMixin,ABC- Parameters:
args (Any)
metadata (Metadata)
- class src.object.function.Degree(*args, **metadata)¶
Bases:
DegreeMixin,DenseArray- Parameters:
args (Any)
metadata (Metadata)
- class src.object.function.DegreeMixin(*args, **metadata)¶
Bases:
FunctionMixin,ABC- Parameters:
args (Any)
metadata (Metadata)
- class src.object.function.FunctionMixin(*args, **metadata)¶
Bases:
ObjectMixin,BaseArray,ABC- Parameters:
args (Any)
metadata (Metadata)
- 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
- fixed_dtype¶
alias of
float64
- fixed_ndim: int = 2¶
- property nfuncs: int¶
- property npts: int¶
- class src.object.function.KNNDistance(*args, **metadata)¶
Bases:
KNNDistanceMixin,DenseArray- Parameters:
args (Any)
metadata (Any)
- class src.object.function.KNNDistanceMixin(*args, **metadata)¶
Bases:
FunctionMixin,ABC- Parameters:
args (Any)
metadata (Any)
- class src.object.function.LocalDistortion(*args, **metadata)¶
Bases:
LocalDistortionMixin,DenseArray- Parameters:
args (Any)
metadata (Any)
- class src.object.function.LocalDistortionMixin(*args, **metadata)¶
Bases:
FunctionMixin,ABC- Parameters:
args (Any)
metadata (Any)
- class src.object.function.NeighborCount(*args, **metadata)¶
Bases:
NeighborCountMixin,DenseArray- Parameters:
args (Any)
metadata (Any)
- class src.object.function.NeighborCountMixin(*args, **metadata)¶
Bases:
FunctionMixin,ABC- Parameters:
args (Any)
metadata (Any)
- fixed_dtype¶
alias of
int64
src.object.geometry_matrix_mixin module¶
- class src.object.geometry_matrix_mixin.GeometryMatrixMixin(*args, **metadata)¶
Bases:
ObjectMixin,BaseArray,ABCMixin class providing common functionality for geometry-related matrices.
Adds default dimensionality of 2 of and default dtype of np.float64, along with convenience properties for querying matrix shape and point counts. Typically used as a base for distance, affinity, and Laplacian matrices.
- Parameters:
args (Any)
metadata (Metadata)
- 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
- fixed_dtype¶
alias of
float64
- fixed_ndim: int = 2¶
- property from_npts: int¶
Number of points corresponding to the rows of the matrix.
- Returns:
Number of rows in the matrix.
- Return type:
int
- property is_square: bool¶
Check if the matrix is square (number of rows equals number of columns).
- Returns:
True if the matrix is square, False otherwise.
- Return type:
bool
- property npts: int¶
Number of points in the matrix, assuming it is square.
- Returns:
Number of points (rows or columns) if the matrix is square.
- Return type:
int
- Raises:
ValueError – If the matrix is not square.
- property to_npts: int¶
Number of points corresponding to the columns of the matrix.
- Returns:
Number of columns in the matrix.
- Return type:
int
src.object.metadata module¶
- class src.object.metadata.Metadata(name=None, dist_type=None, aff_type=None, lap_type=None, radius=None, eps=None, ks=None, radii=None, ds=None, degree_type=None, aff_minus_id=None)¶
Bases:
object- Parameters:
name (str | None)
dist_type (Literal['euclidean', 'cityblock', 'sqeuclidean'] | None)
aff_type (Literal['gaussian'] | None)
lap_type (Literal['geometric', 'random_walk', 'symmetric'] | None)
radius (float | None)
eps (float | None)
ks (Tuple[int, ...] | None)
radii (Tuple[float, ...] | None)
ds (Tuple[int, ...] | None)
degree_type (Literal['adjacency', 'affinity'] | None)
aff_minus_id (bool | None)
- aff_minus_id: bool | None¶
- aff_type: Literal['gaussian'] | None¶
- degree_type: Literal['adjacency', 'affinity'] | None¶
- dist_type: Literal['euclidean', 'cityblock', 'sqeuclidean'] | None¶
- ds: Tuple[int, ...] | None¶
- eps: float | None¶
- ks: Tuple[int, ...] | None¶
- lap_type: Literal['geometric', 'random_walk', 'symmetric'] | None¶
- name: str | None¶
- radii: Tuple[float, ...] | None¶
- radius: float | None¶
- src.object.metadata.optional_tuple_of_floats(instance, attribute, value)¶
- Parameters:
instance (object)
attribute (Attribute)
value (Tuple[float, ...] | None)
- Return type:
None
- src.object.metadata.optional_tuple_of_ints(instance, attribute, value)¶
- Parameters:
instance (object)
attribute (Attribute)
value (Tuple[int, ...] | None)
- Return type:
None
src.object.object_mixin module¶
- class src.object.object_mixin.ObjectMixin(*args, **kwargs)¶
Bases:
ABCAbstract base class providing metadata handling and type/dimension validation.
- Parameters:
args (Any)
kwargs (Any)
- abstractmethod 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
- fixed_dtype: Type[generic]¶
- fixed_ndim: int¶
- src.object.object_mixin.chunk(arr, bsize=None)¶
- Parameters:
arr (T)
bsize (int | None)
- Return type:
Iterator[T]
Module contents¶
- class src.object.Eigen(iterable, **kwargs)¶
Bases:
ObjectMixin,Tuple[DenseArray,DenseArray]This class represents a pair of eigenvalues and eigenvectors. It is a Tuple of two DenseArray with additional checks and methods. Ensures correct eigenvalue and eigenvector lengths and dimensions.
- Parameters:
iterable (Iterable[Any])
kwargs (Any)
- Return type:
- classmethod concat_with_metadata(arrs, axis=0)¶
Concatenates eigenvalues and eigenvectors along an axis and returns an instance of this class with metadata of the first object in arrs.
- Parameters:
arrs (Sequence[Self]) – Sequence of objects of this class to concatenate.
axis (int) – Axis along which to concatenate arrays. (default: 0).
- Returns:
A new instance of this class with concatenated data and metadata taken from the first element in arrs.
- Return type:
Self
- property eigenvalues: DenseArray¶
- property eigenvectors: DenseArray¶
- fixed_tuple_length: int = 2¶
- fixed_type: Tuple[Type, Type] = (<class 'src.array.dense.dense.DenseArray'>, <class 'src.array.dense.dense.DenseArray'>)¶
- fixed_value_ndim: int = 1¶
- fixed_vector_ndim: int = 2¶
- sort_by_eigval(largest=False)¶
Sorts the eigenvalues and eigenvectors by eigenvalue.
- Parameters:
largest (bool) – If True, sorts with largest first. If False, sorts with smallest first.
- Returns:
A sorted instance of this class.
- Return type:
Self
- class src.object.FunctionMixin(*args, **metadata)¶
Bases:
ObjectMixin,BaseArray,ABC- Parameters:
args (Any)
metadata (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
- fixed_dtype¶
alias of
float64
- fixed_ndim: int = 2¶
- property nfuncs: int¶
- property npts: int¶
- class src.object.GeometryMatrixMixin(*args, **metadata)¶
Bases:
ObjectMixin,BaseArray,ABCMixin class providing common functionality for geometry-related matrices.
Adds default dimensionality of 2 of and default dtype of np.float64, along with convenience properties for querying matrix shape and point counts. Typically used as a base for distance, affinity, and Laplacian matrices.
- Parameters:
args (Any)
metadata (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
- fixed_dtype¶
alias of
float64
- fixed_ndim: int = 2¶
- property from_npts: int¶
Number of points corresponding to the rows of the matrix.
- Returns:
Number of rows in the matrix.
- Return type:
int
- property is_square: bool¶
Check if the matrix is square (number of rows equals number of columns).
- Returns:
True if the matrix is square, False otherwise.
- Return type:
bool
- property npts: int¶
Number of points in the matrix, assuming it is square.
- Returns:
Number of points (rows or columns) if the matrix is square.
- Return type:
int
- Raises:
ValueError – If the matrix is not square.
- property to_npts: int¶
Number of points corresponding to the columns of the matrix.
- Returns:
Number of columns in the matrix.
- Return type:
int
- class src.object.Metadata(name=None, dist_type=None, aff_type=None, lap_type=None, radius=None, eps=None, ks=None, radii=None, ds=None, degree_type=None, aff_minus_id=None)¶
Bases:
object- Parameters:
name (str | None)
dist_type (Literal['euclidean', 'cityblock', 'sqeuclidean'] | None)
aff_type (Literal['gaussian'] | None)
lap_type (Literal['geometric', 'random_walk', 'symmetric'] | None)
radius (float | None)
eps (float | None)
ks (Tuple[int, ...] | None)
radii (Tuple[float, ...] | None)
ds (Tuple[int, ...] | None)
degree_type (Literal['adjacency', 'affinity'] | None)
aff_minus_id (bool | None)
- aff_minus_id: bool | None¶
- aff_type: Literal['gaussian'] | None¶
- degree_type: Literal['adjacency', 'affinity'] | None¶
- dist_type: Literal['euclidean', 'cityblock', 'sqeuclidean'] | None¶
- ds: Tuple[int, ...] | None¶
- eps: float | None¶
- ks: Tuple[int, ...] | None¶
- lap_type: Literal['geometric', 'random_walk', 'symmetric'] | None¶
- name: str | None¶
- radii: Tuple[float, ...] | None¶
- radius: float | None¶
- class src.object.ObjectMixin(*args, **kwargs)¶
Bases:
ABCAbstract base class providing metadata handling and type/dimension validation.
- Parameters:
args (Any)
kwargs (Any)
- abstractmethod 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
- fixed_dtype: Type[generic]¶
- fixed_ndim: int¶
- src.object.chunk(arr, bsize=None)¶
- Parameters:
arr (T)
bsize (int | None)
- Return type:
Iterator[T]