import pandas as pd import matplotlib.pyplot as plt from scipy import signal import numpy as np import math from mpl_toolkits import mplot3d import easygui from master_funcs import * import dataframe_image as dfi import dill %matplotlib qt 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_3', 'PB_T3_24_1', 'PB_T3_24_2', 'PB_T3_24_3'] for z in patients: print(z) GW_3D='/home/user/owncloud/3D_videos/GW_3D/'+z+'_P3_GW_DLC_3D.csv' data = pd.read_csv(GW_3D, delimiter=",", skiprows=0, header=[1,2]) coln=data.columns zero='grid_top_left' x='grid_top_right' y='grid_bottom_left' data=transform(data, zero, x, y) vel, acc=vel_acc(data, '3D') fault_reset=0 max_s, last_s=max_step(data) ff=[max_s] for i in range(0, last_s): if (fault_reset==0) and ((data['forepaw_right', 'z'][i]-data[zero, 'z'][i])<0): print('foot fault at', i) ff.append(i) fault_reset=1 if (fault_reset==1) and ((data['forepaw_right', 'z'][i]-data[zero, 'z'][i])>0): fault_reset=0 if z=='PB_T2_3_1': footfault_3d=pd.DataFrame([ff], index=[z]) else: footfault_3d_temp=pd.DataFrame([ff], index=[z]) footfault_3d=footfault_3d.append(footfault_3d_temp) footfault_3d.columns=['Non Foot Fault']+['Frame #']*(footfault_3d.shape[1]-1) dfi.export(footfault_3d, '/home/user/owncloud/thesis_figures/DLC_GW_3d.png') 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_3', 'PB_T3_24_1', 'PB_T3_24_2', 'PB_T3_24_3'] for z in patients: print(z) dill.load_session('/home/user/Documents/Master/GW_'+z+'_data.pkl') pred_rfc = best_model.predict(X_test) det=np.where(pred_rfc) if z=='PB_T2_3_1': footfault_FI_3d=pd.DataFrame(det, index=[z]) else: footfault_FI_3d_temp=pd.DataFrame(det, index=[z]) footfault_FI_3d=footfault_FI_3d.append(footfault_FI_3d_temp)