From 11ced0a263ca657902256000c9236adc90046d21 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Rouby Date: Mon, 17 Mar 2025 10:44:49 +0100 Subject: [PATCH] Mainwindow: Minor change. --- View/mainwindow.py | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/View/mainwindow.py b/View/mainwindow.py index 0ef2704..b1a87a2 100644 --- a/View/mainwindow.py +++ b/View/mainwindow.py @@ -326,23 +326,21 @@ class Ui_MainWindow(object): self.open_doc_file('Tutorial_AQUAscat_software.pdf') def export_table_of_acoustic_BS_values_to_excel_or_libreOfficeCalc_file(self): - if len(stg.BS_raw_data_reshape) != 0: - - # --- Open file dialog to select the directory --- - - name = QtWidgets.QFileDialog.getExistingDirectory(caption="Select Directory - Acoustic BS raw data Table") + name = QtWidgets.QFileDialog.getExistingDirectory( + caption="Select Directory - Acoustic BS raw data Table" + ) print("name table to save ", name) - # --- Save the raw acoustic backscatter data from a Dataframe to csv file --- + # --- Save the raw acoustic backscatter data from a + # --- Dataframe to csv file --- t0 = time.time() - print("len(stg.BS_raw_data_reshape) ", len(stg.BS_raw_data_reshape)) + print("len(stg.BS_raw_data_reshape) ", + len(stg.BS_raw_data_reshape)) if name: - for i in range(len(stg.BS_raw_data_reshape)): - header_list = [] header_list.clear() table_data = np.array([[]]) @@ -352,17 +350,28 @@ class Ui_MainWindow(object): header_list.append("BS - " + freq_value) if freq_ind == 0: - table_data = np.vstack((np.vstack((stg.time_reshape[i][:, freq_ind], - stg.depth_reshape[i][:, freq_ind])), - stg.BS_raw_data_reshape[i][:, freq_ind])) + table_data = np.vstack( + ( + np.vstack( + (stg.time_reshape[i][:, freq_ind], + stg.depth_reshape[i][:, freq_ind])), + stg.BS_raw_data_reshape[i][:, freq_ind] + ) + ) else: - table_data = np.vstack((table_data, - np.vstack((np.vstack( - (stg.time_reshape[i][:, freq_ind], - stg.depth_reshape[i][:, freq_ind])), - stg.BS_raw_data_reshape[i][:, freq_ind])) - )) + table_data = np.vstack( + ( + table_data, + np.vstack(( + np.vstack(( + stg.time_reshape[i][:, freq_ind], + stg.depth_reshape[i][:, freq_ind] + )), + stg.BS_raw_data_reshape[i][:, freq_ind] + )) + ) + ) DataFrame_acoustic = pd.DataFrame(None) DataFrame_acoustic = pd.DataFrame(