Skip to main content

numpy_utils

Utility functions for interacting with numpy.

Module

Functions

check_for_compatible_lengths

def check_for_compatible_lengths(    a: Union[np.ndarray, list[np.ndarray], list[T]],    b: Union[np.ndarray, list[np.ndarray], list[T]],    a_name: str = 'the first arg',    b_name: str = 'the second arg',)> None:

Checks if two numpy-related collections are compatible lengths.

Compatible lengths here means they are equal in size in the first or second dimension.

Raises

  • ValueError: if the lengths are incompatible