mobgap.pipeline.iter_gs#

mobgap.pipeline.iter_gs(
data: DataFrame,
region_list: DataFrame,
*,
id_col: str | None = None,
) Iterator[tuple[Region, DataFrame]][source]#

Iterate over the data based on the given gait-sequences.

This will yield a dataframe for each gait-sequence. We assume that the gait-sequences are sorted by start time and contain a start and end column that match the units of the data index.

Parameters:
data

The data to iterate over.

region_list

The list of gait-sequences.

id_col

The name of the column/index level that should be used as the id of the returned Region objects. If None, we try to automatically infer the name. If the input contains wb_id or gs_id, we will use this. When a single index column exists, we will use this. If multiple index columns exist, we will raise an error and you need to specify the column.

Yields:
Region

A named tuple representing the gait-sequence or walking-bout. Note, that only the start, end and id attributes are present. If other columns are present in the region_list, they will be ignored. Independent of the “type” a unique id attribute is present, that represents either the gs_id or the wb_id.

pd.DataFrame

The data of a single gait-sequence/region. Note, that we don’t change the index of the data. If the data was using an index that started at the beginning of the recording, the index (aka .loc) of the individual sequences will still be relative to the beginning of the recording. The first sample in the returned data (aka .iloc) will correctly correspond to the first sample of the GS.