import pandas as pd import matplotlib.pyplot as plt from scipy import signal import numpy as np import math import easygui from master_funcs import * import dill import dataframe_image as dfi patients=['PB_T2_3_1', 'PB_T2_3_2', 'PB_T2_3_3', 'PB_T2_4_2', 'PB_T2_5_1', 'PB_T2_6_1', 'PB_T2_6_2', 'PB_T3_23_1', 'PB_T3_23_2', 'PB_T3_23_3', 'PB_T3_24_1', 'PB_T3_24_2', 'PB_T3_24_3'] for z in patients: print(z) pathway='/home/user/owncloud/3D_videos/GW_2D/'+z+'_P3_GW_camera-1DLC_resnet50_GridWalk_camera-1Jun15shuffle1_250000.csv' data=prep_dlc(pathway, 0.9, 1080) names=[i[0] for i in data.columns[::3]] for j in names: data[j, 'x']=data[j, 'x'].interpolate(method='polynomial', order=1) data[j, 'y']=data[j, 'y'].interpolate(method='polynomial', order=1) dill.load_session('/home/user/Documents/Master/GW_2D_'+z+'_data_save.pkl') ff=[math.nan] length=[len(data), len(df_vel_acc1)] for i in range(0, np.min(length)): if (df_vel_acc1['angle_acceleration_shoulder_right_forepaw_right_shoulder_left'][i]>30) and (df_vel_acc1['angle_shoulder_right_forepaw_right_shoulder_left'][i]>140): ff.append(i) print('footfault at ', i) if z=='PB_T2_3_1': footfault_2d=pd.DataFrame([ff], index=[z]) else: footfault_2d_temp=pd.DataFrame([ff], index=[z]) footfault_2d=footfault_2d.append(footfault_2d_temp) pred_rfc_footfault_2d = best_model.predict(X_test) det_footfault_2d=np.where(pred_rfc_footfault_2d) if z=='PB_T2_3_1': footfault_FI_2d=pd.DataFrame(det_footfault_2d, index=[z]) else: footfault_FI_temp_2d=pd.DataFrame(det_footfault_2d, index=[z]) footfault_FI_2d=footfault_FI_2d.append(footfault_FI_temp_2d) footfault_2d.columns=['Non Footfault']+['Footfault']*(footfault_2d.shape[1]-1) dfi.export(footfault_2d, '/home/user/owncloud/thesis_figures/DLC_GW_2d.png')