twocan.read_M
- twocan.read_M(M: str) ndarray[source]
Parse a string representation of an affine transformation matrix.
This function parses string representations of 2x3 affine transformation matrices, handling various formatting inconsistencies by normalizing whitespace and bracket placement. Useful when reading from csv.
- Parameters:
M (str) – String representation of a 2x3 affine transformation matrix. Can contain various whitespace and formatting variations.
- Returns:
2x3 affine transformation matrix of shape (2, 3).
- Return type:
np.ndarray
Notes
This function uses eval() which can be unsafe with untrusted input. It should only be used with trusted transformation matrix strings.