### Install dependencies and run checks Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/contributing.md After making changes, install all dependencies and run code checks and tests. This ensures code quality and functionality. ```bash pixi install --all pixi run check-code pixi run -e dev test-api pixi run -e dev test-full ``` -------------------------------- ### Example Configuration File Structure Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/usage/data_loading.md This YAML file defines the mapping of model marker names to internal marker names and specifies which markers and analogs to analyze. Ensure all mandatory fields are present. ```yaml mapping: markers: # Foot l_heel: "ExampleHeelMarker" r_heel: "ExampleHeelMarker" l_toe: "ExampleToeMarker" r_toe: "ExampleToeMarker" l_toe_2: "ExampleSecondaryToeMarker" # optional r_toe_2: "ExampleSecondaryToeMarker" # optional l_lat_malleoli: "ExampleMalleoliMarker" # optional r_lat_malleoli: "ExampleMalleoliMarker" # optional # Hip l_ant_hip: "ExampleHipMarker" r_ant_hip: "ExampleHipMarker" l_post_hip: "ExampleHipMarker" # optional r_post_hip: "ExampleHipMarker" # optional sacrum: "ExampleSacrumMarker" # optional xcom: "ExampleXCOMMarker" # optional # Entities to analyse analysis: markers: # Markers to analyse # List of modelled markers to analyse - "ExampleAngle1" - "ExampleGRF" - "ExampleForce2" analogs: # List of analog channels to analyse - "ExampleForce3" ``` -------------------------------- ### Install Gaitalytics with Pip Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/README.rst Install the Gaitalytics package using pip. This is an alternative installation method. ```shell pip install gaitalytics ``` -------------------------------- ### Gaitalytics Simple Pipeline Example Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/README.rst A Python script demonstrating a basic Gaitalytics pipeline: loading configuration and trial data, detecting and checking events, segmenting the trial, calculating features, normalizing time, and exporting results. ```python from gaitalytics import api # Load configuration (yaml file from above) config = api.load_config("./pig_config.yaml") # Load trial from c3d file trial = api.load_c3d_trial("./test_small.c3d", config) # Detect events events = api.detect_events(trial, config) try: # check events api.check_events(events) # write events to c3d in the same file api.write_events_to_c3d("./test_small.c3d", events, './test.c3d') # add events to trial trial.events = events # segment trial to gait cycles. (Events are already existing in the c3d file) trial_segmented = api.segment_trial(trial) # calculate features features = api.calculate_features(trial_segmented, config) # normalise time trial_normalized = api.time_normalise_trial(trial_segmented) # save features features.to_netcdf("features.nc") # export segmented trial to netcdf api.export_trial(trial_segmented, "output_segments") api.export_trial(trial_normalized, "output_norm") except ValueError as e: print(e) ``` -------------------------------- ### Load c3d File with Configuration Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/usage/data_loading.md Use this snippet to load a c3d file and its corresponding configuration file. Ensure you have the `gaitalytics` library installed and the configuration file (`config.yaml`) and c3d file (`example.c3d`) are in the specified paths. ```python from gaitalytics import api config = api.load_config("./config.yaml") trial = api.load_c3d_trial("./example.c3d", config) ``` -------------------------------- ### Install Gaitalytics with Conda Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/README.rst Install the Gaitalytics package using Conda. This is a fast installation method. ```shell conda install gaitalytics -c DartLab-LLUI ``` -------------------------------- ### Load Configuration and Detect Gait Events Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/usage/event_detection.md Illustrates the basic usage of loading configuration and C3D trial data, followed by detecting gait events. Ensure the configuration file and C3D file paths are correct. ```python from gaitalytics import api config = api.load_config("./config.yaml") trial = api.load_c3d_trial("./example.c3d", config) events = api.detect_events(trial, config) ``` -------------------------------- ### Load Configuration, Trial, Segment, and Calculate Features Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/usage/features.md This snippet demonstrates the core workflow for feature extraction. It involves loading a configuration file, a C3D trial, segmenting the trial, and then calculating the features based on the configuration. ```python from gaitalytics import api config = api.load_config("./config.yaml") trial = api.load_c3d_trial("./example_with_events.c3d", config) segmented_trial = api.segment_trial(trial) features = api.calculate_features(segmented_trial, config) ``` -------------------------------- ### Load Configuration File Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/usage/data_loading.md Load the configuration file before loading the C3D trial. This configuration is mandatory for the library to function correctly. ```python from gaitalytics import api config = api.load_config("./config.yaml") ``` -------------------------------- ### Clone the forked repository Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/contributing.md Clone your forked repository locally to begin development. Replace YOURGITHUBNAME with your actual GitHub username. ```bash git clone git@github.com:YOURGITHUBNAME/python-gaitalytics.git ``` -------------------------------- ### Run Full Tests Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/CONTRIBUTING.rst Ensure all tests pass before submitting a pull request. This includes API and full test suites. ```bash pixi run -e dev test-full ``` ```bash pixi run -e dev test-api ``` -------------------------------- ### LinearTimeNormaliser.__init__ Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/reference/normalisation.md Initializes a new instance of the LinearTimeNormaliser class, setting the target number of frames for time normalisation. ```APIDOC ## LinearTimeNormaliser.__init__ ### Description Initializes a new instance of the LinearTimeNormaliser class. This constructor sets up the normaliser with a specified number of frames to which the data will be time-normalised. ### Method `__init__` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **n_frames** (int) - Optional - The number of frames to time-normalise the data to. Defaults to 100. ### Returns None ### Request Example None ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Simple Gaitalytics Analysis Pipeline Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/index.md This Python script demonstrates a basic workflow for gait analysis using Gaitalytics, including loading data, detecting and checking events, segmenting trials, calculating features, normalizing time, and exporting results. ```python from gaitalytics import api # Load configuration (yaml file from above) config = api.load_config("./pig_config.yaml") # Load trial from c3d file trial = api.load_c3d_trial("./test_small.c3d", config) # Detect events events = api.detect_events(trial, config) try: # check events api.check_events(events) # write events to c3d in the same file api.write_events_to_c3d("./test_small.c3d", events, './test.c3d') # add events to trial trial.events = events # segment trial to gait cycles. (Events are already existing in the c3d file) trial_segmented = api.segment_trial(trial) # calculate features features = api.calculate_features(trial_segmented, config) # normalise time trial_normalized = api.time_normalise_trial(trial_segmented) # save features features.to_netcdf("features.nc") # export segmented trial to netcdf api.export_trial(trial_segmented, "output_segments") api.export_trial(trial_normalized, "output_norm") except ValueError as e: print(e) ``` -------------------------------- ### trial_from_hdf5 Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/reference/model.md Loads trial data from an HDF5 file, capable of loading both single trials and segmented trials. ```APIDOC ## trial_from_hdf5 ### Description Loads trial data from an HDF5 file. Can be used to load a single trial or a segmented trial after saving it. ### Method `trial_from_hdf5` ### Parameters #### Path Parameters - **file_path** (Path) - Required - The path to the HDF5 file or folder with the expected structure. ### Returns - **Trial | TrialCycles**: A new instance of the Trial class if file_path is a single file, or a new instance of the TrialCycles class if file_path is a folder. ``` -------------------------------- ### Minimal Gaitalytics Configuration Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/README.rst A minimal YAML configuration file for Gaitalytics, defining markers for analysis and mapping them to specific labels. ```yaml analysis: markers: - "LHipAngles" - "LKneeAngles" - "LAnkleAngles" - "LPelvisAngles" - "LThoraxAngles" mapping: markers: # Foot l_heel: "LHEE" r_heel: "RHEE" l_toe: "LTOE" r_toe: "RTOE" # Hip l_ant_hip: "LASI" r_ant_hip: "RASI" l_post_hip: "LPSI" r_post_hip: "RPSI" sacrum: "SACR" ``` -------------------------------- ### Commit and push changes Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/contributing.md Commit your changes with a descriptive message and push the branch to your GitHub fork. This prepares your changes for a pull request. ```bash git add . git commit -m "Your detailed description of your changes." git push origin name-of-your-bugfix-or-feature ``` -------------------------------- ### TrialCycles.get_cycles_per_context Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/reference/model.md Retrieves all cycles belonging to a specific context within the segmented trial. ```APIDOC ## TrialCycles.get_cycles_per_context ### Description Gets all cycles from the segmented trial for a specific context. ### Method `get_cycles_per_context` ### Parameters #### Path Parameters - **context** (str) - Required - The context of the cycles. ### Returns - **dict[int, Trial]**: A dictionary containing all cycles for the specified context, keyed by cycle number. ``` -------------------------------- ### Loading Trial Data from HDF5 in Gaitalytics Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/usage/export.md Use `model.trial_from_hdf5()` to load data previously exported using `to_hdf5()`. This function reconstructs the `Trial` or `TrialCycles` objects. ```python from gaitalytics import api, model trial = model.trial_from_hdf5("./export_trial.h5") segmented_trial = model.trial_from_hdf5("./export_segmented_trial.h5") ``` -------------------------------- ### Store Detected Events to the Existing C3D File Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/usage/event_detection.md Illustrates overwriting the existing C3D file with the detected gait events. Use with caution, as this modifies the original file. ```python from gaitalytics import api events = api.detect_events(trial) api.write_events_to_c3d("./example.c3d", events, './example.c3d') ``` -------------------------------- ### Time Normalise Trial Data Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/usage/normalisation.md Loads configuration and C3D trial data, segments it, and then time normalises the segmented trial. This is useful for comparing trials of different durations. ```python from gaitalytics import api config = api.load_config("./config.yaml") trial = api.load_c3d_trial("./example_with_events.c3d", config) segmented_trial = api.segment_trial(trial) normalised_trial = api.time_normalise_trial(segmented_trial) ``` -------------------------------- ### Exporting Trial Data to HDF5 for Gaitalytics Usage Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/usage/export.md Use `to_hdf5()` to export `Trial` or `TrialCycles` objects for later use within Gaitalytics. This method stores data in a format optimized for Gaitalytics. ```python from gaitalytics import api config = api.load_config("./config.yaml") trial = api.load_c3d_trial("./example_with_events.c3d", config) trial.to_hdf5("./export_trial.h5") segmented_trial = api.segment_trial(trial) segmented_trial.to_hdf5("./export_segmented_trial.h5") ``` -------------------------------- ### Segment Gait Data (Heel Strike to Heel Strike) Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/usage/segmentation.md Segments a loaded trial into gait cycles based on heel strike events. Ensure the trial data contains gait events. ```python from gaitalytics import api config = api.load_config("./config.yaml") trial = api.load_c3d_trial("./example_with_events.c3d", config) segmented_trial = api.segment_trial(trial) ``` -------------------------------- ### Trial.get_all_data Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/reference/model.md Retrieves all data arrays stored within the trial, organized by category. ```APIDOC ## Trial.get_all_data ### Description Gets all data from the trial. ### Method `get_all_data` ### Returns - **dict[DataCategory, DataArray]**: A dictionary containing all the data arrays, keyed by their DataCategory. ``` -------------------------------- ### Trial.add_data Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/reference/model.md Adds data to the trial, categorized by DataCategory. ```APIDOC ## Trial.add_data ### Description Adds data to the trial. ### Method `add_data` ### Parameters #### Path Parameters - **category** (DataCategory) - Required - The category of the data. - **data** (DataArray) - Required - The data array to be added. ``` -------------------------------- ### TrialCycles.get_all_cycles Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/reference/model.md Retrieves all cycles stored within the segmented trial, organized by context and cycle ID. ```APIDOC ## TrialCycles.get_all_cycles ### Description Gets all cycles from the segmented trial. ### Method `get_all_cycles` ### Returns - **dict[str, dict[int, Trial]]**: A nested dictionary containing all cycles. The outer dictionary is keyed by context, and the inner dictionary is keyed by cycle number. ``` -------------------------------- ### Exporting Trial Data to NetCDF for External Use Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/usage/export.md Use `api.export_trial()` to export `Trial` or `TrialCycles` objects to a netCDF file for use with external libraries like xarray. This is suitable for data intended for analysis outside of Gaitalytics. ```python from gaitalytics import api config = api.load_config("./config.yaml") trial = api.load_c3d_trial("./example_with_events.c3d", config) api.export_trial(trial, "./export_trial.nc") segmented_trial = api.segment_trial(trial) api.export_trial(segmented_trial, "./export_segmented_trial.nc") ``` -------------------------------- ### Check Detected Gait Events for Errors Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/usage/event_detection.md Demonstrates how to use the `check_events` function to validate the sequence of detected gait events. Catches and prints `ValueError` if sequence errors are found. ```python from gaitalytics import api events = api.detect_events(trial) try: api.check_events(events) except ValueError as e: print(f"Event errors {e}") ``` -------------------------------- ### MappingConfigs Class Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/reference/mapping.md A class for reading and managing marker mapping configurations from a YAML file. It allows retrieval of markers and analogs for analysis. ```APIDOC ## gaitalytics.mapping.MappingConfigs A class for reading the mapping configuration file. This class provides methods to read the mapping configuration file and get the markers and analogs for analysis. ### __init__(config_path: Path) Initializes a new instance of the MappingConfigs class. Reads the yaml file into memory. #### Parameters - **config_path** (Path) - Required - The path to the configuration file. ### get_analogs_analysis() -> list[str] Gets the analogs for analysis. #### Returns list[str] - A list of analog names to be used for analysis if present in the config file, otherwise an empty list. #### Raises - **ValueError** - If the analysis section is missing in the config file. ### get_marker_mapping(marker: MappedMarkers) -> str Gets the mapping of markers. #### Parameters - **marker** (MappedMarkers) - Required - The marker to get the mapping for. #### Returns str - The mapped marker name if present in the config file. #### Raises - **ValueError** - If sections in the mapping are missing in the config file. ### get_markers_analysis() -> list[str] Gets the markers for analysis. #### Returns list[str] - A list of marker names to be used for analysis if present in the config file, otherwise an empty list. #### Raises - **ValueError** - If the analysis section is missing in the config file. ``` -------------------------------- ### Trial.add_channel Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/reference/model.md Adds a channel (data array) to the trial, categorized by DataCategory. ```APIDOC ## Trial.add_channel ### Description Adds a channel to the trial. ### Method `add_channel` ### Parameters #### Path Parameters - **category** (DataCategory) - Required - The category of the data. - **data** (DataArray) - Required - The data array to be added. ``` -------------------------------- ### Loading NetCDF Data with Xarray Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/usage/export.md Load netCDF files exported by `api.export_trial()` using the `xarray.load_dataarray` function. This allows for easy integration with xarray for further analysis. ```python import xarray as xr trial = xr.load_dataarray("./export_trial.nc") segmented_trial = xr.load_dataarray("./export_segmented_trial.nc") ``` -------------------------------- ### Store Detected Events to a New C3D File Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/usage/event_detection.md Shows how to write the detected gait events into a new C3D file. The function reloads the original file and saves the events to the specified output path. ```python from gaitalytics import api events = api.detect_events(trial) api.write_events_to_c3d("./example.c3d", events, './example_with_events.c3d') ``` -------------------------------- ### BaseTrial.to_hdf5 Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/reference/model.md Saves the trial data to an HDF5 file. This method is part of the abstract base class for trials, providing a common interface for saving data. ```APIDOC ## BaseTrial.to_hdf5 ### Description Saves the trial data to an HDF5 file. ### Method `to_hdf5` ### Parameters #### Path Parameters - **file_path** (Path) - Required - The path to the HDF5 file. - **base_group** (str | None) - Optional - The base group to save the data. Defaults to None, saving data to the root of the file. ### Raises - **FileExistsError**: If the file already exists. - **ValueError**: If the trial is a segmented trial and the file path is a single file. - **ValueError**: If the trial is a trial and the file path is a folder. ``` -------------------------------- ### Create a new branch for development Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/contributing.md Create a new branch for your bug fix or feature development. This isolates your changes from the main codebase. ```bash git checkout -b name-of-your-bugfix-or-feature ``` -------------------------------- ### Trial.get_data Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/reference/model.md Retrieves a specific data array from the trial based on its category. ```APIDOC ## Trial.get_data ### Description Gets the data from the trial for a specific category. ### Method `get_data` ### Parameters #### Path Parameters - **category** (DataCategory) - Required - The category of the data to retrieve. ``` -------------------------------- ### Time Normalisation Function Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/usage/normalisation.md Demonstrates how to use the `time_normalise_trial` function to normalise segmented trial data. The function returns a `TrialCycles` object containing normalised trials. ```APIDOC ## `gaitalytics.api.time_normalise_trial()` ### Description Normalises segmented trial data to a specified number of frames. This function is useful for comparing trials of different durations. ### Method `api.time_normalise_trial(segmented_trial, n_frames=100)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **segmented_trial** (`gaitalytics.model.TrialCycles`) - Required - The segmented trial data to be normalised. - **n_frames** (int) - Optional - The target number of frames for the normalised time series. Defaults to 100. ### Request Example ```python from gaitalytics import api config = api.load_config("./config.yaml") trial = api.load_c3d_trial("./example_with_events.c3d", config) segmented_trial = api.segment_trial(trial) normalised_trial = api.time_normalise_trial(segmented_trial, n_frames=150) ``` ### Response #### Success Response (200) - **normalised_trial** (`gaitalytics.model.TrialCycles`) - A dictionary where keys are cycle numbers and values are `Trial` objects, each normalised to `n_frames`. #### Response Example ```json { "1": { "frames": [ { "marker_data": { "L.Shoulder": [1.0, 2.0, 3.0] } }, { "marker_data": { "L.Shoulder": [1.1, 2.1, 3.1] } }, // ... more frames up to n_frames ] }, "2": { "frames": [ { "marker_data": { "L.Shoulder": [1.5, 2.5, 3.5] } }, // ... more frames up to n_frames ] } } ``` ``` -------------------------------- ### TrialCycles.add_cycle Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/reference/model.md Adds a cycle segment to the segmented trial, identified by context and cycle ID. ```APIDOC ## TrialCycles.add_cycle ### Description Adds a Cycle to the segmented trial. ### Method `add_cycle` ### Parameters #### Path Parameters - **context** (str) - Required - The context of the cycle. - **cycle_id** (int) - Required - The id of the cycle. - **segment** (Trial) - Required - The segment (Trial object) to be added. ``` -------------------------------- ### Trial.events Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/reference/model.md Retrieves the events associated with the trial as a pandas DataFrame. ```APIDOC ## Trial.events ### Description Gets the events in the trial. ### Method `events` (property) ### Returns - **DataFrame | None**: A pandas DataFrame containing the events if present, otherwise None. ``` -------------------------------- ### TrialCycles.get_cycle Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/reference/model.md Retrieves a specific cycle from the segmented trial using its context and cycle ID. ```APIDOC ## TrialCycles.get_cycle ### Description Gets a specific cycle from the segmented trial. ### Method `get_cycle` ### Parameters #### Path Parameters - **context** (str) - Required - The context of the cycle. - **cycle_id** (int) - Required - The id of the cycle. ### Raises - **KeyError**: If the cycle does not exist. ``` -------------------------------- ### BaseNormaliser.normalise Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/reference/normalisation.md Abstract method to normalise input data. This serves as a common interface for all normalisers. ```APIDOC ## BaseNormaliser.normalise ### Description Normalises the input data. This method is intended to be implemented by subclasses to provide specific normalisation strategies. ### Method `normalise` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **trial** ([Trial](model.md#gaitalytics.model.Trial) | [TrialCycles](model.md#gaitalytics.model.TrialCycles)) - The trial to be normalised. ### Returns * **Trial** | **TrialCycles** - A new trial containing the normalised data. ### Request Example None ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### MappedMarkers Enum Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/reference/mapping.md Defines the standard markers that can be mapped in the Gaitalytics configuration file. Each marker is represented as a string. ```APIDOC ## gaitalytics.mapping.MappedMarkers This defines the markers that are mapped in the configuration file. ### Members - **L_HEEL** (str) - Left heel marker - **R_HEEL** (str) - Right heel marker - **L_TOE** (str) - Left toe marker - **R_TOE** (str) - Right toe marker - **L_ANKLE** (str) - Left ankle marker - **R_ANKLE** (str) - Right ankle marker - **L_TOE_2** (str) - Left toe 2 marker - **R_TOE_2** (str) - Right toe 2 marker - **L_ANT_HIP** (str) - Left anterior hip marker - **R_ANT_HIP** (str) - Right anterior hip marker - **L_POST_HIP** (str) - Left posterior hip marker - **R_POST_HIP** (str) - Right posterior hip marker - **SACRUM** (str) - Sacrum marker - **XCOM** (str) - Extrapolated center of mass marker ``` -------------------------------- ### Define a New Feature Class Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/extend/features.md Create a new class that inherits from PointDependentFeature to implement custom feature calculations. Override the _calculate method to define your feature's logic. ```python from gaitalytics.features import PointDependentFeature class NewFeature(PointDependentFeature): def _calculate(self, cycle): # Your feature calculation here return feature_value ``` -------------------------------- ### LinearTimeNormaliser.normalise Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/reference/normalisation.md Normalises the gait data based on time to a fixed number of frames. ```APIDOC ## LinearTimeNormaliser.normalise ### Description Normalises the data based on time, resampling it to a consistent number of frames. This is useful for comparing trials of different durations. ### Method `normalise` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **trial** ([Trial](model.md#gaitalytics.model.Trial) | [TrialCycles](model.md#gaitalytics.model.TrialCycles)) - The trial to be normalised. ### Returns * **Trial** | **TrialCycles** - A new trial containing the time-normalised data. ### Request Example None ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Calculate Custom Features Source: https://github.com/dart-lab-llui/python-gaitalytics/blob/main/docs/extend/features.md Include your custom feature class in the list of features to be calculated by gaitalytics.api.calculate_features. This allows Gaitalytics to compute your new feature alongside existing ones. ```python from gaitalytics import api from gaitalytics.features import NewFeature config = api.load_config("./config.yaml") trial = api.load_c3d_trial("./example.c3d", config) # Calculate the only the new feature features = api.calculate_features(trial, config, [NewFeature]) # Calculate all features including the new feature features = api.calculate_features(trial, config, [gaitalytics.features.TimeSeriesFeatures, gaitalytics.features.PhaseTimeSeriesFeatures, gaitalytics.features.TemporalFeatures, gaitalytics.features.SpatialFeatures, NewFeature]) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.