@@ -39,17 +39,23 @@ def test_load_config():
39
39
40
40
def test_load_c3d_trial ():
41
41
config = api .load_config ("./tests/pig_config.yaml" )
42
- trial = api .load_c3d_trial ("./tests/test_small .c3d" , config )
42
+ trial = api .load_c3d_trial ("./tests/treadmill_events .c3d" , config )
43
43
assert len (trial .get_all_data ().keys ()) == 3
44
44
assert trial .events is not None
45
45
46
46
47
+ def test_load_c3d_trial_no_events ():
48
+ config = api .load_config ("./tests/pig_config.yaml" )
49
+ trial = api .load_c3d_trial ("./tests/treadmill_no_events.c3d" , config )
50
+ assert trial .events is None
51
+
52
+
47
53
def test_detect_events ():
48
54
config = api .load_config ("./tests/pig_config.yaml" )
49
- trial = api .load_c3d_trial ("./tests/test_small .c3d" , config )
55
+ trial = api .load_c3d_trial ("./tests/treadmill_events .c3d" , config )
50
56
event_table = api .detect_events (trial , config , distance = 1000 )
51
57
assert event_table is not None
52
- assert len (event_table ) == 4
58
+ assert len (event_table ) == 5
53
59
54
60
55
61
def test_detect_events_methode ():
@@ -61,7 +67,7 @@ def test_detect_events_methode():
61
67
62
68
def test_check_events ():
63
69
config = api .load_config ("./tests/pig_config.yaml" )
64
- trial = api .load_c3d_trial ("./tests/test_small .c3d" , config )
70
+ trial = api .load_c3d_trial ("./tests/treadmill_events .c3d" , config )
65
71
api .check_events (trial .events )
66
72
assert True
67
73
@@ -73,15 +79,15 @@ def test_check_events_methode():
73
79
74
80
def test_write_events (out_path ):
75
81
config = api .load_config ("./tests/pig_config.yaml" )
76
- trial = api .load_c3d_trial ("./tests/test_small .c3d" , config )
82
+ trial = api .load_c3d_trial ("./tests/treadmill_events .c3d" , config )
77
83
event_table = api .detect_events (trial , config , distance = 1000 )
78
- api .write_events_to_c3d ("./tests/test_small .c3d" , event_table , out_path )
84
+ api .write_events_to_c3d ("./tests/treadmill_no_events .c3d" , event_table , out_path )
79
85
assert True
80
86
81
87
82
88
def test_segment_trial ():
83
89
config = api .load_config ("./tests/pig_config.yaml" )
84
- trial = api .load_c3d_trial ("./tests/test_small .c3d" , config )
90
+ trial = api .load_c3d_trial ("./tests/treadmill_events .c3d" , config )
85
91
segm_trial = api .segment_trial (trial )
86
92
assert len (segm_trial .get_all_cycles ().keys ()) == 2
87
93
@@ -100,22 +106,22 @@ def test_segment_trial_method():
100
106
101
107
def test_time_normalize_trail ():
102
108
config = api .load_config ("./tests/pig_config.yaml" )
103
- trial = api .load_c3d_trial ("./tests/test_small .c3d" , config )
109
+ trial = api .load_c3d_trial ("./tests/treadmill_events .c3d" , config )
104
110
norm_trial = api .time_normalise_trial (trial )
105
111
assert norm_trial is not None
106
112
107
113
108
114
def test_time_normalize_cycle_trial ():
109
115
config = api .load_config ("./tests/pig_config.yaml" )
110
- trial = api .load_c3d_trial ("./tests/test_small .c3d" , config )
116
+ trial = api .load_c3d_trial ("./tests/treadmill_events .c3d" , config )
111
117
trial_cycles = api .segment_trial (trial )
112
118
norm_trial = api .time_normalise_trial (trial_cycles )
113
119
assert norm_trial is not None
114
120
115
121
116
122
def test_time_normalize_trial_frames ():
117
123
config = api .load_config ("./tests/pig_config.yaml" )
118
- trial = api .load_c3d_trial ("./tests/test_small .c3d" , config )
124
+ trial = api .load_c3d_trial ("./tests/treadmill_events .c3d" , config )
119
125
trial_cycles = api .segment_trial (trial )
120
126
norm_trial = api .time_normalise_trial (trial_cycles , n_frames = 200 )
121
127
markers = norm_trial .get_cycle ("Left" , 0 ).get_data (model .DataCategory .MARKERS )
@@ -124,15 +130,15 @@ def test_time_normalize_trial_frames():
124
130
125
131
def test_calculate_features ():
126
132
config = api .load_config ("./tests/pig_config.yaml" )
127
- trial = api .load_c3d_trial ("./tests/test_small .c3d" , config )
133
+ trial = api .load_c3d_trial ("./tests/treadmill_events .c3d" , config )
128
134
trial_cycles = api .segment_trial (trial )
129
135
features = api .calculate_features (trial_cycles , config )
130
- assert features .shape == (2 , 2 , 2278 )
136
+ assert features .shape == (2 , 10 , 2278 )
131
137
132
138
133
139
def test_export_trial (out_folder ):
134
140
config = api .load_config ("./tests/pig_config.yaml" )
135
- trial = api .load_c3d_trial ("./tests/test_small .c3d" , config )
141
+ trial = api .load_c3d_trial ("./tests/treadmill_events .c3d" , config )
136
142
api .export_trial (trial , out_folder )
137
143
assert (out_folder / "markers.nc" ).exists ()
138
144
assert (out_folder / "analogs.nc" ).exists ()
@@ -141,7 +147,7 @@ def test_export_trial(out_folder):
141
147
142
148
def test_export_segmented_trial (out_folder ):
143
149
config = api .load_config ("./tests/pig_config.yaml" )
144
- trial = api .load_c3d_trial ("./tests/test_small .c3d" , config )
150
+ trial = api .load_c3d_trial ("./tests/treadmill_events .c3d" , config )
145
151
trial_cycles = api .segment_trial (trial )
146
152
api .export_trial (trial_cycles , out_folder )
147
153
assert (out_folder / "markers.nc" ).exists ()
0 commit comments