stitch_mats

stitch_mats(mats: list[Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]], overlaps: list[int], axis: int = 0) Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str][source][source]

break up the matrices into their overlapping and non-overlapping parts then stitch them back together

Parameters:
  • mats (list) – The matrices to stitch together

  • overlaps (list) – The number of overlapping rows between each matrix

  • axis (int, optional) – The axis to stitch along, by default 0

Returns:

The stitched matrix

Return type:

np.ndarray

Examples

>>> mat1 = np.array([[1, 2, 3], [4, 5, 6]])
>>> mat2 = np.array([[7, 8, 9], [10, 11, 12]])
>>> mat3 = np.array([[13, 14, 15], [16, 17, 18]])
>>> stitch_mats([mat1, mat2, mat3], [1, 1])
array([[ 1,  2,  3],
       [10, 11, 12],
       [16, 17, 18]])
>>> stitch_mats([mat1, mat2, mat3], [0, 0], axis=1)
array([[ 1,  2,  3,  7,  8,  9, 13, 14, 15],
       [ 4,  5,  6, 10, 11, 12, 16, 17, 18]])
>>> mat4 = np.array([[19, 20, 21], [22, 23, float("nan")]])
>>> stitch_mats([mat3, mat4], [0], axis=1)
array([[13., 14., 15., 19., 20., 21.],
       [16., 17., 18., 22., 23., nan]])