autogaita 1.5.0__tar.gz → 1.5.1__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.
- {autogaita-1.5.0 → autogaita-1.5.1}/PKG-INFO +1 -1
- autogaita-1.5.1/autogaita/batchrun_scripts/__init__.py +0 -0
- autogaita-1.5.1/autogaita/batchrun_scripts/dlc_multirun.py +73 -0
- autogaita-1.5.1/autogaita/batchrun_scripts/dlc_singlerun.py +84 -0
- autogaita-1.5.1/autogaita/batchrun_scripts/group_dlcrun.py +108 -0
- autogaita-1.5.1/autogaita/batchrun_scripts/group_universal3Drun.py +70 -0
- autogaita-1.5.1/autogaita/batchrun_scripts/sleap_singlerun.py +82 -0
- autogaita-1.5.1/autogaita/batchrun_scripts/universal3D_multirun.py +112 -0
- autogaita-1.5.1/autogaita/batchrun_scripts/universal3D_singlerun.py +67 -0
- autogaita-1.5.1/autogaita/common2D/__init__.py +0 -0
- autogaita-1.5.1/autogaita/common2D/common2D_1_preparation.py +838 -0
- autogaita-1.5.1/autogaita/common2D/common2D_2_sc_extraction.py +233 -0
- autogaita-1.5.1/autogaita/common2D/common2D_3_analysis.py +358 -0
- autogaita-1.5.1/autogaita/common2D/common2D_4_plots.py +929 -0
- autogaita-1.5.1/autogaita/common2D/common2D_constants.py +33 -0
- autogaita-1.5.1/autogaita/common2D/common2D_utils.py +444 -0
- autogaita-1.5.1/autogaita/dlc/__init__.py +0 -0
- autogaita-1.5.1/autogaita/dlc/dlc_main.py +76 -0
- autogaita-1.5.1/autogaita/group/__init__.py +0 -0
- autogaita-1.5.1/autogaita/group/group_1_preparation.py +333 -0
- autogaita-1.5.1/autogaita/group/group_2_data_processing.py +664 -0
- autogaita-1.5.1/autogaita/group/group_3_PCA.py +577 -0
- autogaita-1.5.1/autogaita/group/group_4_stats.py +1144 -0
- autogaita-1.5.1/autogaita/group/group_5_plots.py +631 -0
- autogaita-1.5.1/autogaita/group/group_constants.py +61 -0
- autogaita-1.5.1/autogaita/group/group_main.py +150 -0
- autogaita-1.5.1/autogaita/group/group_utils.py +233 -0
- autogaita-1.5.1/autogaita/gui/__init__.py +0 -0
- autogaita-1.5.1/autogaita/gui/common2D_advanced_config_gui.py +327 -0
- autogaita-1.5.1/autogaita/gui/common2D_columninfo_gui.py +470 -0
- autogaita-1.5.1/autogaita/gui/common2D_gui_constants.py +68 -0
- autogaita-1.5.1/autogaita/gui/common2D_gui_utils.py +209 -0
- autogaita-1.5.1/autogaita/gui/common2D_main_gui.py +319 -0
- autogaita-1.5.1/autogaita/gui/common2D_run_and_done_gui.py +367 -0
- autogaita-1.5.1/autogaita/gui/dlc_gui.py +15 -0
- autogaita-1.5.1/autogaita/gui/dlc_gui_config.json +91 -0
- autogaita-1.5.1/autogaita/gui/first_level_gui_utils.py +124 -0
- autogaita-1.5.1/autogaita/gui/gaita_widgets.py +179 -0
- autogaita-1.5.1/autogaita/gui/group_gui.py +1328 -0
- autogaita-1.5.1/autogaita/gui/group_gui_config.json +42 -0
- autogaita-1.5.1/autogaita/gui/gui_constants.py +76 -0
- autogaita-1.5.1/autogaita/gui/gui_utils.py +139 -0
- autogaita-1.5.1/autogaita/gui/main_gui.py +132 -0
- autogaita-1.5.1/autogaita/gui/sleap_gui.py +15 -0
- autogaita-1.5.1/autogaita/gui/sleap_gui_config.json +76 -0
- autogaita-1.5.1/autogaita/gui/universal3D_gui.py +1324 -0
- autogaita-1.5.1/autogaita/gui/universal3D_gui_config.json +65 -0
- autogaita-1.5.1/autogaita/resources/__init__.py +0 -0
- autogaita-1.5.1/autogaita/resources/constants.py +8 -0
- autogaita-1.5.1/autogaita/resources/folder.png +0 -0
- autogaita-1.5.1/autogaita/resources/icon.icns +0 -0
- autogaita-1.5.1/autogaita/resources/icon.ico +0 -0
- autogaita-1.5.1/autogaita/resources/logo.png +0 -0
- autogaita-1.5.1/autogaita/resources/pic_to_demo_for_repo.png +0 -0
- autogaita-1.5.1/autogaita/resources/utils.py +581 -0
- autogaita-1.5.1/autogaita/sleap/__init__.py +0 -0
- autogaita-1.5.1/autogaita/sleap/sleap_main.py +78 -0
- autogaita-1.5.1/autogaita/universal3D/__init__.py +0 -0
- autogaita-1.5.1/autogaita/universal3D/universal3D_1_preparation.py +556 -0
- autogaita-1.5.1/autogaita/universal3D/universal3D_2_sc_extraction.py +485 -0
- autogaita-1.5.1/autogaita/universal3D/universal3D_3_analysis.py +758 -0
- autogaita-1.5.1/autogaita/universal3D/universal3D_4_plots.py +1021 -0
- autogaita-1.5.1/autogaita/universal3D/universal3D_constants.py +41 -0
- autogaita-1.5.1/autogaita/universal3D/universal3D_datafile_preparation.py +216 -0
- autogaita-1.5.1/autogaita/universal3D/universal3D_main.py +94 -0
- autogaita-1.5.1/autogaita/universal3D/universal3D_utils.py +18 -0
- {autogaita-1.5.0 → autogaita-1.5.1}/autogaita.egg-info/PKG-INFO +1 -1
- autogaita-1.5.1/autogaita.egg-info/SOURCES.txt +96 -0
- autogaita-1.5.1/autogaita.egg-info/top_level.txt +2 -0
- autogaita-1.5.1/autogaita_backup/common2D_run_and_done_gui.py +414 -0
- autogaita-1.5.1/autogaita_backup/dlc_1_preparation.py +426 -0
- autogaita-1.5.1/autogaita_backup/dlc_2_sc_extraction.py +217 -0
- autogaita-1.5.1/autogaita_backup/dlc_gui.py +359 -0
- autogaita-1.5.1/autogaita_backup/sleap_1_preparation.py +303 -0
- autogaita-1.5.1/autogaita_backup/sleap_2_sc_extraction.py +167 -0
- autogaita-1.5.1/autogaita_backup/sleap_gui.py +359 -0
- {autogaita-1.5.0 → autogaita-1.5.1}/pyproject.toml +5 -2
- autogaita-1.5.0/autogaita.egg-info/SOURCES.txt +0 -24
- autogaita-1.5.0/autogaita.egg-info/top_level.txt +0 -1
- {autogaita-1.5.0 → autogaita-1.5.1}/LICENSE +0 -0
- {autogaita-1.5.0 → autogaita-1.5.1}/README.md +0 -0
- {autogaita-1.5.0 → autogaita-1.5.1}/autogaita/__init__.py +0 -0
- {autogaita-1.5.0 → autogaita-1.5.1}/autogaita/__main__.py +0 -0
- {autogaita-1.5.0 → autogaita-1.5.1}/autogaita.egg-info/dependency_links.txt +0 -0
- {autogaita-1.5.0 → autogaita-1.5.1}/autogaita.egg-info/entry_points.txt +0 -0
- {autogaita-1.5.0 → autogaita-1.5.1}/autogaita.egg-info/requires.txt +0 -0
- {autogaita-1.5.0 → autogaita-1.5.1}/setup.cfg +0 -0
- {autogaita-1.5.0 → autogaita-1.5.1}/tests/test_common2D_unit_1_preparation.py +0 -0
- {autogaita-1.5.0 → autogaita-1.5.1}/tests/test_common2D_unit_2_sc_extraction.py +0 -0
- {autogaita-1.5.0 → autogaita-1.5.1}/tests/test_common2D_unit_3_analysis.py +0 -0
- {autogaita-1.5.0 → autogaita-1.5.1}/tests/test_common2D_unit_utils.py +0 -0
- {autogaita-1.5.0 → autogaita-1.5.1}/tests/test_dlc_approval.py +0 -0
- {autogaita-1.5.0 → autogaita-1.5.1}/tests/test_dlc_unit_1_preparation.py +0 -0
- {autogaita-1.5.0 → autogaita-1.5.1}/tests/test_group_approval.py +0 -0
- {autogaita-1.5.0 → autogaita-1.5.1}/tests/test_group_unit.py +0 -0
- {autogaita-1.5.0 → autogaita-1.5.1}/tests/test_universal3D_approval.py +0 -0
- {autogaita-1.5.0 → autogaita-1.5.1}/tests/test_universal3D_unit_1_preparation.py +0 -0
- {autogaita-1.5.0 → autogaita-1.5.1}/tests/test_universal3D_unit_2_sc_extraction.py +0 -0
- {autogaita-1.5.0 → autogaita-1.5.1}/tests/test_universal3D_unit_3_analysis.py +0 -0
- {autogaita-1.5.0 → autogaita-1.5.1}/tests/test_utils.py +0 -0
|
File without changes
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
from autogaita.common2D.common2D_utils import extract_info, run_singlerun_in_multirun
|
|
2
|
+
|
|
3
|
+
# %% main function
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def dlc_multirun():
|
|
7
|
+
"""
|
|
8
|
+
Batchrun script to run AutoGaitA DLC for a folder of datasets.
|
|
9
|
+
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 DLC GUI)
|
|
10
|
+
"""
|
|
11
|
+
# folderinfo
|
|
12
|
+
folderinfo = {}
|
|
13
|
+
folderinfo["root_dir"] = "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Testing/"
|
|
14
|
+
folderinfo["sctable_filename"] = "25mm.xlsx"
|
|
15
|
+
folderinfo["data_string"] = "SIMINewOct"
|
|
16
|
+
folderinfo["beam_string"] = "BeamTraining"
|
|
17
|
+
folderinfo["premouse_string"] = "Mouse"
|
|
18
|
+
folderinfo["postmouse_string"] = "25mm"
|
|
19
|
+
folderinfo["prerun_string"] = "run"
|
|
20
|
+
folderinfo["postrun_string"] = "6DLC"
|
|
21
|
+
# cfg
|
|
22
|
+
cfg = {}
|
|
23
|
+
cfg["sampling_rate"] = 100 # base cfg
|
|
24
|
+
cfg["subtract_beam"] = True
|
|
25
|
+
cfg["dont_show_plots"] = False
|
|
26
|
+
cfg["convert_to_mm"] = True
|
|
27
|
+
cfg["pixel_to_mm_ratio"] = 3.76
|
|
28
|
+
cfg["x_sc_broken_threshold"] = 200 # optional cfg
|
|
29
|
+
cfg["y_sc_broken_threshold"] = 50
|
|
30
|
+
cfg["x_acceleration"] = True
|
|
31
|
+
cfg["angular_acceleration"] = True
|
|
32
|
+
cfg["save_to_xls"] = True
|
|
33
|
+
cfg["bin_num"] = 25
|
|
34
|
+
cfg["plot_SE"] = True
|
|
35
|
+
cfg["standardise_y_at_SC_level"] = True
|
|
36
|
+
cfg["standardise_y_to_a_joint"] = True
|
|
37
|
+
cfg["y_standardisation_joint"] = ["Hind paw tao"]
|
|
38
|
+
cfg["plot_joint_number"] = 3
|
|
39
|
+
cfg["color_palette"] = "viridis"
|
|
40
|
+
cfg["legend_outside"] = True
|
|
41
|
+
cfg["invert_y_axis"] = True
|
|
42
|
+
cfg["flip_gait_direction"] = True
|
|
43
|
+
cfg["analyse_average_x"] = True
|
|
44
|
+
cfg["standardise_x_coordinates"] = True
|
|
45
|
+
cfg["x_standardisation_joint"] = ["Hind paw tao"]
|
|
46
|
+
cfg["coordinate_standardisation_xls"] = ""
|
|
47
|
+
cfg["results_dir"] = ""
|
|
48
|
+
cfg["hind_joints"] = ["Hind paw tao", "Ankle", "Knee", "Hip", "Iliac Crest"]
|
|
49
|
+
cfg["fore_joints"] = [
|
|
50
|
+
"Front paw tao ",
|
|
51
|
+
"Wrist ",
|
|
52
|
+
"Elbow ",
|
|
53
|
+
"Lower Shoulder ",
|
|
54
|
+
"Upper Shoulder ",
|
|
55
|
+
]
|
|
56
|
+
cfg["beam_col_left"] = ["BeamLeft"] # list of len == 1
|
|
57
|
+
cfg["beam_col_right"] = ["BeamRight"]
|
|
58
|
+
cfg["beam_hind_jointadd"] = ["Tail base ", "Tail center ", "Tail tip "]
|
|
59
|
+
cfg["beam_fore_jointadd"] = ["Nose ", "Ear base "]
|
|
60
|
+
cfg["angles"] = {
|
|
61
|
+
"name": ["Ankle ", "Knee ", "Hip "],
|
|
62
|
+
"lower_joint": ["Hind paw tao ", "Ankle ", "Knee "],
|
|
63
|
+
"upper_joint": ["Knee ", "Hip ", "Iliac Crest "],
|
|
64
|
+
}
|
|
65
|
+
# run a single gaita run for each entry of info
|
|
66
|
+
info = extract_info("DLC", folderinfo)
|
|
67
|
+
for idx in range(len(info["name"])):
|
|
68
|
+
run_singlerun_in_multirun("DLC", idx, info, folderinfo, cfg)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
# %% what happens if we just hit run
|
|
72
|
+
if __name__ == "__main__":
|
|
73
|
+
dlc_multirun()
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
from autogaita.resources.utils import try_to_run_gaita
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
# %% main function
|
|
6
|
+
def dlc_singlerun():
|
|
7
|
+
"""
|
|
8
|
+
Batchrun script to run AutoGaitA DLC for a single dataset.
|
|
9
|
+
folderinfo & cfg dictionaries must be configured as explained in our documentation. (note that each value of these corresponds to some object in the AutoGaitA DLC GUI)
|
|
10
|
+
"""
|
|
11
|
+
# folderinfo
|
|
12
|
+
folderinfo = {}
|
|
13
|
+
folderinfo["root_dir"] = "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Testing/"
|
|
14
|
+
folderinfo["sctable_filename"] = "25mm.xlsx"
|
|
15
|
+
folderinfo["results_dir"] = ""
|
|
16
|
+
folderinfo["data_string"] = "SIMINewOct"
|
|
17
|
+
folderinfo["beam_string"] = "BeamTraining"
|
|
18
|
+
folderinfo["premouse_string"] = "Mouse"
|
|
19
|
+
folderinfo["postmouse_string"] = "25mm"
|
|
20
|
+
folderinfo["prerun_string"] = "run"
|
|
21
|
+
folderinfo["postrun_string"] = "6DLC"
|
|
22
|
+
# cfg
|
|
23
|
+
cfg = {}
|
|
24
|
+
cfg["sampling_rate"] = 100 # base cfg
|
|
25
|
+
cfg["subtract_beam"] = True
|
|
26
|
+
cfg["dont_show_plots"] = True
|
|
27
|
+
cfg["convert_to_mm"] = True
|
|
28
|
+
cfg["pixel_to_mm_ratio"] = 3.76
|
|
29
|
+
cfg["x_sc_broken_threshold"] = 200 # optional cfg
|
|
30
|
+
cfg["y_sc_broken_threshold"] = 50
|
|
31
|
+
cfg["x_acceleration"] = True
|
|
32
|
+
cfg["angular_acceleration"] = True
|
|
33
|
+
cfg["save_to_xls"] = True
|
|
34
|
+
cfg["bin_num"] = 25
|
|
35
|
+
cfg["plot_SE"] = True
|
|
36
|
+
cfg["standardise_y_at_SC_level"] = False
|
|
37
|
+
cfg["standardise_y_to_a_joint"] = True
|
|
38
|
+
cfg["y_standardisation_joint"] = ["Hind paw tao"]
|
|
39
|
+
cfg["plot_joint_number"] = 5
|
|
40
|
+
cfg["color_palette"] = "Set2"
|
|
41
|
+
cfg["legend_outside"] = True
|
|
42
|
+
cfg["invert_y_axis"] = True
|
|
43
|
+
cfg["flip_gait_direction"] = True
|
|
44
|
+
cfg["analyse_average_x"] = True
|
|
45
|
+
cfg["standardise_x_coordinates"] = True
|
|
46
|
+
cfg["x_standardisation_joint"] = ["Hind paw tao"]
|
|
47
|
+
cfg["coordinate_standardisation_xls"] = (
|
|
48
|
+
"/Users/mahan/sciebo/PythonCode/gaita_repo/autogaita/resources/Coordinate Standardisation Table Template.xlsx"
|
|
49
|
+
)
|
|
50
|
+
cfg["hind_joints"] = ["Hind paw tao", "Ankle", "Knee", "Hip", "Iliac Crest"]
|
|
51
|
+
cfg["fore_joints"] = [
|
|
52
|
+
"Front paw tao ",
|
|
53
|
+
"Wrist ",
|
|
54
|
+
"Elbow ",
|
|
55
|
+
"Lower Shoulder ",
|
|
56
|
+
"Upper Shoulder ",
|
|
57
|
+
]
|
|
58
|
+
cfg["beam_col_left"] = ["BeamLeft"] # list of len == 1
|
|
59
|
+
cfg["beam_col_right"] = ["BeamRight"]
|
|
60
|
+
cfg["beam_hind_jointadd"] = ["Tail base ", "Tail center ", "Tail tip "]
|
|
61
|
+
cfg["beam_fore_jointadd"] = ["Nose ", "Ear base "]
|
|
62
|
+
cfg["angles"] = {
|
|
63
|
+
"name": ["Ankle ", "Knee ", "Hip "],
|
|
64
|
+
"lower_joint": ["Hind paw tao ", "Ankle ", "Knee "],
|
|
65
|
+
"upper_joint": ["Knee ", "Hip ", "Iliac Crest "],
|
|
66
|
+
}
|
|
67
|
+
# info
|
|
68
|
+
info = {}
|
|
69
|
+
info["mouse_num"] = 17
|
|
70
|
+
info["run_num"] = 3
|
|
71
|
+
info["name"] = "ID " + str(info["mouse_num"]) + " - Run " + str(info["run_num"])
|
|
72
|
+
if folderinfo["results_dir"]:
|
|
73
|
+
info["results_dir"] = os.path.join(folderinfo["results_dir"], info["name"])
|
|
74
|
+
else:
|
|
75
|
+
info["results_dir"] = os.path.join(
|
|
76
|
+
folderinfo["root_dir"], "Results", info["name"]
|
|
77
|
+
)
|
|
78
|
+
# run
|
|
79
|
+
try_to_run_gaita("DLC", info, folderinfo, cfg, False)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
# %% what happens if we just hit run
|
|
83
|
+
if __name__ == "__main__":
|
|
84
|
+
dlc_singlerun()
|
|
@@ -0,0 +1,108 @@
|
|
|
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
|
+
# Testing Dataset
|
|
19
|
+
# "one",
|
|
20
|
+
# "two",
|
|
21
|
+
# 6 Group Dataset
|
|
22
|
+
# "36w_5mm",
|
|
23
|
+
# "36w_12mm",
|
|
24
|
+
# "36w_25mm",
|
|
25
|
+
# "104w_5mm",
|
|
26
|
+
# "104w_12mm",
|
|
27
|
+
# "104w_25mm",
|
|
28
|
+
]
|
|
29
|
+
folderinfo["group_dirs"] = [
|
|
30
|
+
# --------------------------
|
|
31
|
+
# Testing Dataset
|
|
32
|
+
# "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Testing/Group 1/",
|
|
33
|
+
# "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Testing/Group 2/",
|
|
34
|
+
# --------------------------
|
|
35
|
+
# RM Dataset (example data in repo)
|
|
36
|
+
"/Users/mahan/sciebo/PythonCode/gaita_repo/example data/5mm/Results/",
|
|
37
|
+
"/Users/mahan/sciebo/PythonCode/gaita_repo/example data/12mm/Results/",
|
|
38
|
+
"/Users/mahan/sciebo/PythonCode/gaita_repo/example data/25mm/Results/",
|
|
39
|
+
# --------------------------
|
|
40
|
+
# 6 Group Dataset (nothing needed)
|
|
41
|
+
]
|
|
42
|
+
folderinfo["results_dir"] = (
|
|
43
|
+
# "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/example_data_results/"
|
|
44
|
+
"/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Testing/GroupResults/"
|
|
45
|
+
# "/Users/mahan/Desktop/Test6GroupResults/"
|
|
46
|
+
)
|
|
47
|
+
folderinfo["load_dir"] = (
|
|
48
|
+
""
|
|
49
|
+
# "/Users/mahan/sciebo/Research/AutoGaitA/Mouse/Final Mouse Results/AdultElder3BeamsForPaper" # for 6 group analysis example
|
|
50
|
+
)
|
|
51
|
+
# cfg
|
|
52
|
+
cfg = {}
|
|
53
|
+
cfg["do_permtest"] = True
|
|
54
|
+
cfg["do_anova"] = True
|
|
55
|
+
cfg["anova_design"] = "RM ANOVA"
|
|
56
|
+
cfg["permutation_number"] = 100
|
|
57
|
+
cfg["PCA_n_components"] = 6
|
|
58
|
+
# cfg["PCA_n_components"] = 0.33
|
|
59
|
+
# cfg["PCA_custom_scatter_PCs"] = "4,5,6;4,5;2,4,6"
|
|
60
|
+
cfg["PCA_custom_scatter_PCs"] = ""
|
|
61
|
+
cfg["PCA_save_3D_video"] = False # True
|
|
62
|
+
cfg["PCA_bins"] = "" # "0-10,24,50-75"
|
|
63
|
+
cfg["stats_threshold"] = 0.05
|
|
64
|
+
cfg["plot_SE"] = True
|
|
65
|
+
cfg["color_palette"] = "Set2"
|
|
66
|
+
cfg["dont_show_plots"] = True
|
|
67
|
+
cfg["legend_outside"] = True
|
|
68
|
+
cfg["which_leg"] = "left"
|
|
69
|
+
cfg["PCA_variables"] = [
|
|
70
|
+
# "Hind paw tao y",
|
|
71
|
+
# "Ankle y",
|
|
72
|
+
# "Knee y",
|
|
73
|
+
# "Ankle Angle",
|
|
74
|
+
# "Knee Angle",
|
|
75
|
+
# "Nose x",
|
|
76
|
+
# "Knee y",
|
|
77
|
+
# "Knee x",
|
|
78
|
+
# "Knee Velocity",
|
|
79
|
+
# "Knee Acceleration",
|
|
80
|
+
# "Knee Angle",
|
|
81
|
+
# "Knee Angle Velocity",
|
|
82
|
+
# "Knee Angle Acceleration",
|
|
83
|
+
# "Hip Angle",
|
|
84
|
+
]
|
|
85
|
+
cfg["stats_variables"] = [
|
|
86
|
+
# "Hind paw tao y",
|
|
87
|
+
"Ankle y",
|
|
88
|
+
# "Knee y",
|
|
89
|
+
# "Ankle Angle",
|
|
90
|
+
# "Knee Angle",
|
|
91
|
+
# "Nose x",
|
|
92
|
+
# "Knee y",
|
|
93
|
+
# "Knee x",
|
|
94
|
+
# "Knee Velocity",
|
|
95
|
+
# "Knee Acceleration",
|
|
96
|
+
# "Knee Angle",
|
|
97
|
+
# "Knee Angle Velocity",
|
|
98
|
+
# "Knee Angle Acceleration",
|
|
99
|
+
# "Hip Angle",
|
|
100
|
+
# "Elbow Angle"
|
|
101
|
+
]
|
|
102
|
+
# run
|
|
103
|
+
autogaita.group(folderinfo, cfg)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
# %% what happens if we just hit run
|
|
107
|
+
if __name__ == "__main__":
|
|
108
|
+
group_dlcrun()
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
for cfg["which_leg"] in ["left", "right"]:
|
|
12
|
+
# folderinfo
|
|
13
|
+
# => Note that length of folderinfo's group_names & group_dirs lists determines # how many groups are compared.
|
|
14
|
+
# => Also note that indices must correspond (i.e., idx # 1's name will be # used for dataset stored in group_dir's idx 1)
|
|
15
|
+
folderinfo = {}
|
|
16
|
+
folderinfo["group_names"] = ["Young", "Old"]
|
|
17
|
+
folderinfo["group_dirs"] = [
|
|
18
|
+
"/Users/mahan/sciebo/Research/AutoGaitA/Human/Testing2/Young/",
|
|
19
|
+
"/Users/mahan/sciebo/Research/AutoGaitA/Human/Testing2/Old/",
|
|
20
|
+
]
|
|
21
|
+
folderinfo["results_dir"] = (
|
|
22
|
+
"/Users/mahan/sciebo/Research/AutoGaitA/Human/Testing2/Group/"
|
|
23
|
+
+ cfg["which_leg"]
|
|
24
|
+
+ " leg/"
|
|
25
|
+
)
|
|
26
|
+
folderinfo["load_dir"] = ""
|
|
27
|
+
# cfg
|
|
28
|
+
cfg["do_permtest"] = True
|
|
29
|
+
cfg["do_anova"] = True
|
|
30
|
+
cfg["permutation_number"] = 10000
|
|
31
|
+
cfg["PCA_n_components"] = 3
|
|
32
|
+
cfg["PCA_custom_scatter_PCs"] = ""
|
|
33
|
+
cfg["PCA_bins"] = ""
|
|
34
|
+
cfg["PCA_save_3D_video"] = False
|
|
35
|
+
cfg["stats_threshold"] = 0.05
|
|
36
|
+
cfg["plot_SE"] = False
|
|
37
|
+
cfg["color_palette"] = "viridis"
|
|
38
|
+
cfg["legend_outside"] = True
|
|
39
|
+
cfg["dont_show_plots"] = True
|
|
40
|
+
cfg["anova_design"] = "Mixed ANOVA"
|
|
41
|
+
cfg["PCA_variables"] = [
|
|
42
|
+
# "Midfoot, " + cfg["which_leg"] + " Z",
|
|
43
|
+
# "Ankle, " + cfg["which_leg"] + " Z",
|
|
44
|
+
# "Knee, " + cfg["which_leg"] + " Z",
|
|
45
|
+
# "Hip, " + cfg["which_leg"] + " Z",
|
|
46
|
+
# "Skullbase Angle",
|
|
47
|
+
# "Elbow, " + cfg["which_leg"] + " Angle",
|
|
48
|
+
# "Pelvis Z",
|
|
49
|
+
# "Shoulder, " + cfg["which_leg"] + " Z",
|
|
50
|
+
]
|
|
51
|
+
cfg["stats_variables"] = [
|
|
52
|
+
"Ankle, " + cfg["which_leg"] + " Z",
|
|
53
|
+
"Ankle, " + cfg["which_leg"] + " Y",
|
|
54
|
+
"Ankle, " + cfg["which_leg"] + " Velocity",
|
|
55
|
+
"Ankle, " + cfg["which_leg"] + " Acceleration",
|
|
56
|
+
"Ankle, " + cfg["which_leg"] + " Angle",
|
|
57
|
+
"Ankle, " + cfg["which_leg"] + " Angle Velocity",
|
|
58
|
+
"Ankle, " + cfg["which_leg"] + " Angle Acceleration",
|
|
59
|
+
# "Knee, " + cfg["which_leg"] + " Z",
|
|
60
|
+
# "Shoulder, " + cfg["which_leg"] + " Angle",
|
|
61
|
+
# "Skullbase Angle",
|
|
62
|
+
# "Elbow, " + cfg["which_leg"] + " Angle",
|
|
63
|
+
]
|
|
64
|
+
# run
|
|
65
|
+
autogaita.group(folderinfo, cfg)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
# %% what happens if we just hit run
|
|
69
|
+
if __name__ == "__main__":
|
|
70
|
+
group_universal3Drun()
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
from autogaita.resources.utils import try_to_run_gaita
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
# main function
|
|
6
|
+
def sleap_singlerun():
|
|
7
|
+
"""
|
|
8
|
+
Batchrun script to run AutoGaitA SLEAP for a single dataset.
|
|
9
|
+
folderinfo & cfg dictionaries must be configured as explained in our documentation. (note that each value of these corresponds to some object in the AutoGaitA Simi GUI)
|
|
10
|
+
"""
|
|
11
|
+
# folderinfo
|
|
12
|
+
folderinfo = {}
|
|
13
|
+
folderinfo["root_dir"] = (
|
|
14
|
+
"/Users/mahan/sciebo/Research/AutoGaitA/SLEAP/Human/Analysis/Old/"
|
|
15
|
+
)
|
|
16
|
+
folderinfo["results_dir"] = ""
|
|
17
|
+
folderinfo["sctable_filename"] = "AnnotationTableOldSLEAP"
|
|
18
|
+
folderinfo["data_string"] = ""
|
|
19
|
+
folderinfo["beam_string"] = ""
|
|
20
|
+
folderinfo["premouse_string"] = "Human"
|
|
21
|
+
folderinfo["postmouse_string"] = "_Run"
|
|
22
|
+
folderinfo["prerun_string"] = "Run"
|
|
23
|
+
folderinfo["postrun_string"] = "_SLEAP"
|
|
24
|
+
|
|
25
|
+
# cfg
|
|
26
|
+
cfg = {}
|
|
27
|
+
# 25 Hz sampling rate for SLEAP's example fly dataset (3000 frames @ 2 minutes)
|
|
28
|
+
# https://github.com/talmolab/sleap/tree/main/docs/notebooks/analysis_example
|
|
29
|
+
cfg["sampling_rate"] = 100
|
|
30
|
+
cfg["subtract_beam"] = False
|
|
31
|
+
cfg["dont_show_plots"] = True
|
|
32
|
+
cfg["convert_to_mm"] = False
|
|
33
|
+
cfg["pixel_to_mm_ratio"] = 1
|
|
34
|
+
cfg["x_sc_broken_threshold"] = 200 # optional cfg
|
|
35
|
+
cfg["y_sc_broken_threshold"] = 50
|
|
36
|
+
cfg["x_acceleration"] = True
|
|
37
|
+
cfg["angular_acceleration"] = True
|
|
38
|
+
cfg["save_to_xls"] = True
|
|
39
|
+
cfg["bin_num"] = 25
|
|
40
|
+
cfg["plot_SE"] = True
|
|
41
|
+
cfg["standardise_y_at_SC_level"] = False
|
|
42
|
+
cfg["standardise_y_to_a_joint"] = False
|
|
43
|
+
cfg["y_standardisation_joint"] = ["Midfoot"]
|
|
44
|
+
cfg["plot_joint_number"] = 7
|
|
45
|
+
cfg["color_palette"] = "viridis"
|
|
46
|
+
cfg["legend_outside"] = True
|
|
47
|
+
cfg["invert_y_axis"] = True
|
|
48
|
+
cfg["flip_gait_direction"] = True
|
|
49
|
+
cfg["analyse_average_x"] = False
|
|
50
|
+
cfg["standardise_x_coordinates"] = False
|
|
51
|
+
cfg["x_standardisation_joint"] = ["Midfoot"]
|
|
52
|
+
cfg["coordinate_standardisation_xls"] = ""
|
|
53
|
+
cfg["hind_joints"] = ["Midfoot", "Ankle", "Knee", "Hip"]
|
|
54
|
+
cfg["fore_joints"] = []
|
|
55
|
+
cfg["beam_col_left"] = [] # list of len == 1
|
|
56
|
+
cfg["beam_col_right"] = []
|
|
57
|
+
cfg["beam_hind_jointadd"] = []
|
|
58
|
+
cfg["beam_fore_jointadd"] = []
|
|
59
|
+
cfg["angles"] = {
|
|
60
|
+
"name": ["Ankle", "Knee"],
|
|
61
|
+
"lower_joint": ["Midfoot", "Ankle"],
|
|
62
|
+
"upper_joint": ["Knee", "Hip"],
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
# info
|
|
66
|
+
info = {}
|
|
67
|
+
info["mouse_num"] = 32
|
|
68
|
+
info["run_num"] = 1
|
|
69
|
+
info["name"] = "ID " + str(info["mouse_num"]) + " - Run " + str(info["run_num"])
|
|
70
|
+
if folderinfo["results_dir"]:
|
|
71
|
+
info["results_dir"] = os.path.join(folderinfo["results_dir"], info["name"])
|
|
72
|
+
else:
|
|
73
|
+
info["results_dir"] = os.path.join(
|
|
74
|
+
folderinfo["root_dir"], "Results", info["name"]
|
|
75
|
+
)
|
|
76
|
+
# run
|
|
77
|
+
try_to_run_gaita("SLEAP", info, folderinfo, cfg, False)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
# %% what happens if we just hit run
|
|
81
|
+
if __name__ == "__main__":
|
|
82
|
+
sleap_singlerun()
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
from autogaita.resources.utils import try_to_run_gaita
|
|
2
|
+
import os
|
|
3
|
+
import copy
|
|
4
|
+
|
|
5
|
+
# %% main function
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def universal3D_multirun():
|
|
9
|
+
"""
|
|
10
|
+
Batchrun script to run AutoGaitA Universal 3D for a folder of datasets.
|
|
11
|
+
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 Universal 3D GUI)
|
|
12
|
+
"""
|
|
13
|
+
# folderinfo
|
|
14
|
+
folderinfo = {}
|
|
15
|
+
folderinfo["root_dir"] = "/Users/mahan/sciebo/Research/AutoGaitA/Human/Testing2/"
|
|
16
|
+
folderinfo["results_dir"] = ""
|
|
17
|
+
folderinfo["sctable_filename"] = "SC Latency Table"
|
|
18
|
+
folderinfo["postname_string"] = ""
|
|
19
|
+
# cfg
|
|
20
|
+
cfg = {}
|
|
21
|
+
cfg["sampling_rate"] = 100 # base cfg
|
|
22
|
+
cfg["dont_show_plots"] = True
|
|
23
|
+
cfg["y_acceleration"] = True
|
|
24
|
+
cfg["angular_acceleration"] = True
|
|
25
|
+
cfg["bin_num"] = 25
|
|
26
|
+
cfg["plot_SE"] = True
|
|
27
|
+
cfg["standardise_z_at_SC_level"] = True
|
|
28
|
+
cfg["standardise_z_to_a_joint"] = True
|
|
29
|
+
cfg["z_standardisation_joint"] = ["Foot, left"]
|
|
30
|
+
cfg["plot_joint_number"] = 7
|
|
31
|
+
cfg["color_palette"] = "viridis"
|
|
32
|
+
cfg["legend_outside"] = True
|
|
33
|
+
cfg["flip_gait_direction"] = False
|
|
34
|
+
cfg["analyse_average_y"] = True
|
|
35
|
+
cfg["standardise_y_coordinates"] = True
|
|
36
|
+
cfg["y_standardisation_joint"] = ["Foot"]
|
|
37
|
+
cfg["coordinate_standardisation_xls"] = ""
|
|
38
|
+
cfg["joints"] = ["Midfoot", "Ankle", "Knee", "Hip", "Pelvis", "Shoulder", "Neck"]
|
|
39
|
+
cfg["angles"] = {
|
|
40
|
+
"name": ["Ankle", "Knee"],
|
|
41
|
+
"lower_joint": ["Midfoot", "Ankle"],
|
|
42
|
+
"upper_joint": ["Knee", "Hip"],
|
|
43
|
+
}
|
|
44
|
+
# run a single gaita run for each entry of info
|
|
45
|
+
info = extract_info(folderinfo)
|
|
46
|
+
for idx, name in enumerate(info["name"]):
|
|
47
|
+
run_singlerun(idx, info, folderinfo, cfg)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
# %% local functions
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def run_singlerun(idx, info, folderinfo, cfg):
|
|
54
|
+
"""Run the main code of individual run-analyses based on current cfg"""
|
|
55
|
+
# extract and pass info of this mouse/run (also update resdir)
|
|
56
|
+
this_info = {}
|
|
57
|
+
keynames = info.keys()
|
|
58
|
+
for keyname in keynames:
|
|
59
|
+
this_info[keyname] = info[keyname][idx]
|
|
60
|
+
# make a deep copy of cfg that used in each run, otherwise changes to the cfg dict
|
|
61
|
+
# would translate to subsequent runs
|
|
62
|
+
# ==> see https://stackoverflow.com/questions/2465921/
|
|
63
|
+
# how-to-copy-a-dictionary-and-only-edit-the-copy
|
|
64
|
+
this_cfg = copy.deepcopy(cfg)
|
|
65
|
+
# important to only pass this_info to main script here (1 run at a time!)
|
|
66
|
+
try_to_run_gaita("Universal 3D", this_info, folderinfo, this_cfg, True)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def extract_info(folderinfo):
|
|
70
|
+
"""Prepare a dict of lists that include unique name infos"""
|
|
71
|
+
root_dir = folderinfo["root_dir"]
|
|
72
|
+
results_dir = folderinfo["results_dir"]
|
|
73
|
+
sctable_filename = folderinfo["sctable_filename"]
|
|
74
|
+
postname_string = folderinfo["postname_string"]
|
|
75
|
+
info = {"name": [], "results_dir": []}
|
|
76
|
+
for filename in os.listdir(root_dir):
|
|
77
|
+
# dont try to combine the two "join" if blocks into one - we want to append
|
|
78
|
+
# results dir WHENEVER we append name!
|
|
79
|
+
if not postname_string:
|
|
80
|
+
# dont use endswith below to catch .xlsx too
|
|
81
|
+
if (".xls" in filename) & (sctable_filename not in filename):
|
|
82
|
+
info["name"].append(filename.split(".xls")[0])
|
|
83
|
+
if results_dir:
|
|
84
|
+
info["results_dir"].append(
|
|
85
|
+
os.path.join(results_dir, info["name"][-1])
|
|
86
|
+
)
|
|
87
|
+
else:
|
|
88
|
+
info["results_dir"].append(
|
|
89
|
+
os.path.join(root_dir, "Results", info["name"][-1])
|
|
90
|
+
)
|
|
91
|
+
else:
|
|
92
|
+
if postname_string in filename:
|
|
93
|
+
info["name"].append(filename.split(postname_string)[0])
|
|
94
|
+
if results_dir:
|
|
95
|
+
info["results_dir"].append(
|
|
96
|
+
os.path.join(results_dir, info["name"][-1])
|
|
97
|
+
)
|
|
98
|
+
else:
|
|
99
|
+
info["results_dir"].append(
|
|
100
|
+
os.path.join(root_dir, "Results", info["name"][-1])
|
|
101
|
+
)
|
|
102
|
+
if len(info["name"]) < 1:
|
|
103
|
+
no_files_message = (
|
|
104
|
+
f"Unable to find any files at {root_dir}!" + "\ncheck your inputs!"
|
|
105
|
+
)
|
|
106
|
+
print(no_files_message)
|
|
107
|
+
return info
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
# %% what happens if we just hit run
|
|
111
|
+
if __name__ == "__main__":
|
|
112
|
+
universal3D_multirun()
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
from autogaita.resources.utils import try_to_run_gaita
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
# main function
|
|
6
|
+
def universal3D_singlerun():
|
|
7
|
+
"""
|
|
8
|
+
Batchrun script to run AutoGaitA Universal 3D for a single dataset.
|
|
9
|
+
folderinfo & cfg dictionaries must be configured as explained in our documentation. (note that each value of these corresponds to some object in the AutoGaitA Universal 3D GUI)
|
|
10
|
+
"""
|
|
11
|
+
# folderinfo
|
|
12
|
+
folderinfo = {}
|
|
13
|
+
folderinfo["root_dir"] = "/Users/mahan/sciebo/Research/AutoGaitA/Human/Testing2/"
|
|
14
|
+
# folderinfo["root_dir"] = "/Users/mahan/sciebo/Research/AutoGaitA/Fly/3D Data/"
|
|
15
|
+
folderinfo["results_dir"] = ""
|
|
16
|
+
folderinfo["sctable_filename"] = "SC Latency Table"
|
|
17
|
+
folderinfo["postname_string"] = ""
|
|
18
|
+
# cfg
|
|
19
|
+
cfg = {}
|
|
20
|
+
cfg["sampling_rate"] = 100 # base cfg
|
|
21
|
+
cfg["dont_show_plots"] = True
|
|
22
|
+
cfg["y_acceleration"] = True
|
|
23
|
+
cfg["angular_acceleration"] = True
|
|
24
|
+
cfg["bin_num"] = 25
|
|
25
|
+
cfg["plot_SE"] = True
|
|
26
|
+
cfg["standardise_z_at_SC_level"] = True
|
|
27
|
+
cfg["standardise_z_to_a_joint"] = True
|
|
28
|
+
cfg["z_standardisation_joint"] = ["Midfoot, left"]
|
|
29
|
+
cfg["plot_joint_number"] = 5
|
|
30
|
+
cfg["color_palette"] = "Set2"
|
|
31
|
+
cfg["legend_outside"] = True
|
|
32
|
+
cfg["flip_gait_direction"] = True
|
|
33
|
+
cfg["analyse_average_y"] = True
|
|
34
|
+
cfg["standardise_y_coordinates"] = True
|
|
35
|
+
cfg["y_standardisation_joint"] = ["Midfoot, left"]
|
|
36
|
+
cfg["coordinate_standardisation_xls"] = ""
|
|
37
|
+
cfg["joints"] = [
|
|
38
|
+
# "R1-ThCx",
|
|
39
|
+
"Midfoot",
|
|
40
|
+
"Ankle",
|
|
41
|
+
"Knee",
|
|
42
|
+
"Hip",
|
|
43
|
+
"Pelvis",
|
|
44
|
+
"Shoulder",
|
|
45
|
+
"Neck",
|
|
46
|
+
]
|
|
47
|
+
cfg["angles"] = {
|
|
48
|
+
"name": ["Ankle", "Knee"],
|
|
49
|
+
"lower_joint": ["Midfoot", "Ankle"],
|
|
50
|
+
"upper_joint": ["Knee", "Hip"],
|
|
51
|
+
}
|
|
52
|
+
# info
|
|
53
|
+
info = {}
|
|
54
|
+
info["name"] = "SK" # "A1" # # analyse this dataset
|
|
55
|
+
if folderinfo["results_dir"]:
|
|
56
|
+
info["results_dir"] = os.path.join(folderinfo["results_dir"], info["name"])
|
|
57
|
+
else:
|
|
58
|
+
info["results_dir"] = os.path.join(
|
|
59
|
+
folderinfo["root_dir"], "Results", info["name"]
|
|
60
|
+
)
|
|
61
|
+
# run
|
|
62
|
+
try_to_run_gaita("Universal 3D", info, folderinfo, cfg, False)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
# %% what happens if we just hit run
|
|
66
|
+
if __name__ == "__main__":
|
|
67
|
+
universal3D_singlerun()
|
|
File without changes
|