# acc_smo = np.gradient(v_avg_filter, 1/freq) # acc_sg = np.gradient(v_avg_savgol, 1/freq) # fig, ax = plt.subplots() # ax.plot(acc_smo[50:85]) # ax.plot(acc_sg[50:85]) # ax.plot(acc[50:85]) # acc_max_sg = np.nanmax(np.abs(acc_sg)) # acc_max_smo = np.nanmax(np.abs(acc_smo)) path2 = 'C:\PIV_Processed\Fields_Smoothed\Smoothed_R_h1_f1200_1_p14' v_values_smoothed = np.load(os.path.join(path2, 'v_values_smoothed.npy')) x_tensor = np.load(os.path.join(path2, 'x_values.npy')) Fol_Sol = 'C:\PIV_Processed\Images_Processed\Rise_64_16_peak2RMS\Results_R_h1_f1200_1_p14_64_16' Fol_Raw = ppf.get_raw_folder(Fol_Sol) Height, Width = ppf.get_img_shape(Fol_Raw) Dt = 1 / 1200 test = v_values_smoothed[:, -5:, :] test2 = x_tensor[0, -1, :] v_avg = np.trapz(test, test2, axis=-1) / Width # average along the vertical axis to get the average velocity as a # function of time v_mean = np.mean(v_avg, axis=1) # smooth this velocity heavily v_filter, DUMMY, DUMMY, DUMMY = smo(v_mean, s=100, isrobust=True) fig, ax = plt.subplots() ax.plot(v_filter) # ax.plot(v_mean) # calculate the acceleration
Dpi = 65 # dpi of the figures ############################################################################## ################ iterate over all the runs ################################### ############################################################################## # for i in range(0,len(Run_List)): for i in range(5, len(Run_List)): # for i in range(1,5): Run = ppf.cut_processed_name(Run_List[i]) print('Exporting Run ' + Run) # give the input folder for the data Fol_Out = ppf.create_folder(Fol_PP + Run + os.sep) Fol_In = Data_Location + 'Images_Processed' + os.sep + 'Fall' + Settings +\ '_peak2RMS'+ os.sep + 'Results_' + Run + Settings Fol_Raw = ppf.get_raw_folder(Fol_In) Fol_Smo = ppf.get_smo_folder(Fol_In) # load the smoothed data from the .npy files x_tensor = np.load(os.path.join(Fol_Smo, 'x_values.npy')) y_tensor = np.load(os.path.join(Fol_Smo, 'y_values.npy')) u_tensor = np.load(os.path.join(Fol_Smo, 'u_values.npy')) v_tensor_raw = np.load(os.path.join(Fol_Smo, 'v_values_raw.npy')) v_tensor_smo = np.load(os.path.join(Fol_Smo, 'v_values_smoothed.npy')) # set the constants of the images to go from px/frame to mm/s Height, Width = ppf.get_img_shape(Fol_Raw) # image width in pixels Scale = Width / 5 # scaling factor in px/mm Dt = 1 / ppf.get_frequency(Fol_Raw) # time between images Factor = 1 / (Scale * Dt) # conversion factor to go from px/frame to mm/s