gaitmap.trajectory_reconstruction.SimpleGyroIntegration#
- class gaitmap.trajectory_reconstruction.SimpleGyroIntegration(initial_orientation: ndarray | Rotation = cf(array([0., 0., 0., 1.])), memory: Memory | None = None)[source]#
Integrate Gyro values without any drift correction.
- Parameters:
- initial_orientationRotation or (1 x 4) quaternion array
The initial orientation used. If you pass a array, remember that the order of elements must be x, y, z, w.
- memory
An optional
joblib.Memoryobject that can be provided to cache the results of the integration.
- Other Parameters:
- data
The data passed to the estimate method
- sampling_rate_hz
The sampling rate of this data
- Attributes:
orientation_Orientations as pd.DataFrame.
- orientation_object_
The orientations as a single scipy Rotation object
rotated_data_Rotated data.
See also
gaitmap.trajectory_reconstructionOther implemented algorithms for orientation and position estimation
gaitmap.trajectory_reconstruction.StrideLevelTrajectoryApply the method for each stride of a stride list.
Notes
This class uses Numba as a just-in-time-compiler to achieve fast run times. In result, the first execution of the algorithm will take longer as the methods need to be compiled first.
Examples
Your data must be a pd.DataFrame with at least columns defined by
SF_GYR.>>> import pandas as pd >>> from gaitmap.utils.consts import SF_GYR >>> data = pd.DataFrame(..., columns=SF_GYR) >>> sampling_rate_hz = 100 >>> # Create an algorithm instance >>> sgi = SimpleGyroIntegration(initial_orientation=np.array([0, 0, 0, 1.0])) >>> # Apply the algorithm >>> sgi = sgi.estimate(data, sampling_rate_hz=sampling_rate_hz) >>> # Inspect the results >>> sgi.orientation_ <pd.Dataframe with resulting quaternions> >>> sgi.orientation_object_ <scipy.Rotation object>
Methods
clone()Create a new instance of the class with all parameters copied over.
estimate(data, *, sampling_rate_hz, **_)Estimate the orientation of the sensor by simple integration of the Gyro data.
from_json(json_str)Import an gaitmap object from its json representation.
get_params([deep])Get parameters for this algorithm.
set_params(**params)Set the parameters of this Algorithm.
to_json()Export the current object parameters as json.
- __init__(initial_orientation: ndarray | Rotation = cf(array([0., 0., 0., 1.])), memory: Memory | None = None) None[source]#
- clone() Self[source]#
Create a new instance of the class with all parameters copied over.
This will create a new instance of the class itself and all nested objects
- estimate(data: DataFrame, *, sampling_rate_hz: float, **_) Self[source]#
Estimate the orientation of the sensor by simple integration of the Gyro data.
- Parameters:
- data
Continuous sensor data that includes at least a Gyro. The gyro data is expected to be in deg/s!
- sampling_rate_hz
The sampling rate of the data in Hz
- Returns:
- self
The class instance with all result attributes populated
- classmethod from_json(json_str: str) Self[source]#
Import an gaitmap object from its json representation.
For details have a look at the this example.
You can use the
to_jsonmethod of a class to export it as a compatible json string.- Parameters:
- json_str
json formatted string
- get_params(deep: bool = True) dict[str, Any][source]#
Get parameters for this algorithm.
- Parameters:
- deep
Only relevant if object contains nested algorithm objects. If this is the case and deep is True, the params of these nested objects are included in the output using a prefix like
nested_object_name__(Note the two “_” at the end)
- Returns:
- params
Parameter names mapped to their values.