gaitmap.utils.rotations.flip_dataset#
- gaitmap.utils.rotations.flip_dataset(dataset: DataFrame | dict[Union[collections.abc.Hashable, str], pandas.core.frame.DataFrame], rotation: Rotation | dict[str, scipy.spatial.transform._rotation.Rotation]) DataFrame | dict[Union[collections.abc.Hashable, str], pandas.core.frame.DataFrame][source]#
Flip datasets around axis data of a dataset.
This is equivalent to rotating the data, but only 90/180 deg rotations are allowed. With this restriction, we don’t need to actually rotate the data, but can just swap and flip the columns.
This method should be used, when roughly aligning the data to a reference frame, where you usually would only apply 90 deg rotations based on the known rough orientation of the sensor. If you need to apply arbitrary rotations, use
rotate_datasetinstead.- Parameters:
- dataset
dataframe representing a single or multiple sensors. In case of multiple sensors a df with MultiIndex columns is expected where the first level is the sensor name and the second level the axis names (all sensor frame axis must be present)
- rotation
A single rotation or a dict with sensor names as keys and rotations as values. All rotations must only contain 90 deg rotations (i.e. 1 and -1 in the rotation matrix). If this is not the case, use
rotate_datasetinstead.
- Returns:
- flipped dataset
This will always be a copy. The original dataframe will not be modified.
See also
gaitmap.utils.rotations.rotate_datasetFreely rotate a dataset