neurogeriatricskiel / NGMT

Python based toolbox for processing motion data
https://neurogeriatricskiel.github.io/NGMT/
Other
6 stars 1 forks source link

Gait sequence detection 'GSD_Output' referenced before assignment #66

Closed rmndrs89 closed 3 months ago

rmndrs89 commented 3 months ago

Hi @masoudabedinifar,

see here one of the errors for a single participant, when trying to analyze the Timed Up and Go trials from the Keep Control project. The corresponding notebook can be found here: paper/keepcontrol_tug.ipynb

We should check this for a couple of participants in the Keep Control dataset.

---------------------------------------------------------------------------
UnboundLocalError                         Traceback (most recent call last)
Cell In[127], line 5
      1 gsd = ParaschivIonescuGaitSequenceDetection(
      2     tracking_systems=tracksys,
      3     tracked_points="pelvis"
      4 )
----> 5 gsd = gsd.detect(data=acc_data, sampling_freq_Hz=fs)

File ~/Projects/NGMT/ngmt/modules/gsd/_paraschiv.py:376, in ParaschivIonescuGaitSequenceDetection.detect(self, data, sampling_freq_Hz, plot_results, dt_data)
    373     print("No gait sequence(s) detected.")
    375 # Create a DataFrame from the gait sequence data
--> 376 gait_sequences_ = pd.DataFrame(GSD_Output)
    377 gait_sequences_["onset"] = gait_sequences_["Start"]
    378 gait_sequences_["duration"] = gait_sequences_["End"] - gait_sequences_["Start"]

UnboundLocalError: local variable 'GSD_Output' referenced before assignment

Best regards, Robbin

masoudabedinifar commented 3 months ago

Since the GSD algorithm requires at least 5 consecutive steps to detect the event as a gait sequence, the algorithm fails to identify the gait sequence for this special case. The issue should be solved in a way that 'gait_sequences' in https://github.com/neurogeriatricskiel/NGMT/blob/main/ngmt/modules/icd/_paraschiv.py should be optional.

However, still we can apply ICD to the referred data. For this purpose, we need to change the algorithm in the following way. When 'gait_sequences' are not provided, the ICD should create artificial gait sequences that cover the active parts of the data and then identify initial contacts within defined limits.

masoudabedinifar commented 3 months ago

The issue is closed since it is mentioned here GSD Issues in an organized way.