VirtualHandKinematics#
- class myoverse.datatypes.VirtualHandKinematics(input_data, sampling_frequency)[source]#
Class for storing virtual hand kinematics data from MyoGestic [1].
- Parameters:
input_data (np.ndarray) –
The raw kinematics data for a virtual hand. The shape of the array should be (9, n_samples) or (n_chunks, 9, n_samples).
Important
The class will only accept 2D or 3D arrays.
There is no way to check if you actually have it in (n_chunks, n_samples) or (n_chunks, 9, n_samples) format. Please make sure to provide the correct shape of the data.
sampling_frequency (float) – The sampling frequency of the kinematics data.
- input_data#
The raw kinematics data for a virtual hand. The shape of the array should be (9, n_samples) or (n_chunks, 9, n_samples). The 9 typically represents the degrees of freedom: wrist flexion/extension, wrist pronation/supination, wrist deviation, and the flexion of all 5 fingers.
- Type:
np.ndarray
- processed_data#
A dictionary where the keys are the names of filters applied to the kinematics data and the values are the processed kinematics data.
- Type:
Dict[str, np.ndarray]
Examples
>>> import numpy as np >>> from myoverse.datatypes import VirtualHandKinematics >>> >>> # Create sample virtual hand kinematics data (9 DOFs, 1000 samples) >>> joint_data = np.random.randn(9, 1000) >>> >>> # Create a VirtualHandKinematics object with 100 Hz sampling rate >>> kinematics = VirtualHandKinematics(joint_data, 100) >>> >>> # Access the raw data >>> raw_data = kinematics.input_data >>> print(f"Data shape: {raw_data.shape}")
References
Methods
__init__
(input_data, sampling_frequency)plot
(representation[, nr_of_fingers, ...])Plots the virtual hand kinematics data.
- plot(representation, nr_of_fingers=5, visualize_wrist=True)[source]#
Plots the virtual hand kinematics data.
- Parameters:
representation (str) – The representation to plot. The representation should be a 2D tensor with shape (9, n_samples) or a 3D tensor with shape (n_chunks, 9, n_samples).
nr_of_fingers (int, optional) – The number of fingers to plot. Default is 5.
visualize_wrist (bool, optional) – Whether to visualize wrist movements. Default is True.
- Raises:
KeyError – If the representation does not exist.