Skip to content

data

Data classes for storing device and acquisition data.

AcquisitionData dataclass

Data class for storing the complete acquisition result, including IMU samples, device information, and acquisition configuration.

Attributes:

  • samples (list[IMUSample]) –

    List of IMU samples.

  • device (DeviceInfo) –

    Device information.

  • config (Config) –

    Acquisition configuration.

  • start_time (datetime) –

    Start time of the acquisition.

  • skipped_samples (int) –

    Number of skipped samples due to acquisition issues.

  • csv_path (Optional[str]) –

    Path to the CSV file containing the data. Used if the data was loaded from a file.

  • duration (float) –

    Duration of the acquisition in seconds.

  • num_samples (int) –

    Number of samples in the acquisition.

  • integrity (bool) –

    Whether the acquisition has integrity (no skipped samples).

Methods:

  • to_csv

    Write the data to a CSV file.

  • from_csv

    Load the data from a CSV file.

from_csv(path) classmethod

Load the data from a CSV file.

Parameters:

  • path (str) –

    Path to the CSV file.

Returns:

Raises:

  • ValueError

    If an error occurs while parsing the CSV file.

re_centre(index)

Re-centre the data around a specific index.

Parameters:

  • index (int) –

    The index to re-centre the data around.

to_csv(path)

Write the data to a CSV file.

Parameters:

  • filename

    Path to the CSV file.

ConfigEnum

Bases: Enum

Base class for configuration enums. Each member has two elements: an index and a parameter value. Parameter value can be either an integer or a float.

Attributes:

  • index (int) –

    Index of the member.

  • param_value (Union[float, int]) –

    Parameter value of the member.

Methods:

  • from_index

    Return member with specified index.

  • from_param_value

    Return member with specified parameter value.

  • find_closest

    Return member with parameter value closest to specified value.

find_closest(value) classmethod

Return member with parameter value closest to specified value.

from_index(index) classmethod

Return member with specified index.

from_param_value(value, tolerance=1e-05) classmethod

Return member with specified parameter value.

IMUSample dataclass

Data class for storing a single IMU sample.

Attributes:

  • count (int) –

    Sample count.

  • acc_x (float) –

    Accelerometer X value.

  • acc_y (float) –

    Accelerometer Y value.

  • acc_z (float) –

    Accelerometer Z value.

  • gyro_x (float) –

    Gyroscope X value.

  • gyro_y (float) –

    Gyroscope Y value.

  • gyro_z (float) –

    Gyroscope Z value.