From ef8c906f4ff5f7398878ff7ff8b7c3b779370b63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20K=C3=BCderle?= Date: Thu, 22 Jun 2023 16:07:35 +0200 Subject: [PATCH] Removed invalid strides from egait Segmentation validation --- CHANGELOG.md | 6 ++++++ .../egait_segmentation_validation_2014/helper.py | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6508e13..3001d86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) (+ the Migration Guide), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Fixed +- The egait segmentation validation dataset contained strides that had negative duration. + We now remove them during loading. + ## [0.12.0] - 2023-04-27 ### Added diff --git a/gaitmap_datasets/egait_segmentation_validation_2014/helper.py b/gaitmap_datasets/egait_segmentation_validation_2014/helper.py index 27c244a..4c1d8a3 100644 --- a/gaitmap_datasets/egait_segmentation_validation_2014/helper.py +++ b/gaitmap_datasets/egait_segmentation_validation_2014/helper.py @@ -129,7 +129,7 @@ def get_original_segmented_stride_list( if file_path is None: stride_borders[sensor] = None continue - stride_borders[sensor] = ( + tmp = ( pd.read_csv( file_path, skiprows=8, @@ -138,6 +138,10 @@ def get_original_segmented_stride_list( .rename(columns={"Start": "start", "End": "end"}) .rename_axis(index="s_id") ) + # for some reason some strides have negative durations, which is obviously wrong. + # We will just drop them. + tmp = tmp[tmp["end"] > tmp["start"]] + stride_borders[sensor] = tmp return stride_borders