imucal.ferraris_regions_from_df#

imucal.ferraris_regions_from_df(df: DataFrame, acc_cols: Iterable[str] | None = ('acc_x', 'acc_y', 'acc_z'), gyr_cols: Iterable[str] | None = ('gyr_x', 'gyr_y', 'gyr_z')) FerrarisSignalRegions[source]#

Create a Calibration object based on a dataframe which has all required sections labeled.

The expected Dataframe has the section label as index and has at least the 6 required data columns. The index must contain all the sections listed in FerrarisCalibration`.FERRARIS_SECTIONS`.

Parameters:
df

6 column dataframe (3 acc, 3 gyro)

acc_cols

The name of the 3 acceleration columns in order x,y,z.

gyr_cols

The name of the 3 acceleration columns in order x,y,z.

Returns:
ferraris_cal_objFerrarisSignalRegions

Examples

>>> import pandas as pd
>>> sampling_rate = 100 #Hz
>>> df = ... # A valid DataFrame with all sections in the index
>>> print(df)
        acc_x acc_y   acc_z  gyr_x  gyr_y  gyr_z
part
x_a   -2052.0 -28.0   -73.0    1.0    0.0   -5.0
x_a   -2059.0 -29.0   -77.0    2.0   -3.0   -5.0
x_a   -2054.0 -25.0   -71.0    3.0   -2.0   -3.0
...       ...   ...     ...    ...    ...    ...
z_rot   -36.0  35.0  2079.0    2.0   -5.0   -2.0
z_rot   -28.0  36.0  2092.0    6.0   -5.0   -4.0
z_rot   -36.0  21.0  2085.0    5.0   -4.0   -4.0
>>> regions = ferraris_regions_from_df(df)
>>> regions
FerrarisSignalRegions(x_a=array([...]), ..., z_rot=array([...]))

Examples using imucal.ferraris_regions_from_df#

Custom Calibration Info Subclass

Custom Calibration Info Subclass

Annotate a session and perform a Ferraris Calibration

Annotate a session and perform a Ferraris Calibration