parse_reference_parameters#
- mobgap.data.parse_reference_parameters(
- ref_data: list[dict[str, str | float | int | ndarray]],
- *,
- ref_sampling_rate_hz: float,
- data_sampling_rate_hz: float,
- relative_to_wb: bool = False,
Parse the reference data (stored per WB) into the per recording data structures used in mobgap.
Note
This expects the reference for only onw of the WB levels as input (i.e.
reference_data["wb"]notreference_data).This does the following:
Using the wb start and end values to build a list of reference gait sequences.
Concatenate all initial contacts into a single list.
Concatenate all turn parameters into a single list.
Concatenate all stride parameters into a single list.
All time values are converted from seconds to samples of the single sensor system since the start of the recording
Further, we drop all strides and ICs that have a NaN value, as this has no meaning outside the context of the reference system. However, all strides that have NaNs for other parameters are kept.
This function is also the place to fix some of the inconsistencies in the reference data format. Things that are currently fixed here:
The reference start-end values for each stride for the INDIP system are provided in samples, not in seconds. This is handled here, and independent of the reference system, we correctly convert all values into samples.
Drop duplicate ICs and strides.
- Parameters:
- ref_data
The raw reference data for one of the WB levels.
- ref_sampling_rate_hz
The sampling rate of the reference data in Hz. This is required to convert the values that are provided in samples of the reference system into samples of the single sensor system.
- data_sampling_rate_hz
The sampling rate of the raw data in Hz. This is used to convert values that are provided in seconds into samples.
- relative_to_wb
Whether to convert all values to be relative to the start of each individual WB. This will of course not affect the WB start and end values, but all other values (events, strides, …) will be converted.
- Returns:
- ReferenceData
A named tuple with the parsed reference data. See
ReferenceDatafor details.
See also
ParsedReferenceDataThe output data structure.