imucal.ferraris_regions_from_interactive_plot#

imucal.ferraris_regions_from_interactive_plot(data: DataFrame, acc_cols: Iterable[str] = ('acc_x', 'acc_y', 'acc_z'), gyr_cols: Iterable[str] = ('gyr_x', 'gyr_y', 'gyr_z'), title: str | None = None, figsize=(20, 10)) tuple[FerrarisSignalRegions, DataFrame][source]#

Create a Calibration object by selecting the individual signal sections manually in an interactive GUI.

This will open a Tkinter Window that allows you to label the start and the end all required sections for a Ferraris Calibration. See the class docstring for more detailed explanations of these sections.

Parameters:
data

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.

title

Optional title of the plot window

figsize

The initial size of the plot window. If you can not see the toolbar at the bottom, it might help to reduce the figure size.

Returns:
ferraris_cal_objFerrarisSignalRegions
section_listpd.DataFrame

Section list representing the start and stop of each section. It is advised to save this to disk to avoid repeated manual labeling. ferraris_regions_from_section_list can be used to recreate the regions object

Examples

>>> sampling_rate = 100  # Hz
>>> data = ...  # my data as 6 col pandas dataframe
>>> # This will open an interactive plot, where you can select the start and the stop sample of each region
>>> regions, section_list = ferraris_regions_from_interactive_plot(
...     data, sampling_rate=sampling_rate
... )
>>> section_list.to_csv(
...     "./calibration_sections.csv"
... )  # This is optional, but recommended
>>> regions
FerrarisSignalRegions(x_a=array([...]), ..., z_rot=array([...]))