autogaita 1.0.4__tar.gz → 1.0.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. {autogaita-1.0.4 → autogaita-1.0.6}/PKG-INFO +1 -1
  2. autogaita-1.0.6/autogaita/batchrun_scripts/group_dlcrun.py +112 -0
  3. autogaita-1.0.6/autogaita/batchrun_scripts/group_dlcrun_forpaper.py +151 -0
  4. autogaita-1.0.6/autogaita/batchrun_scripts/group_universal3Drun.py +139 -0
  5. autogaita-1.0.4/autogaita/batchrun_scripts/group_universal3Drun.py → autogaita-1.0.6/autogaita/batchrun_scripts/group_universal3Drun_backup.py +3 -0
  6. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/batchrun_scripts/universal3D_multirun.py +6 -1
  7. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/batchrun_scripts/universal3D_singlerun.py +7 -2
  8. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/common2D/common2D_3_analysis.py +12 -9
  9. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/dlc/dlc_1_preparation.py +1 -1
  10. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/group/group_1_preparation.py +50 -34
  11. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/group/group_2_data_processing.py +72 -3
  12. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/group/group_3_PCA.py +2 -0
  13. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/group/group_4_stats.py +2 -2
  14. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/group/group_main.py +23 -19
  15. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/group/group_utils.py +4 -0
  16. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/gui/dlc_gui.py +5 -3
  17. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/gui/group_gui.py +109 -63
  18. autogaita-1.0.6/autogaita/gui/group_gui_config.json +121 -0
  19. autogaita-1.0.6/autogaita/gui/gui_utils.py +51 -0
  20. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/gui/sleap_gui.py +4 -2
  21. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/gui/universal3D_gui.py +141 -46
  22. autogaita-1.0.6/autogaita/gui/universal3D_gui_config.json +66 -0
  23. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/gui/window_2D_advanced_config.py +13 -11
  24. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/sleap/sleap_1_preparation.py +3 -8
  25. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/universal3D/universal3D_1_preparation.py +79 -14
  26. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/universal3D/universal3D_3_analysis.py +114 -32
  27. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita.egg-info/PKG-INFO +1 -1
  28. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita.egg-info/SOURCES.txt +2 -0
  29. {autogaita-1.0.4 → autogaita-1.0.6}/setup.py +1 -1
  30. {autogaita-1.0.4 → autogaita-1.0.6}/tests/test_common2D_unit_3_main_analysis.py +14 -9
  31. {autogaita-1.0.4 → autogaita-1.0.6}/tests/test_group_approval.py +39 -8
  32. autogaita-1.0.6/tests/test_group_unit.py +334 -0
  33. autogaita-1.0.4/autogaita/batchrun_scripts/group_dlcrun.py +0 -206
  34. autogaita-1.0.4/autogaita/gui/group_gui_config.json +0 -41
  35. autogaita-1.0.4/autogaita/gui/gui_utils.py +0 -92
  36. autogaita-1.0.4/autogaita/gui/universal3D_gui_config.json +0 -54
  37. autogaita-1.0.4/tests/test_group_unit.py +0 -133
  38. {autogaita-1.0.4 → autogaita-1.0.6}/LICENSE +0 -0
  39. {autogaita-1.0.4 → autogaita-1.0.6}/README.md +0 -0
  40. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/__init__.py +0 -0
  41. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/__main__.py +0 -0
  42. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/batchrun_scripts/__init__.py +0 -0
  43. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/batchrun_scripts/dlc_multirun.py +0 -0
  44. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/batchrun_scripts/dlc_singlerun.py +0 -0
  45. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/batchrun_scripts/sleap_singlerun.py +0 -0
  46. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/common2D/__init__.py +0 -0
  47. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/common2D/common2D_4_plots.py +0 -0
  48. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/common2D/common2D_constants.py +0 -0
  49. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/common2D/common2D_utils.py +0 -0
  50. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/dlc/__init__.py +0 -0
  51. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/dlc/dlc_2_sc_extraction.py +0 -0
  52. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/dlc/dlc_main.py +0 -0
  53. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/dlc/dlc_utils.py +0 -0
  54. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/group/__init__.py +0 -0
  55. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/group/group_5_plots.py +0 -0
  56. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/group/group_constants.py +0 -0
  57. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/gui/__init__.py +0 -0
  58. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/gui/dlc_gui_config.json +0 -0
  59. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/gui/first_level_gui_utils.py +0 -0
  60. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/gui/gaita_widgets.py +0 -0
  61. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/gui/gui_constants.py +0 -0
  62. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/gui/main_gui.py +0 -0
  63. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/gui/sleap_gui_config.json +0 -0
  64. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/gui/window_2D_columninfo.py +0 -0
  65. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/gui/window_2D_run_and_done.py +0 -0
  66. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/resources/__init__.py +0 -0
  67. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/resources/constants.py +0 -0
  68. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/resources/icon.icns +0 -0
  69. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/resources/icon.ico +0 -0
  70. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/resources/logo.png +0 -0
  71. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/resources/pic_to_demo_for_repo.png +0 -0
  72. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/resources/utils.py +0 -0
  73. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/sleap/__init__.py +0 -0
  74. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/sleap/sleap_2_sc_extraction.py +0 -0
  75. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/sleap/sleap_main.py +0 -0
  76. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/universal3D/__init__.py +0 -0
  77. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/universal3D/universal3D_2_sc_extraction.py +0 -0
  78. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/universal3D/universal3D_4_plots.py +0 -0
  79. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/universal3D/universal3D_constants.py +0 -0
  80. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/universal3D/universal3D_datafile_preparation.py +0 -0
  81. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/universal3D/universal3D_main.py +0 -0
  82. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita/universal3D/universal3D_utils.py +0 -0
  83. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita.egg-info/dependency_links.txt +0 -0
  84. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita.egg-info/requires.txt +0 -0
  85. {autogaita-1.0.4 → autogaita-1.0.6}/autogaita.egg-info/top_level.txt +0 -0
  86. {autogaita-1.0.4 → autogaita-1.0.6}/setup.cfg +0 -0
  87. {autogaita-1.0.4 → autogaita-1.0.6}/tests/__init__.py +0 -0
  88. {autogaita-1.0.4 → autogaita-1.0.6}/tests/test_dlc_approval.py +0 -0
  89. {autogaita-1.0.4 → autogaita-1.0.6}/tests/test_dlc_unit_1_preparation.py +0 -0
  90. {autogaita-1.0.4 → autogaita-1.0.6}/tests/test_dlc_unit_2_sc_extraction.py +0 -0
  91. {autogaita-1.0.4 → autogaita-1.0.6}/tests/test_universal3D_approval.py +0 -0
  92. {autogaita-1.0.4 → autogaita-1.0.6}/tests/test_universal3D_unit.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: autogaita
3
- Version: 1.0.4
3
+ Version: 1.0.6
4
4
  Summary: Automatic Gait Analysis in Python. A toolbox to streamline and standardise the analysis of kinematics across species after ML-based body posture tracking. Despite being optimised for gait analyses, AutoGaitA has the potential to be used for any kind of kinematic analysis.
5
5
  Home-page: https://github.com/mahan-hosseini/AutoGaitA/
6
6
  Author: Mahan Hosseini
@@ -0,0 +1,112 @@
1
+ import autogaita
2
+
3
+
4
+ def group_dlcrun():
5
+ """
6
+ Batchrun script to run AutoGaitA Group for Results obtained with AutoGaitA DLC.
7
+ folderinfo & cfg dictionaries must be configured as explained in our documentation. See the "AutoGaitA without the GUI" section of our documentation for references to in-depth explanations to all dictionary keys (note that each key of dicts corresponds to some object in the AutoGaitA Group GUI)
8
+ """
9
+ # folderinfo
10
+ # => Note that length of folderinfo's group_names & group_dirs lists determines how # many groups are compared.
11
+ # => Also note that indices must correspond (i.e., idx # 1's name will be used # for dataset stored in group_dir's idx 1)
12
+ folderinfo = {}
13
+ folderinfo["group_names"] = [
14
+ # RM Dataset
15
+ "5mm",
16
+ "12mm",
17
+ "25mm",
18
+ # Interaction Issue Dataset
19
+ # "Control",
20
+ # "Silenced",
21
+ # Testing Dataset
22
+ # "one",
23
+ # "two",
24
+ ]
25
+ folderinfo["group_dirs"] = [
26
+ # --------------------------
27
+ # Full Dataset (39 subjects)
28
+ # "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Sanity Test Interaction Graziana/Result 10 joints/Control Full",
29
+ # "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Sanity Test Interaction Graziana/Result 10 joints/Silenced Full/",
30
+ # --------------------------
31
+ # Reduced Dataset (5 subjects)
32
+ # "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Sanity Test Interaction Graziana/Result 10 joints/Control",
33
+ # "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Sanity Test Interaction Graziana/Result 10 joints/Silenced/",
34
+ # --------------------------
35
+ # Testing Dataset
36
+ # "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Testing/Group 1/",
37
+ # "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Testing/Group 2/",
38
+ # --------------------------
39
+ # RM Dataset (example data in repo)
40
+ "/Users/mahan/sciebo/PythonCode/gaita_repo/example data/5mm/Results/",
41
+ "/Users/mahan/sciebo/PythonCode/gaita_repo/example data/12mm/Results/",
42
+ "/Users/mahan/sciebo/PythonCode/gaita_repo/example data/25mm/Results/",
43
+ ]
44
+ folderinfo["results_dir"] = (
45
+ "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/example_data_results5/"
46
+ # "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Sanity Test Interaction Graziana/Result 10 joints/Mahan Results/"
47
+ # "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Testing/GroupResults/"
48
+ )
49
+ folderinfo["load_dir"] = (
50
+ "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/example_data_results/"
51
+ # ""
52
+ )
53
+ # cfg
54
+ cfg = {}
55
+ cfg["do_permtest"] = True
56
+ cfg["do_anova"] = True
57
+ cfg["permutation_number"] = 100
58
+ cfg["PCA_n_components"] = 3
59
+ # cfg["PCA_n_components"] = 0.33
60
+ # cfg["PCA_custom_scatter_PCs"] = "4,5,6;4,5;2,4,6"
61
+ cfg["PCA_custom_scatter_PCs"] = ""
62
+ cfg["PCA_save_3D_video"] = False # True
63
+ cfg["PCA_bins"] = "" # "0-10,24,50-75"
64
+ cfg["stats_threshold"] = 0.05
65
+ cfg["plot_SE"] = False
66
+ cfg["color_palette"] = "viridis"
67
+ cfg["dont_show_plots"] = True
68
+ cfg["legend_outside"] = True
69
+ cfg["which_leg"] = "left"
70
+ cfg["anova_design"] = "RM ANOVA"
71
+ # cfg["anova_design"] = "Mixed ANOVA"
72
+ cfg["permutation_number"] = 100
73
+ cfg["PCA_variables"] = [
74
+ "Hind paw tao y",
75
+ "Ankle y",
76
+ "Knee y",
77
+ "Ankle Angle",
78
+ "Knee Angle",
79
+ "Nose x",
80
+ "Knee y",
81
+ "Knee x",
82
+ "Knee Velocity",
83
+ "Knee Acceleration",
84
+ "Knee Angle",
85
+ "Knee Angle Velocity",
86
+ "Knee Angle Acceleration",
87
+ "Hip Angle",
88
+ ]
89
+ cfg["stats_variables"] = [
90
+ "Hind paw tao y",
91
+ # "Ankle y",
92
+ # "Knee y",
93
+ # "Ankle Angle",
94
+ # "Knee Angle",
95
+ # "Nose x",
96
+ # "Knee y",
97
+ # "Knee x",
98
+ # "Knee Velocity",
99
+ # "Knee Acceleration",
100
+ # "Knee Angle",
101
+ # "Knee Angle Velocity",
102
+ # "Knee Angle Acceleration",
103
+ # "Hip Angle",
104
+ # "Elbow Angle"
105
+ ]
106
+ # run
107
+ autogaita.group(folderinfo, cfg)
108
+
109
+
110
+ # %% what happens if we just hit run
111
+ if __name__ == "__main__":
112
+ group_dlcrun()
@@ -0,0 +1,151 @@
1
+ import autogaita
2
+
3
+
4
+ def group_dlcrun():
5
+ """
6
+ Batchrun script to run AutoGaitA Group for Results obtained with AutoGaitA DLC.
7
+ folderinfo & cfg dictionaries must be configured as explained in our documentation. See the "AutoGaitA without the GUI" section of our documentation for references to in-depth explanations to all dictionary keys (note that each key of dicts corresponds to some object in the AutoGaitA Group GUI)
8
+ """
9
+
10
+ # ----------------------------- 3 Months 3 Beams --------------------------------
11
+ # folderinfo = {}
12
+ # folderinfo["group_names"] = [
13
+ # # RM Dataset
14
+ # "3m_5mm",
15
+ # "3m_12mm",
16
+ # "3m_25mm",
17
+ # ]
18
+ # folderinfo["group_dirs"] = [
19
+ # "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Full Dataset and Results Nov 2024/5mm/9w/",
20
+ # "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Full Dataset and Results Nov 2024/12mm/9w/",
21
+ # "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Full Dataset and Results Nov 2024/25mm/9w/",
22
+ # ]
23
+ # folderinfo["results_dir"] = (
24
+ # "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Full Dataset and Results Nov 2024/3Months3BeamsForPaper"
25
+
26
+ # ----------------------------- Old Young 3 Beams --------------------------------
27
+ folderinfo = {}
28
+ folderinfo["group_names"] = [
29
+ # RM Dataset
30
+ "3m_5mm",
31
+ "3m_12mm",
32
+ "3m_25mm",
33
+ "24m_5mm",
34
+ "24m_12mm",
35
+ "24m_25mm",
36
+ ]
37
+ folderinfo["group_dirs"] = [
38
+ "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Full Dataset and Results Nov 2024/5mm/9w/",
39
+ "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Full Dataset and Results Nov 2024/12mm/9w/",
40
+ "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Full Dataset and Results Nov 2024/25mm/9w/",
41
+ "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Full Dataset and Results Nov 2024/5mm/104w/",
42
+ "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Full Dataset and Results Nov 2024/12mm/104w/",
43
+ "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Full Dataset and Results Nov 2024/255mm/104w/",
44
+ ]
45
+ folderinfo["results_dir"] = (
46
+ "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Full Dataset and Results Nov 2024/YoungOld3BeamsForPaper_v2"
47
+ )
48
+ folderinfo["load_dir"] = ""
49
+
50
+ # cfg
51
+ cfg = {}
52
+ cfg["do_permtest"] = False
53
+ cfg["do_anova"] = True
54
+ cfg["permutation_number"] = 10000
55
+ cfg["PCA_n_components"] = 3
56
+ # cfg["PCA_n_components"] = 0.33
57
+ # cfg["PCA_custom_scatter_PCs"] = "4,5,6;4,5;2,4,6"
58
+ cfg["PCA_custom_scatter_PCs"] = ""
59
+ cfg["PCA_save_3D_video"] = False # True
60
+ cfg["PCA_bins"] = "" # "0-10,24,50-75"
61
+ cfg["stats_threshold"] = 0.05
62
+ cfg["plot_SE"] = True
63
+ cfg["color_palette"] = "Set2"
64
+ cfg["dont_show_plots"] = True
65
+ cfg["legend_outside"] = True
66
+ cfg["which_leg"] = "left"
67
+ cfg["anova_design"] = "RM ANOVA"
68
+ cfg["PCA_variables"] = [
69
+ "Nose x",
70
+ "Nose y",
71
+ "Ear base x",
72
+ "Ear base y",
73
+ "Front paw tao x",
74
+ "Front paw tao y",
75
+ "Wrist x",
76
+ "Wrist y",
77
+ "Elbow x",
78
+ "Elbow y",
79
+ "Lower Shoulder x",
80
+ "Lower Shoulder y",
81
+ "Upper Shoulder x",
82
+ "Upper Shoulder y",
83
+ "Iliac Crest x",
84
+ "Iliac Crest y",
85
+ "Hip x",
86
+ "Hip y",
87
+ "Knee x",
88
+ "Knee y",
89
+ "Ankle x",
90
+ "Ankle y",
91
+ "Hind paw tao x",
92
+ "Hind paw tao y",
93
+ "Tail base y",
94
+ "Tail center x",
95
+ "Tail center y",
96
+ "Tail tip x",
97
+ "Tail tip y",
98
+ "Hind paw tao Velocity",
99
+ "Hind paw tao Acceleration",
100
+ "Ankle Velocity",
101
+ "Ankle Acceleration",
102
+ "Knee Velocity",
103
+ "Knee Acceleration",
104
+ "Hip Velocity",
105
+ "Hip Acceleration",
106
+ "Iliac Crest Velocity",
107
+ "Iliac Crest Acceleration",
108
+ "Ankle Angle",
109
+ "Knee Angle",
110
+ "Hip Angle",
111
+ "Wrist Angle",
112
+ "Elbow Angle",
113
+ "Lower Shoulder Angle",
114
+ "Iliac Crest Angle",
115
+ "Ankle Angle Velocity",
116
+ "Ankle Angle Acceleration",
117
+ "Knee Angle Acceleration",
118
+ "Hip Angle Velocity",
119
+ "Hip Angle Acceleration",
120
+ "Wrist Angle Velocity",
121
+ "Wrist Angle Acceleration",
122
+ "Elbow Angle Velocity",
123
+ "Elbow Angle Acceleration",
124
+ "Lower Shoulder Angle Velocity",
125
+ "Lower Shoulder Angle Acceleration",
126
+ "Iliac Crest Angle Velocity",
127
+ "Iliac Crest Angle Acceleration",
128
+ ]
129
+ cfg["stats_variables"] = [
130
+ "Hip x",
131
+ "Hip y",
132
+ "Knee x",
133
+ "Knee y",
134
+ "Ankle x",
135
+ "Ankle y",
136
+ "Hind paw tao x",
137
+ "Hind paw tao y",
138
+ "Hind paw tao Velocity",
139
+ "Ankle Velocity",
140
+ "Knee Velocity",
141
+ "Ankle Angle",
142
+ "Knee Angle",
143
+ "Hip Angle",
144
+ ]
145
+ # run
146
+ autogaita.group(folderinfo, cfg)
147
+
148
+
149
+ # %% what happens if we just hit run
150
+ if __name__ == "__main__":
151
+ group_dlcrun()
@@ -0,0 +1,139 @@
1
+ import autogaita
2
+
3
+
4
+ def group_universal3Drun():
5
+ """
6
+ Batchrun script to run AutoGaitA Group for Results obtained with AutoGaitA Universal 3D.
7
+ folderinfo & cfg dictionaries must be configured as explained in our documentation. See the "AutoGaitA without the GUI" section of our documentation for references to in-depth explanations to all dictionary keys (note that each key of dicts corresponds to some object in the AutoGaitA Group GUI)
8
+ """
9
+ # loop over legs - currently no option to do both legs in a single run
10
+ cfg = {}
11
+ # folderinfo
12
+ # => Note that length of folderinfo's group_names & group_dirs lists determines # how many groups are compared.
13
+ # => Also note that indices must correspond (i.e., idx # 1's name will be # used for dataset stored in group_dir's idx 1)
14
+ folderinfo = {}
15
+ folderinfo["group_names"] = [
16
+ "crawling",
17
+ "sideways",
18
+ "walking",
19
+ "jogging",
20
+ "jumping_jack",
21
+ "vertical_jumping",
22
+ ]
23
+ folderinfo["group_dirs"] = [
24
+ "/Users/mahan/sciebo/Research/AutoGaitA/Showcase 3/MOVI/First Analysis/gaita prepared/crawling/Results/",
25
+ "/Users/mahan/sciebo/Research/AutoGaitA/Showcase 3/MOVI/First Analysis/gaita prepared/sideways/Results/",
26
+ "/Users/mahan/sciebo/Research/AutoGaitA/Showcase 3/MOVI/First Analysis/gaita prepared/walking/Results/",
27
+ "/Users/mahan/sciebo/Research/AutoGaitA/Showcase 3/MOVI/First Analysis/gaita prepared/jogging/Results/",
28
+ "/Users/mahan/sciebo/Research/AutoGaitA/Showcase 3/MOVI/First Analysis/gaita prepared/jumping_jack/Results/",
29
+ "/Users/mahan/sciebo/Research/AutoGaitA/Showcase 3/MOVI/First Analysis/gaita prepared/vertical_jumping/Results/",
30
+ ]
31
+ folderinfo["results_dir"] = (
32
+ "/Users/mahan/sciebo/Research/AutoGaitA/Showcase 3/MOVI/First Analysis/gaita prepared/group/"
33
+ )
34
+ folderinfo["load_dir"] = ""
35
+ # cfg
36
+ cfg["do_permtest"] = True
37
+ cfg["do_anova"] = True
38
+ cfg["permutation_number"] = 10000
39
+ cfg["PCA_n_components"] = 10
40
+ cfg["PCA_custom_scatter_PCs"] = ""
41
+ cfg["PCA_save_3D_video"] = True
42
+ cfg["PCA_bins"] = ""
43
+ cfg["stats_threshold"] = 0.05
44
+ cfg["plot_SE"] = False
45
+ cfg["color_palette"] = "Set2"
46
+ cfg["legend_outside"] = True
47
+ cfg["dont_show_plots"] = True
48
+ cfg["anova_design"] = "Mixed ANOVA"
49
+ cfg["which_leg"] = "right"
50
+ cfg["PCA_variables"] = [
51
+ "Head Y",
52
+ "Head Z",
53
+ "Hip Y",
54
+ "Hip Z",
55
+ "Pelvis Y",
56
+ "Pelvis Z",
57
+ "Thorax Y",
58
+ "Thorax Z",
59
+ "Ankle, left Y",
60
+ "Ankle, left Z",
61
+ "Elbow, left Y",
62
+ "Elbow, left Z",
63
+ "Hip, left Y",
64
+ "Hip, left Z",
65
+ "Hand, left Y",
66
+ "Hand, left Z",
67
+ "Knee, left Y",
68
+ "Knee, left Z",
69
+ "Shoulder, left Y",
70
+ "Shoulder, left Z",
71
+ "Wrist, left Y",
72
+ "Wrist, left Z",
73
+ "Foot, left Y",
74
+ "Foot, left Z",
75
+ "Ankle, right Y",
76
+ "Ankle, right Z",
77
+ "Elbow, right Y",
78
+ "Elbow, right Z",
79
+ "Hip, right Y",
80
+ "Hip, right Z",
81
+ "Hand, right Y",
82
+ "Hand, right Z",
83
+ "Knee, right Y",
84
+ "Knee, right Z",
85
+ "Shoulder, right Y",
86
+ "Shoulder, right Z",
87
+ "Wrist, right Y",
88
+ "Wrist, right Z",
89
+ "Foot, right Y",
90
+ "Foot, right Z",
91
+ "Ankle, left Angle",
92
+ "Knee, left Angle",
93
+ "Elbow, left Angle",
94
+ "Foot, left Velocity",
95
+ "Foot, left Acceleration",
96
+ "Ankle, left Velocity",
97
+ "Ankle, left Acceleration",
98
+ "Knee, left Velocity",
99
+ "Knee, left Acceleration",
100
+ "Hip Velocity",
101
+ "Hip Acceleration",
102
+ "Pelvis Velocity",
103
+ "Pelvis Acceleration",
104
+ "Shoulder, left Velocity",
105
+ "Shoulder, left Acceleration",
106
+ "Head Velocity",
107
+ "Head Acceleration",
108
+ "Ankle, left Angle Velocity",
109
+ "Ankle, left Angle Acceleration",
110
+ "Knee, left Angle Velocity",
111
+ "Knee, left Angle Acceleration",
112
+ "Elbow, left Angle Velocity",
113
+ "Elbow, left Angle Acceleration",
114
+ "Ankle, right Angle",
115
+ "Knee, right Angle",
116
+ "Elbow, right Angle",
117
+ "Foot, right Velocity",
118
+ "Foot, right Acceleration",
119
+ "Ankle, right Velocity",
120
+ "Ankle, right Acceleration",
121
+ "Knee, right Velocity",
122
+ "Knee, right Acceleration",
123
+ "Shoulder, right Velocity",
124
+ "Shoulder, right Acceleration",
125
+ "Ankle, right Angle Velocity",
126
+ "Ankle, right Angle Acceleration",
127
+ "Knee, right Angle Velocity",
128
+ "Knee, right Angle Acceleration",
129
+ "Elbow, right Angle Velocity",
130
+ "Elbow, right Angle Acceleration",
131
+ ]
132
+ cfg["stats_variables"] = []
133
+ # run
134
+ autogaita.group(folderinfo, cfg)
135
+
136
+
137
+ # %% what happens if we just hit run
138
+ if __name__ == "__main__":
139
+ group_universal3Drun()
@@ -23,11 +23,14 @@ def group_universal3Drun():
23
23
  + cfg["which_leg"]
24
24
  + " leg/"
25
25
  )
26
+ folderinfo["load_dir"] = ""
26
27
  # cfg
27
28
  cfg["do_permtest"] = True
28
29
  cfg["do_anova"] = True
29
30
  cfg["permutation_number"] = 10
30
31
  cfg["PCA_n_components"] = 3
32
+ cfg["PCA_custom_scatter_PCs"] = ""
33
+ cfg["PCA_bins"] = ""
31
34
  cfg["PCA_save_3D_video"] = False
32
35
  cfg["stats_threshold"] = 0.05
33
36
  cfg["plot_SE"] = False
@@ -24,11 +24,16 @@ def universal3D_multirun():
24
24
  cfg["angular_acceleration"] = True
25
25
  cfg["bin_num"] = 25
26
26
  cfg["plot_SE"] = True
27
- cfg["normalise_height_at_SC_level"] = True
27
+ cfg["standardise_z_at_SC_level"] = True
28
+ cfg["standardise_z_to_a_joint"] = True
29
+ cfg["z_standardisation_joint"] = ["Foot, left"]
28
30
  cfg["plot_joint_number"] = 7
29
31
  cfg["color_palette"] = "viridis"
30
32
  cfg["legend_outside"] = True
33
+ cfg["flip_gait_direction"] = False
31
34
  cfg["analyse_average_y"] = True
35
+ cfg["standardise_y_coordinates"] = True
36
+ cfg["y_standardisation_joint"] = ["Foot"]
32
37
  cfg["joints"] = ["Midfoot", "Ankle", "Knee", "Hip", "Pelvis", "Shoulder", "Neck"]
33
38
  cfg["angles"] = {
34
39
  "name": ["Ankle", "Knee"],
@@ -23,11 +23,16 @@ def universal3D_singlerun():
23
23
  cfg["angular_acceleration"] = True
24
24
  cfg["bin_num"] = 25
25
25
  cfg["plot_SE"] = True
26
- cfg["normalise_height_at_SC_level"] = True
26
+ cfg["standardise_z_at_SC_level"] = True
27
+ cfg["standardise_z_to_a_joint"] = True
28
+ cfg["z_standardisation_joint"] = ["Midfoot"]
27
29
  cfg["plot_joint_number"] = 5
28
30
  cfg["color_palette"] = "Set2"
29
31
  cfg["legend_outside"] = True
30
- cfg["analyse_average_y"] = False
32
+ cfg["flip_gait_direction"] = False
33
+ cfg["analyse_average_y"] = True
34
+ cfg["standardise_y_coordinates"] = True
35
+ cfg["y_standardisation_joint"] = ["Midfoot"]
31
36
  cfg["joints"] = [
32
37
  # "R1-ThCx",
33
38
  "Midfoot",
@@ -63,6 +63,9 @@ def analyse_and_export_stepcycles(data, all_cycles, info, cfg):
63
63
  # 2 or more steps - build dataframe
64
64
  elif len(all_cycles) > 1:
65
65
  # first- step is added manually
66
+ # NOTE
67
+ # ----
68
+ # normalised_steps_data is created using x_standardised_steps_data or first_step
66
69
  first_step = data_copy.loc[all_cycles[0][0] : all_cycles[0][1]]
67
70
  if standardise_x_coordinates:
68
71
  all_steps_data, x_standardised_steps_data = (
@@ -181,20 +184,20 @@ def standardise_x_y_and_add_features_to_one_step(step, cfg):
181
184
  step_copy[y_cols] -= this_y_min
182
185
  # if no x-standardisation, just add features & return non-(x-)normalised step
183
186
  if cfg["standardise_x_coordinates"] is False:
184
- non_norm_step = add_features(step_copy, cfg)
185
- return non_norm_step
187
+ non_stand_step = add_features(step_copy, cfg)
188
+ return non_stand_step
186
189
  # else standardise x (horizontal dimension) at step-cycle level too
187
190
  else:
188
- non_norm_step = add_features(step_copy, cfg)
189
- x_norm_step = step_copy.copy()
190
- x_cols = [col for col in x_norm_step.columns if col.endswith("x")]
191
+ non_stand_step = add_features(step_copy, cfg)
192
+ x_stand_step = step_copy.copy()
193
+ x_cols = [col for col in x_stand_step.columns if col.endswith("x")]
191
194
  # note the [0] here is important because it's still a list of len=1!!
192
- min_x_standardisation_joint = x_norm_step[
195
+ min_x_standardisation_joint = x_stand_step[
193
196
  cfg["x_standardisation_joint"][0] + "x"
194
197
  ].min()
195
- x_norm_step[x_cols] -= min_x_standardisation_joint
196
- x_norm_step = add_features(x_norm_step, cfg)
197
- return non_norm_step, x_norm_step
198
+ x_stand_step[x_cols] -= min_x_standardisation_joint
199
+ x_stand_step = add_features(x_stand_step, cfg)
200
+ return non_stand_step, x_stand_step
198
201
 
199
202
 
200
203
  def add_features(step, cfg):
@@ -169,7 +169,7 @@ def some_prep(info, folderinfo, cfg):
169
169
  beam_hind_jointadd = cfg["beam_hind_jointadd"]
170
170
  beam_fore_jointadd = cfg["beam_fore_jointadd"]
171
171
  direction_joint = cfg["direction_joint"]
172
- # important to unpack to vars hand not to cfg since cfg is overwritten in multiruns!
172
+ # important to unpack to vars and not to cfg since cfg is overwritten in multiruns!
173
173
  x_standardisation_joint = cfg["x_standardisation_joint"][0]
174
174
  y_standardisation_joint = cfg["y_standardisation_joint"][0]
175
175
  # store config json file @ group path
@@ -49,43 +49,59 @@ def some_prep(folderinfo, cfg):
49
49
  if os.path.exists(info_file_path):
50
50
  os.remove(info_file_path)
51
51
 
52
- # extracted_cfg_vars: save_to_xls, PCA stuff & dont show plots
53
- cfg = extract_cfg_vars(folderinfo, cfg)
54
-
55
- # see if there's a config json file and add to cfg dict
56
- for g_idx, group_dir in enumerate(group_dirs):
52
+ # *********** IMPORTANT ***********
53
+ # if load_dir, we have already saved a group config.json (see below before return)
54
+ # => use this and just return the cfg
55
+ # => make sure to write folderinfo["contrast"] manually above as is and then return
56
+ # that folderinfo plus the cfg you load from the file
57
+ if len(folderinfo["load_dir"]) > 0:
57
58
  with open(
58
- os.path.join(group_dir, CONFIG_JSON_FILENAME), "r"
59
+ os.path.join(folderinfo["load_dir"], CONFIG_JSON_FILENAME), "r"
59
60
  ) as config_json_file:
60
- config_vars_from_json = json.load(config_json_file)
61
- for key in config_vars_from_json.keys():
62
- # assigning like this ensure all keys are in all jsons across groups
63
- if g_idx == 0:
64
- cfg[key] = config_vars_from_json[key]
65
- else:
66
- # sanity check for group-differences in cfg variables!
67
- if (key not in cfg.keys()) | (
68
- cfg[key] != config_vars_from_json[key]
69
- ):
70
- error_message = (
71
- "config.json variables differ between groups!"
72
- + "\nPlease make sure that all cfg variables between "
73
- + "groups match & try again!"
74
- )
75
- raise ValueError(error_message)
76
- else:
61
+ cfg = json.load(config_json_file)
62
+ cfg["loaded"] = True # used in a unit test in test_group_unit.py
63
+
64
+ else: # if not, do the below things based on group dirs' configs
65
+ # 1. extracted_cfg_vars: save_to_xls, PCA stuff & dont show plots
66
+ cfg = extract_cfg_vars(folderinfo, cfg)
67
+
68
+ # 2. ennsure each key's across-group-equivalence and then add to cfg dict
69
+ for g_idx, group_dir in enumerate(group_dirs):
70
+ with open(
71
+ os.path.join(group_dir, CONFIG_JSON_FILENAME), "r"
72
+ ) as config_json_file:
73
+ config_vars_from_json = json.load(config_json_file)
74
+ for key in config_vars_from_json.keys():
75
+ # assigning like this ensure all keys are in all jsons across groups
76
+ if g_idx == 0:
77
77
  cfg[key] = config_vars_from_json[key]
78
+ else:
79
+ # sanity check for group-differences in cfg variables!
80
+ if (key not in cfg.keys()) | (
81
+ cfg[key] != config_vars_from_json[key]
82
+ ):
83
+ error_message = (
84
+ "config.json variables differ between groups!"
85
+ + "\nPlease make sure that all cfg variables between "
86
+ + "groups match & try again!"
87
+ )
88
+ raise ValueError(error_message)
89
+ else:
90
+ cfg[key] = config_vars_from_json[key]
78
91
 
79
- # after having checked cfg keys for equivalence, we have to make sure that
80
- # hind_joints is renamed to joints if DLC
81
- # => note that cfg will not be updated (and overwritten from input if Universal 3D so it's)
82
- # okay that we do this
83
- if cfg["tracking_software"] == "DLC":
84
- cfg["joints"] = cfg["hind_joints"]
85
- joints = cfg["joints"]
86
- angles = cfg["angles"]
92
+ # 3. rename hind_joints is to joints if DLC or SLEAP
93
+ if "hind_joints" in cfg.keys():
94
+ cfg["joints"] = cfg["hind_joints"]
87
95
 
88
- # prepare some plotting color stuff
96
+ # ******** IMPORTANT *******
97
+ # => Do the following two things regardless of load_dir:
98
+ # 1. save cfg to json file in results_dir for load_dir capability
99
+ config_json_path = os.path.join(results_dir, CONFIG_JSON_FILENAME)
100
+ if os.path.exists(config_json_path): # overwrite if exists
101
+ os.remove(config_json_path)
102
+ with open(config_json_path, "w") as config_json_file:
103
+ json.dump(cfg, config_json_file)
104
+ # 2. create this plot stuff manually (cycler objects cannot be written to json)
89
105
  cfg["group_color_cycler"] = plt.cycler(
90
106
  "color", sns.color_palette(cfg["color_palette"], len(group_names))
91
107
  )
@@ -93,10 +109,10 @@ def some_prep(folderinfo, cfg):
93
109
  zip(group_names, cfg["group_color_cycler"].by_key()["color"])
94
110
  )
95
111
  cfg["joint_color_cycler"] = plt.cycler(
96
- "color", sns.color_palette(cfg["color_palette"], len(joints))
112
+ "color", sns.color_palette(cfg["color_palette"], len(cfg["joints"]))
97
113
  )
98
114
  cfg["angle_color_cycler"] = plt.cycler(
99
- "color", sns.color_palette(cfg["color_palette"], len(angles["name"]))
115
+ "color", sns.color_palette(cfg["color_palette"], len(cfg["angles"]["name"]))
100
116
  )
101
117
 
102
118
  return folderinfo, cfg