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:

Dict

biomechzoo.conversion.mvnx2zoo_data.mvnx2zoo_data(fl)[source]

Convert an Xsens .mvnx file to zoo format.

Parameters:

fl (str) – Path to the .mvnx file.

Returns:

data (dict) – Zoo dictionary with joint angle and segment orientation channels, foot strike events, and ‘zoosystem’ metadata.

Parameters:

fl (str)

Return type:

Dict

biomechzoo.conversion.mvnx2zoo_data.is_valid_for_zoo(val)[source]

Check whether a value is valid for a MATLAB-compatible zoo structure.

Parameters:

val (Any) – Value to check.

Returns:

valid (bool) – True if the value is valid for a MATLAB-compatible zoo structure (i.e. not None and not an empty list/array).

Parameters:

val (Any)

Return type:

bool

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 .mot inverse-kinematics file.

Raises:

NotImplementedError – Always.

Parameters:

ik_file (str)

Return type:

NoReturn

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 extension is not a supported format, or if freq is None and no time column can be found to infer it.

Parameters:
  • fl (str)

  • extension (str)

  • skip_rows (int)

  • freq (int | None)

  • data_type (str)

  • sep (str | None)

Return type:

Dict