Conversion¶
Functions for converting external file formats (C3D, MVNX, OpenCap CSV, generic tables) into the biomechzoo zoo data structure.
- biomechzoo.conversion.c3d2zoo_data.c3d2zoo_data(c3d_obj)[source]¶
Convert an ezc3d C3D object to zoo format.
- Parameters:
c3d_obj (ezc3d.c3d) – C3D object loaded via
ezc3d.c3d(filepath), exposing ‘data’ and ‘parameters’ via dict-style indexing.- Returns:
data (dict) – Zoo dictionary with ‘line’ and ‘event’ fields per channel, plus a ‘zoosystem’ metadata entry.
- Parameters:
c3d_obj (c3d)
- Return type:
- biomechzoo.conversion.mvnx2zoo_data.mvnx2zoo_data(fl)[source]¶
Convert an Xsens .mvnx file to zoo format.
- biomechzoo.conversion.mvnx2zoo_data.is_valid_for_zoo(val)[source]¶
Check whether a value is valid for a MATLAB-compatible zoo structure.
- biomechzoo.conversion.opencap2zoo_data.opencap2zoo_data(ik_file)[source]¶
Convert OpenCap inverse-kinematics output to zoo format.
Not implemented. Reserved for future OpenCap support; do not use in its current form.
- Parameters:
ik_file (str) – Path to an OpenSim
.motinverse-kinematics file.- Raises:
NotImplementedError – Always.
- Parameters:
ik_file (str)
- Return type:
- biomechzoo.conversion.table2zoo_data.table2zoo_data(fl, extension, skip_rows=0, freq=None, data_type='Video', sep=None)[source]¶
Convert a CSV or Parquet table to zoo format.
- Parameters:
fl (str) – Path to the table file.
extension (str) – File extension/format, must contain
'csv'or'parquet'.skip_rows (int, optional) – Number of header rows to skip when reading a CSV file. Default is 0.
freq (int, optional) – Sampling frequency in Hz. If None, it is inferred from a time column in the table.
data_type ({‘Video’, ‘Analog’}, optional) – Zoo section to store the channels under. Default is ‘Video’.
sep (str, optional) – Column separator for CSV files, passed to
pandas.read_csv.
- Returns:
data (dict) – Zoo dictionary with one channel per table column, plus a ‘zoosystem’ metadata entry.
- Raises:
ValueError – If
extensionis not a supported format, or iffreqis None and no time column can be found to infer it.- Parameters:
- Return type: