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/CY_2D/'+z+'_P3_CY_camera-1DLC_resnet50_Cylinder_camera-1Jun15shuffle1_250000_filtered.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/CY_2D_'+z+'_data_save.pkl') touch_reset=0 drag_reset=0 touch=[] drag=[] length=[len(data), len(df_vel_acc1)] for i in range(0, np.min(length)): if data['snout', 'y'][i]>data['cylinder_top', 'y'][i]: #touch right if (touch_reset==0) and (df_vel_acc1['angle_shoulder_right_elbow_right_wrist_right'][i]>150): touch.append(i) touch_reset=1 print('touch at ', i) #drag right if (drag_reset==0) and (df_vel_acc1['angle_acceleration_tailbase_shoulder_right_wrist_right'][i]>30): drag.append(i) drag_reset=1 print('drag at ', i) if (touch_reset==1) and (data['snout', 'y'][i]