@@ -831,7 +831,7 @@ def _calculate_minimal_toe_clearance(
831
831
832
832
@staticmethod
833
833
def _find_mtc_index (
834
- toe_position : xr .DataArray , heel_position : xr .DataArray , toes_vel : np . ndarray
834
+ toe_position : xr .DataArray , heel_position : xr .DataArray , toes_vel : xr . DataArray
835
835
):
836
836
"""Find the time corresponding to minimal toe clearance of a specific toe.
837
837
Valid minimal toe clearance point must pass conditions
@@ -900,9 +900,9 @@ def _calculate_ap_margin_of_stability(
900
900
mos = bos_proj - xcom_proj
901
901
902
902
return {
903
- "AP_margin_of_stability" : mos ,
904
- "AP_base_of_support" : bos_proj ,
905
- "AP_xcom" : xcom_proj ,
903
+ "AP_margin_of_stability" : mos . to_numpy () ,
904
+ "AP_base_of_support" : bos_proj . to_numpy () ,
905
+ "AP_xcom" : xcom_proj . to_numpy () ,
906
906
}
907
907
908
908
def _calculate_ml_margin_of_stability (
@@ -940,7 +940,7 @@ def _calculate_ml_margin_of_stability(
940
940
sagittal_axis = self ._get_sagittal_vector (trial )
941
941
sagittal_axis = linalg .normalize_vector (sagittal_axis )
942
942
943
- if trial .events .attrs ["context" ] == "Left" :
943
+ if trial .events is not None and trial . events .attrs ["context" ] == "Left" :
944
944
# Rotate sagittal axis so it points towards the left side of the body
945
945
sagittal_axis = - sagittal_axis
946
946
@@ -959,7 +959,7 @@ def _calculate_ml_margin_of_stability(
959
959
mos = bos_proj - xcom_proj
960
960
961
961
return {
962
- "ML_margin_of_stability" : mos ,
963
- "ML_base_of_support" : bos_proj ,
964
- "ML_xcom" : xcom_proj ,
962
+ "ML_margin_of_stability" : mos . to_numpy () ,
963
+ "ML_base_of_support" : bos_proj . to_numpy () ,
964
+ "ML_xcom" : xcom_proj . to_numpy () ,
965
965
}
0 commit comments