sollan / alma

Fully automated (rodent) limb motion analysis toolbox for behavioral analysis with bodypart coordinate data, building upon markerless pose estimation.
GNU General Public License v3.0
13 stars 5 forks source link

pca and rfc errors #42

Open krl513 opened 5 months ago

krl513 commented 5 months ago

Hi all,

I'm attempting to run my DLC outputs through ALMA for gait kinematics. Kinematic analysis successfully runs and provides the appropriate output. When attempting the further data analysis options, neither the random forest classifier nor the principal components analysis would successfully run. I received the same error for both RFC and PCA:

Traceback (most recent call last):
  File "C:\Users\ML\anaconda3\envs\alma_38\lib\site-packages\pandas\core\indexes\base.py", line 2646, in get_loc
    return self._engine.get_loc(key)
  File "pandas\_libs\index.pyx", line 111, in pandas._libs.index.IndexEngine.get_loc
  File "pandas\_libs\index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc
  File "pandas\_libs\hashtable_class_helper.pxi", line 1619, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas\_libs\hashtable_class_helper.pxi", line 1627, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'cycle duration (no. frames)'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\Kate\alma\alma\Panels\PCA.py", line 218, in PCA
    combined_df = DataAnalysisFunctions.combine_files(file_lists, group_names, self.output_path, 'average')
  File "E:\Kate\alma\alma\Functions\DataAnalysisFunctions.py", line 36, in combine_files
    df = df[df['cycle duration (no. frames)'] >= 0]
  File "C:\Users\ML\anaconda3\envs\alma_38\lib\site-packages\pandas\core\frame.py", line 2800, in __getitem__
    indexer = self.columns.get_loc(key)
  File "C:\Users\ML\anaconda3\envs\alma_38\lib\site-packages\pandas\core\indexes\base.py", line 2648, in get_loc
    return self._engine.get_loc(self._maybe_cast_indexer(key))
  File "pandas\_libs\index.pyx", line 111, in pandas._libs.index.IndexEngine.get_loc
  File "pandas\_libs\index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc
  File "pandas\_libs\hashtable_class_helper.pxi", line 1619, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas\_libs\hashtable_class_helper.pxi", line 1627, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'cycle duration (no. frames)'

It seems like the error is related to the amount/quality of data I am trying to use (the videos used were a bit short and mice were poorly trained to walk on the treadmill). Can someone please explain why I am seeing this error? Why is ALMA capable of successfully extracting the kinematic parameters but no further analysis? Thank you!

sollan commented 4 months ago

Hi, it looks like you're inputting some file(s) that do not contain a "cycle duration (no. frames)" column. Hence the KeyError.

Can you please double check that the folders you're using as the path to the input files for data analysis do not contain any file that is not an output from the parameter extraction by ALMA?

Best, Annette