diff --git a/Model/read_table_for_open.py b/Model/read_table_for_open.py index 097551e..60cf2d5 100644 --- a/Model/read_table_for_open.py +++ b/Model/read_table_for_open.py @@ -526,101 +526,58 @@ class ReadTableForOpen: ) def read_table_table_sediment_data(self): - query5 = f'''SELECT sample_fine_name, sample_fine_index, distance_from_bank_fine, depth_fine, time_fine, - Ctot_fine, Ctot_fine_per_cent, D50_fine, frac_vol_fine, frac_vol_fine_cumul, - sample_sand_name, sample_sand_index, distance_from_bank_sand, depth_sand, time_sand, - Ctot_sand, Ctot_sand_per_cent, D50_sand, frac_vol_sand, frac_vol_sand_cumul - from SedimentsData''' + np_f64_parse = lambda d: np.frombuffer(d, dtype=np.float64) - data5 = self.execute(query5) + query = f''' + SELECT + sample_fine_name, sample_fine_index, distance_from_bank_fine, + depth_fine, time_fine, Ctot_fine, Ctot_fine_per_cent, D50_fine, + frac_vol_fine, frac_vol_fine_cumul, + + sample_sand_name, sample_sand_index, distance_from_bank_sand, + depth_sand, time_sand, Ctot_sand, Ctot_sand_per_cent, D50_sand, + frac_vol_sand, frac_vol_sand_cumul + FROM SedimentsData + ''' + + data = self.execute(query) stg.frac_vol_fine = [] stg.frac_vol_fine_cumul = [] stg.frac_vol_sand = [] stg.frac_vol_sand_cumul = [] - for f in range(len(data5)): - stg.sample_fine.append((data5[f][0], data5[f][1])) - stg.distance_from_bank_fine.append(data5[f][2]) - stg.depth_fine.append(data5[f][3]) - stg.time_fine.append(data5[f][4]) - stg.Ctot_fine.append(data5[f][5]) - stg.Ctot_fine_per_cent.append(data5[f][6]) - stg.D50_fine.append(data5[f][7]) - print("np.frombuffer(data4[f][8], dtype=np.float64) ", np.frombuffer(data5[f][8], dtype=np.float64)) - stg.frac_vol_fine.append(np.frombuffer(data5[f][8], dtype=np.float64)) - stg.frac_vol_fine_cumul.append(np.frombuffer(data5[f][9], dtype=np.float64)) - stg.sample_sand.append((data5[f][10], data5[f][11])) - stg.distance_from_bank_sand.append(data5[f][12]) - stg.depth_sand.append(data5[f][13]) - stg.time_sand.append(data5[f][14]) - stg.Ctot_sand.append(data5[f][15]) - stg.Ctot_sand_per_cent.append(data5[f][16]) - stg.D50_sand.append(data5[f][17]) - stg.frac_vol_sand.append(np.frombuffer(data5[f][18], dtype=np.float64)) - stg.frac_vol_sand_cumul.append(np.frombuffer(data5[f][19], dtype=np.float64)) + for f in range(len(data)): + stg.sample_fine.append((data[f][0], data[f][1])) + stg.distance_from_bank_fine.append(data[f][2]) + stg.depth_fine.append(data[f][3]) + stg.time_fine.append(data[f][4]) + stg.Ctot_fine.append(data[f][5]) + stg.Ctot_fine_per_cent.append(data[f][6]) + stg.D50_fine.append(data[f][7]) + stg.frac_vol_fine.append( + np_f64_parse(data[f][8]) + ) + stg.frac_vol_fine_cumul.append( + np_f64_parse(data[f][9]) + ) + stg.sample_sand.append((data[f][10], data[f][11])) + stg.distance_from_bank_sand.append(data[f][12]) + stg.depth_sand.append(data[f][13]) + stg.time_sand.append(data[f][14]) + stg.Ctot_sand.append(data[f][15]) + stg.Ctot_sand_per_cent.append(data[f][16]) + stg.D50_sand.append(data[f][17]) + stg.frac_vol_sand.append( + np_f64_parse(data[f][18]) + ) + stg.frac_vol_sand_cumul.append( + np_f64_parse(data[f][19]) + ) stg.frac_vol_fine = np.array(stg.frac_vol_fine) stg.frac_vol_fine_cumul = np.array(stg.frac_vol_fine_cumul) stg.frac_vol_sand = np.array(stg.frac_vol_sand) stg.frac_vol_sand_cumul = np.array(stg.frac_vol_sand_cumul) - # print("data 4 : ", len(data4), data4) - print('data 5 :') - print(stg.Ctot_fine, stg.sample_sand) - print(type(stg.frac_vol_fine_cumul), stg.frac_vol_fine_cumul) - - def fill_acoustic_data_tab(self): - print("start fill acoustic data tab") - - # tab_adt = AcousticDataTab(self.master_widget) - print("1 AcousticDataTab ", id(AcousticDataTab)) - print("tab_adt.combobox_ABS_system_choice ", self.tab.combobox_ABS_system_choice) - self.tab.combobox_ABS_system_choice.editTextChanged.connect(self.tab.ABS_system_choice) - if stg.ABS_name[0] == "AQUAscat": - self.tab.combobox_ABS_system_choice.setCurrentText(stg.ABS_name[0]) - print("combobox_ABS_system_choice.setCurrentIndex(1)", self.tab.combobox_ABS_system_choice.itemText(1), - self.tab.combobox_ABS_system_choice.itemText(2)) - else: - self.tab.combobox_ABS_system_choice.setCurrentText(stg.ABS_name[0]) - - self.tab.plot_backscattered_acoustic_signal_recording() - # app = QApplication(sys.argv) - - # sys.exit(app.exec_()) - - def reshape_variables(self): - - for i in stg.acoustic_data: - for f, _ in enumerate(stg.freq[i]): - - if f == 0: - - depth_temp = np.array([ - stg.depth_reshape[i][np.where(stg.depth_reshape[i][:, f] == stg.depth_reshape[i][0, f])[0][0]: - np.where(stg.depth_reshape[i][:, f] == stg.depth_reshape[i][0, f])[0][1], f] - ]) - - time_temp = np.array([ - stg.time_reshape[i][ - np.where(stg.depth_reshape[i][:, f] == stg.depth_reshape[i][0, f])[0], f] - ]) - - else: - # print(np.where(stg.depth_reshape[i][:, f] == stg.depth_reshape[i][0, f])) - depth_temp = np.insert(depth_temp, - depth_temp.shape[0], - stg.depth_reshape[i][np.where(stg.depth_reshape[i][:, f] == stg.depth_reshape[i][0, f])[0][0]: - np.where(stg.depth_reshape[i][:, f] == stg.depth_reshape[i][0, f])[0][1], f], - axis=0) - time_temp = np.insert(time_temp, - time_temp.shape[0], - stg.time_reshape[i][ - np.where(stg.depth_reshape[i][:, f] == stg.depth_reshape[i][0, f])[0], f], - axis=0) - - stg.depth.append(depth_temp) - stg.time.append(time_temp) - - stg.BS_raw_data.append(np.reshape(stg.BS_raw_data_reshape[i], - (len(stg.freq[i]), stg.depth[i].shape[1], stg.time[i].shape[1]))) + logger.debug(f"fine: {stg.Ctot_fine}, sand: {stg.sample_sand}")