read_tps#

ktch.io.read_tps(file_path, as_frame=False, strict=True)[source]#

Read landmark data from a TPS file.

Parameters:
file_pathstr or path-like

Path to the TPS file.

as_framebool, default=False

If True, return a DataFrame.

strictbool, default=True

If True, raise ValueError on recoverable format inconsistencies (a landmark/point count that disagrees with the declared LM=/POINTS= value, or a non-numeric SCALE). If False, emit a warning and read as much as possible: the actual coordinate rows are used and an unparsable SCALE becomes None. Non-recoverable problems (a missing ID or a malformed coordinate row) always raise.

Returns:
resultTPSData or list of TPSData or pd.DataFrame

If as_frame=False, returns a TPSData for a single specimen or a list of TPSData for multiple specimens. Landmark coordinates are accessible via TPSData.to_numpy(), and semilandmark curves via the TPSData.curves attribute.

If as_frame=True, returns a concatenated DataFrame. When the file contains CURVES data, returns a tuple (landmarks, semilandmarks) of DataFrames.