Fixed kinematics() when no marker augmentation

This commit is contained in:
davidpagnon 2024-10-04 13:39:28 +02:00
parent b11279f571
commit 8d536686ea
2 changed files with 4 additions and 4 deletions

View File

@ -481,7 +481,7 @@ def filter_all(config_dict):
# Read trc coordinates values # Read trc coordinates values
trc_df = pd.read_csv(t_in, sep="\t", skiprows=4) trc_df = pd.read_csv(t_in, sep="\t", skiprows=4)
frames_col, time_col = trc_df.iloc[:,0], trc_df.iloc[:,1] frames_col, time_col = trc_df.iloc[:,0], trc_df.iloc[:,1]
Q_coord = trc_df.drop(trc_df.columns[[0, 1]], axis=1) Q_coord = trc_df.drop(trc_df.columns[[0, 1, -1]], axis=1)
# Filter coordinates # Filter coordinates
Q_filt = Q_coord.apply(filter1d, axis=0, args = [config_dict, filter_type, frame_rate]) Q_filt = Q_coord.apply(filter1d, axis=0, args = [config_dict, filter_type, frame_rate])
@ -489,7 +489,7 @@ def filter_all(config_dict):
# Display figures # Display figures
if display_figures: if display_figures:
# Retrieve keypoints # Retrieve keypoints
keypoints_names = pd.read_csv(t_in, sep="\t", skiprows=3, nrows=0).columns[2::3].to_numpy() keypoints_names = pd.read_csv(t_in, sep="\t", skiprows=3, nrows=0).columns[2::3][:-1].to_numpy()
display_figures_fun(Q_coord, Q_filt, time_col, keypoints_names, person_id) display_figures_fun(Q_coord, Q_filt, time_col, keypoints_names, person_id)
# Reconstruct trc file with filtered coordinates # Reconstruct trc file with filtered coordinates

View File

@ -214,8 +214,8 @@ def make_trc(config_dict, Q, keypoints_names, f_range, id_person=-1):
header_trc = ['PathFileType\t4\t(X/Y/Z)\t' + trc_f, header_trc = ['PathFileType\t4\t(X/Y/Z)\t' + trc_f,
'DataRate\tCameraRate\tNumFrames\tNumMarkers\tUnits\tOrigDataRate\tOrigDataStartFrame\tOrigNumFrames', 'DataRate\tCameraRate\tNumFrames\tNumMarkers\tUnits\tOrigDataRate\tOrigDataStartFrame\tOrigNumFrames',
'\t'.join(map(str,[DataRate, CameraRate, NumFrames, NumMarkers, 'm', OrigDataRate, f_range[0], f_range[1]])), '\t'.join(map(str,[DataRate, CameraRate, NumFrames, NumMarkers, 'm', OrigDataRate, f_range[0], f_range[1]])),
'Frame#\tTime\t' + '\t\t\t'.join(keypoints_names) + '\t\t', 'Frame#\tTime\t' + '\t\t\t'.join(keypoints_names) + '\t\t\t',
'\t\t'+'\t'.join([f'X{i+1}\tY{i+1}\tZ{i+1}' for i in range(len(keypoints_names))])] '\t\t'+'\t'.join([f'X{i+1}\tY{i+1}\tZ{i+1}' for i in range(len(keypoints_names))]) + '\t']
# Zup to Yup coordinate system # Zup to Yup coordinate system
Q = zup2yup(Q) Q = zup2yup(Q)