Api

gaitalytics.api.load_config(config_path: Path | str) MappingConfigs

Loads the mapping configuration file.

Args:

config_path: The path to the configuration file.

Returns:

A MappingConfigs object.

gaitalytics.api.load_c3d_trial(c3d_file: Path | str, configs: MappingConfigs) Trial

Loads a Trial from a c3d file.

Be aware that all the required data for the trial must be present in the c3d file. i.e. markers, analogs, events, etc.

Args:

c3d_file: The path to the c3d file. configs: The mapping configurations

Returns:

A Trial object.

gaitalytics.api.detect_events(trial: Trial, config: MappingConfigs, method: str = 'Marker', **kwargs) DataFrame

Detects the events in the trial.

Args:

trial: The trial to detect the events for. config: The mapping configurations method: The method to use for detecting the events. Currently, only “Marker” is supported, which implements the method from Zenis et al. 2006. Default is “Marker”.

Returns:

A DataFrame containing the detected events.

gaitalytics.api.check_events(event_table: DataFrame, method: str = 'sequence')

Checks the events in the trial.

Args:

event_table: The event table to check. method: The method to use for checking the events. Currently, only supports “sequence” which checks the sequence of events in terms of context and label. Default is “sequence”.

Returns:

The trial with the checked events.

gaitalytics.api.write_events_to_c3d(c3d_path: Path | str, event_table: DataFrame, output_path: Path | str | None = None)

Writes the events to the c3d file.

Args:

c3d_path: The path to the original c3d file. event_table: The DataFrame containing the events. output_path: The path to write the c3d file with the events. If None, the original file will be overwritten.

gaitalytics.api.segment_trial(trial: Trial, method: str = 'HS') TrialCycles

Segments the trial into cycles

Args:

trial: The trial to segment. method: The method to use for segmenting the trial. Currently, only supports “HS” which segments the trial based on heel strikes. Default is “HS”.

Returns:

The trial with the segmented data.

gaitalytics.api.time_normalise_trial(trial: Trial | TrialCycles, method: str = 'linear', **kwargs) Trial | TrialCycles

Normalises the time in the trial.

Args:

trial: The trial to normalise the time for. method: The method to use for normalising the time. Currently, only supports “linear” which normalises the time linearly. Default is “linear”.

Returns:

The trial with the normalised time.

gaitalytics.api.calculate_features(trial: ~gaitalytics.model.TrialCycles, config: ~gaitalytics.mapping.MappingConfigs, methods: list | tuple = (<class 'gaitalytics.features.TimeSeriesFeatures'>, <class 'gaitalytics.features.PhaseTimeSeriesFeatures'>, <class 'gaitalytics.features.TemporalFeatures'>, <class 'gaitalytics.features.SpatialFeatures'>), **kwargs) DataArray

Calculates the features of the trial.

Args:

trial: The trial to calculate the features for. config: The mapping configurations methods: Class objects of the feature calculation methods to use.

Returns:

The trial with the calculated features.

gaitalytics.api.export_trial(trial: Trial | TrialCycles, output_path: Path | str, method: str = 'netcdf')

Exports the trial to a c3d file.

This function will create a folder and save the trial as NetCDF files. Depending on the trial following files will be written:

  • markers.nc

  • analogs.nc

  • analysis.nc

  • events.nc

Warning

Currently events are not exported for segmented Trials.

Args:

trial: The trial to export. output_path: The path to write the c3d file. method: The method to use for exporting the trial. Currently, only supports “netcdf”.