Users can download several acoustic data files at the same time.

dev-brahim
brahim 2024-09-13 14:59:13 +02:00
parent fa8e06ecdd
commit 5a98b13ad3
1 changed files with 100 additions and 262 deletions

View File

@ -1050,8 +1050,8 @@ class AcousticDataTab(QWidget):
# layout="constrained")
# self.canvas_BS = FigureCanvas(self.fig_BS)
self.canvas_BS = FigureCanvas()
self.toolbar_BS = NavigationToolBar(self.canvas_BS, self)
self.toolbar_BS = NavigationToolBar(self.canvas_BS, )
self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.addWidget(self.toolbar_BS)
# self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.removeWidget(self.scroll_BS)
@ -1100,26 +1100,33 @@ class AcousticDataTab(QWidget):
self.groupbox_plot_the_vertical_profile_for_a_frequency.setTitle("Plot the vertical profile for one frequency")
self.horizontalLayout_spacerItem_combobox_frequency_profile = QHBoxLayout()
self.verticalLayout_groupbox_plot_the_vertical_profile_for_a_frequency.addLayout(self.horizontalLayout_spacerItem_combobox_frequency_profile)
self.verticalLayout_groupbox_plot_the_vertical_profile_for_a_frequency.addLayout(
self.horizontalLayout_spacerItem_combobox_frequency_profile)
self.spacerItem_frequency_profile = QSpacerItem(50, 10, QSizePolicy.Expanding, QSizePolicy.Minimum)
# self.horizontalLayout_spacerItem_combobox_frequency_profile.addSpacerItem(self.spacerItem_frequency_profile)
self.horizontalLayout_spacerItem_combobox_frequency_profile.addSpacerItem(self.spacerItem_frequency_profile)
self.combobox_frequency_profile = QComboBox()
# self.horizontalLayout_spacerItem_combobox_frequency_profile.addWidget(self.combobox_frequency_profile)
self.horizontalLayout_spacerItem_combobox_frequency_profile.addWidget(self.combobox_frequency_profile)
self.groupbox_plot_profile = QGroupBox()
self.groupbox_plot_profile.setTitle("Profile")
self.verticalLayout_groupbox_plot_profile = QVBoxLayout(self.groupbox_plot_profile)
self.verticalLayout_groupbox_plot_the_vertical_profile_for_a_frequency.addWidget(self.groupbox_plot_profile)
# self.groupbox_plot_profile = QGroupBox()
# self.groupbox_plot_profile.setTitle("Profile")
# self.verticalLayout_groupbox_plot_profile = QVBoxLayout(self.groupbox_plot_profile)
# self.verticalLayout_groupbox_plot_the_vertical_profile_for_a_frequency.addWidget(self.groupbox_plot_profile)
# self.fig_profile, self.axis_profile = plt.subplots(nrows=1, ncols=1, layout="constrained")
# self.canvas_plot_profile = FigureCanvas(self.fig_profile)
self.canvas_plot_profile = FigureCanvas()
self.toolbar_profile = NavigationToolBar(self.canvas_plot_profile, )
self.toolbar_profile = NavigationToolBar(self.canvas_plot_profile, self)
# print("navigation toolbar item", self.toolbar_profile.toolitems)
self.horizontalLayout_spacerItem_combobox_frequency_profile.addWidget(self.toolbar_profile)
self.horizontalLayout_spacerItem_combobox_frequency_profile.addWidget(self.combobox_frequency_profile)
# self.horizontalLayout_spacerItem_combobox_frequency_profile.addWidget(self.toolbar_profile)
# self.horizontalLayout_spacerItem_combobox_frequency_profile.addWidget(self.combobox_frequency_profile)
self.verticalLayout_groupbox_plot_profile.addWidget(self.toolbar_profile)
self.verticalLayout_groupbox_plot_profile.addWidget(self.canvas_plot_profile)
# self.canvas_plot_profile = None
@ -1167,8 +1174,8 @@ class AcousticDataTab(QWidget):
self.max_selected_file = 1
# self.btnToggled()
plt.rcParams['figure.max_open_warning'] = 100
print("plt.rcParams['figure.max_open_warning'] ", plt.rcParams['figure.max_open_warning'])
# plt.rcParams['figure.max_open_warning'] = 100
# print("plt.rcParams['figure.max_open_warning'] ", plt.rcParams['figure.max_open_warning'])
# --------------------------------------------------------------------------------------------------------------
# --- Connect signal of widget ---
@ -1706,8 +1713,6 @@ class AcousticDataTab(QWidget):
self.WindowNoiseLevelTailAveragedProfile().show()
def open_dialog_box(self):
# print(self.combobox_ABS_system_choice.currentText())
# print(self.sender().objectName())
# --- Open dialog box + choice directory and select file ---
if self.combobox_ABS_system_choice.currentIndex() == 0:
@ -1718,13 +1723,19 @@ class AcousticDataTab(QWidget):
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec()
elif self.combobox_ABS_system_choice.currentIndex() == 1:
filename = QFileDialog.getOpenFileName(self, "Open file",
filename = QFileDialog.getOpenFileNames(self, "Open file",
[stg.path_BS_raw_data[-1] if self.fileListWidget.count() > 0 else ""][0],
"Aquascat file (*.aqa)")
dir_name = path.dirname(filename[0])
name = path.basename(filename[0])
print(f"dir name : {dir_name} & file name : {name}")
# print(dir_name, name)
for name in filename[0]:
stg.path_BS_raw_data.append(path.dirname(name))
stg.filename_BS_raw_data.append(path.basename(name))
stg.data_preprocessed.append(path.basename(name))
print("stg.path_BS_raw_data ", stg.path_BS_raw_data)
print("stg.filename_BS_raw_data ", stg.filename_BS_raw_data)
print("stg.data_preprocessed ", stg.data_preprocessed)
elif self.combobox_ABS_system_choice.currentIndex() == 2:
filename = QFileDialog.getOpenFileName(self, "Open file",
[stg.path_BS_raw_data[-1] if self.fileListWidget.count() > 0 else ""][0],
@ -1737,91 +1748,55 @@ class AcousticDataTab(QWidget):
# --- Fill lineEdit with path and file names + load acoustic data ---
# --- fill date, hour and measurements information + fill frequency combobox for bottom detection ---
if self.combobox_ABS_system_choice.currentIndex() != 0:
# if self.sender().objectName() == "pushbutton_acoustic_file":
# if self.sender():
# stg.path_BS_raw_data = dir_name
# stg.filename_BS_raw_data = name
# self.load_BS_acoustic_raw_data()
try:
# if self.fileListWidget.count() == 0:
# stg.path_BS_raw_data = [dir_name]
# stg.filename_BS_raw_data = [name]
# print(f"0 dir name : {dir_name} & file name : {name}")
# else:
stg.path_BS_raw_data.append(dir_name)
stg.filename_BS_raw_data.append(name)
stg.data_preprocessed.append(name)
print(f"1 dir name : {dir_name} & file name : {name}")
self.load_BS_acoustic_raw_data()
print("0 Lecture de la donnée BS")
except ValueError as e:
# print("error : ", e)
# print("1 Je suis sur la donnée BS")
msgBox = QMessageBox()
msgBox.setWindowTitle("Download Error")
msgBox.setIcon(QMessageBox.Warning)
msgBox.setText("Please select a file")
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec()
else:
print("1 Fill widget and plot graphs")
print(f"stg.path_BS_raw_data {stg.path_BS_raw_data}")
print(f"stg.filename_BS_raw_data {stg.filename_BS_raw_data}")
# self.lineEdit_acoustic_file.setText(stg.filename_BS_raw_data)
# self.lineEdit_acoustic_file.setToolTip(stg.path_BS_raw_data)
print("0. Number of filenames in fileListWidget : ", self.fileListWidget.count())
self.fileListWidget.addFilenames([stg.filename_BS_raw_data[-1]])
if self.fileListWidget.count() == 0:
for p, f in zip(stg.path_BS_raw_data, stg.filename_BS_raw_data):
self.fileListWidget.addFilenames([f])
self.fileListWidget.setToolTip(p)
else:
print("self.fileListWidget.count() ", self.fileListWidget.count())
print("stg.filename_BS_raw_data ", stg.filename_BS_raw_data)
for k in range(self.fileListWidget.count(), len(stg.filename_BS_raw_data), 1):
print("k = ", k)
self.fileListWidget.addFilenames([stg.filename_BS_raw_data[k]])
self.fileListWidget.setToolTip(stg.path_BS_raw_data[k])
print("1. Number of filenames in fileListWidget : ", self.fileListWidget.count())
# self.btnToggled()
self.fileListWidget.setToolTip(stg.path_BS_raw_data[-1])
# self.label_date_acoustic_file.clear()
# self.label_date_acoustic_file.setText(
# _translate("CONSTANT_STRING", cs.DATE) + ": " + str(stg.date[self.fileListWidget.currentRow()]))
# self.label_hour_acoustic_file.clear()
# self.label_hour_acoustic_file.setText(
# _translate("CONSTANT_STRING", cs.HOUR) + ": " + str(stg.hour[self.fileListWidget.currentRow()]))
print("2. fileListWidget : ", self.fileListWidget)
self.fill_measurements_information_groupbox()
self.fill_table()
# self.set_range_for_doubleRangeSlider_time()
# self.set_range_for_doubleRangeSlider_depth()
# self.set_range_for_doubleRangeSlider_intg_area()
self.plot_backscattered_acoustic_signal_recording()
self.update_frequency_combobox()
# self.combobox_frequency_bathymetry.clear()
# self.combobox_frequency_bathymetry.addItems([f for f in stg.freq_text[self.fileListWidget.currentRow()]])
# self.combobox_frequency_profile.clear()
# self.combobox_frequency_profile.addItems([f for f in stg.freq_text[self.fileListWidget.currentRow()]])
stg.acoustic_data = list(range(self.fileListWidget.count()))
print("helloooooooo ", stg.acoustic_data)
# if self.sender().objectName() == "pushbutton_noise_file":
# print("--- 0. Je suis dans le push button noise file ---")
# try:
# print("--- 1. Je suis dans le push button noise file ---")
# stg.path_BS_noise_data = dir_name
# stg.filename_BS_noise_data = name
# print("dir_name ", stg.path_BS_noise_data)
# print("filename ", stg.filename_BS_noise_data)
# self.load_noise_data_and_compute_SNR()
# print("0 je suis sur la donnée SNR")
# except ValueError as e:
# print("1 je suis sur la donnée SNR")
# msgBox = QMessageBox()
# msgBox.setWindowTitle("Download Error")
# msgBox.setIcon(QMessageBox.Warning)
# msgBox.setText("Please select a file")
# msgBox.setStandardButtons(QMessageBox.Ok)
# msgBox.exec()
# else:
# self.lineEdit_noise_file.setText(stg.filename_BS_noise_data)
# self.lineEdit_noise_file.setToolTip(stg.path_BS_noise_data)
# self.label_date_groupbox_noise_file.setText(
# _translate("CONSTANT_STRING", cs.DATE) + ": " + str(stg.date_noise))
# self.label_hour_groupbox_noise_file.setText(
# _translate("CONSTANT_STRING", cs.HOUR) + ": " + str(stg.hour_noise))
def rename_file_in_ListWidget(self, event):
print("souris cliqué !")
print(f"event = {event}")
@ -1908,9 +1883,9 @@ class AcousticDataTab(QWidget):
self.doubleRangeSlider_distance_from_bank.setValue(value=(5, 40))
self.combobox_frequency_bathymetry.clear()
self.doubleRangeSlider_intg_area.setRange(min=0, max=50)
self.doubleRangeSlider_intg_area.setValue(value=(5, 40))
self.spinbox_offset_next_cell.setValue(0.00)
self.spinbox_depth_min_bathy.setValue(0.00)
self.spinbox_depth_max_bathy.setValue(0.00)
self.doublespinbox_next_cell_bathy.setValue(0.00)
# --- Clear table of values ---
self.tableView.reset()
@ -1980,9 +1955,9 @@ class AcousticDataTab(QWidget):
self.doubleRangeSlider_distance_from_bank.setValue(value=(5, 40))
self.combobox_frequency_bathymetry.clear()
self.doubleRangeSlider_intg_area.setRange(min=0, max=50)
self.doubleRangeSlider_intg_area.setValue(value=(5, 40))
self.spinbox_offset_next_cell.setValue(0.00)
self.spinbox_depth_min_bathy.setValue(0.00)
self.spinbox_depth_max_bathy.setValue(0.00)
self.doublespinbox_next_cell_bathy.setValue(0.00)
# --- Clear table of values ---
self.tableView.reset()
@ -2039,118 +2014,38 @@ class AcousticDataTab(QWidget):
self.slider.setMaximum(10)
def load_BS_acoustic_raw_data(self):
print("Je suis dans le load_BS_acoustic_raw_data")
if self.combobox_ABS_system_choice.currentIndex() == 1:
print("Je suis dans le load_BS_acoustic_raw_data - 1")
acoustic_data = AcousticDataLoader(stg.path_BS_raw_data[-1] + "/" + stg.filename_BS_raw_data[-1])
# stg.ABS_name.append(self.combobox_ABS_system_choice.currentText())
# stg.BS_raw_data.append(acoustic_data._BS_raw_data)
# stg.BS_raw_data_reshape.append(acoustic_data.reshape_BS_raw_data())
# stg.depth.append(acoustic_data._r)
# stg.depth_2D.append(acoustic_data.compute_r_2D())
# stg.depth_reshape.append(acoustic_data.reshape_r())
# stg.time.append(acoustic_data._time)
# stg.time_reshape.append(acoustic_data.reshape_time())
# stg.freq.append(acoustic_data._freq)
# stg.freq_text.append(acoustic_data._freq_text)
# stg.date.append(acoustic_data._date)
# stg.hour.append(acoustic_data._hour)
# stg.nb_profiles.append(acoustic_data._nb_profiles)
# stg.nb_profiles_per_sec.append(acoustic_data._nb_profiles_per_sec)
# stg.nb_cells.append(acoustic_data._nb_cells)
# stg.cell_size.append(acoustic_data._cell_size)
# stg.pulse_length.append(acoustic_data._cell_size)
# stg.nb_pings_per_sec.append(acoustic_data._nb_pings_per_sec)
# stg.nb_pings_averaged_per_profile.append(acoustic_data._nb_pings_averaged_per_profile)
# stg.kt_read.append(acoustic_data._kt)
# stg.kt_corrected.append(acoustic_data._kt)
# stg.gain_rx.append(acoustic_data._gain_rx)
# stg.gain_tx.append(acoustic_data._gain_tx)
# stg.temperature.append(self.spinbox_temperature.value())
if self.fileListWidget.count() == 0:
# if self.fileListWidget.count() == 0:
#
# stg.ABS_name = [self.combobox_ABS_system_choice.currentText()]
# stg.BS_raw_data = [acoustic_data._BS_raw_data]
# # print("len(stg.BS_raw_data) ", len(stg.BS_raw_data))
# # print("stg.BS_raw_data[0].shape ", stg.BS_raw_data[0].shape)
# stg.BS_raw_data_reshape = [acoustic_data.reshape_BS_raw_data()]
# stg.depth = [acoustic_data._r]
# stg.depth_2D = [acoustic_data.compute_r_2D()]
# stg.depth_reshape = [acoustic_data.reshape_r()]
# stg.time = [acoustic_data._time]
# stg.time_reshape = [acoustic_data.reshape_time()]
# stg.freq = [acoustic_data._freq]
# stg.freq_text = [acoustic_data._freq_text]
# # print("freq text ", stg.freq_text)
# stg.date = [acoustic_data._date]
# stg.hour = [acoustic_data._hour]
# stg.nb_profiles = [acoustic_data._nb_profiles]
# stg.nb_profiles_per_sec = [acoustic_data._nb_profiles_per_sec]
# stg.nb_cells = [acoustic_data._nb_cells]
# stg.cell_size = [acoustic_data._cell_size]
# stg.pulse_length = [acoustic_data._cell_size]
# stg.nb_pings_per_sec = [acoustic_data._nb_pings_per_sec]
# stg.nb_pings_averaged_per_profile = [acoustic_data._nb_pings_averaged_per_profile]
# stg.kt = [acoustic_data._kt]
# stg.gain_rx = [acoustic_data._gain_rx]
# stg.gain_tx = [acoustic_data._gain_tx]
#
# else:
#
# stg.ABS_name.append(self.combobox_ABS_system_choice.currentText())
# stg.BS_raw_data.append(acoustic_data._BS_raw_data)
# stg.BS_raw_data_reshape.append(acoustic_data.reshape_BS_raw_data())
# stg.depth.append(acoustic_data._r)
# stg.depth_2D.append(acoustic_data.compute_r_2D())
# stg.depth_reshape.append(acoustic_data.reshape_r())
# stg.time.append(acoustic_data._time)
# stg.time_reshape.append(acoustic_data.reshape_time())
# stg.freq.append(acoustic_data._freq)
# stg.freq_text.append(acoustic_data._freq_text)
# stg.date.append(acoustic_data._date)
# stg.hour.append(acoustic_data._hour)
# stg.nb_profiles.append(acoustic_data._nb_profiles)
# stg.nb_profiles_per_sec.append(acoustic_data._nb_profiles_per_sec)
# stg.nb_cells.append(acoustic_data._nb_cells)
# stg.cell_size.append(acoustic_data._cell_size)
# stg.pulse_length.append(acoustic_data._cell_size)
# stg.nb_pings_per_sec.append(acoustic_data._nb_pings_per_sec)
# stg.nb_pings_averaged_per_profile.append(acoustic_data._nb_pings_averaged_per_profile)
# stg.kt.append(acoustic_data._kt)
# stg.gain_rx.append(acoustic_data._gain_rx)
# stg.gain_tx.append(acoustic_data._gain_tx)
for p, f in zip(stg.path_BS_raw_data, stg.filename_BS_raw_data):
print("p ", p)
print("f ", f)
elif self.combobox_ABS_system_choice.currentIndex() == 2:
if self.combobox_ABS_system_choice.currentIndex() == 1:
acoustic_data = AcousticDataLoaderUBSediFlow(stg.path_BS_raw_data[-1] + "/" + stg.filename_BS_raw_data[-1])
acoustic_data = AcousticDataLoader(p + "/" + f)
# stg.ABS_name.append(self.combobox_ABS_system_choice.currentText())
# stg.BS_raw_data.append(acoustic_data._BS_raw_data)
# stg.BS_raw_data_reshape.append(acoustic_data.reshape_BS_raw_data())
# stg.depth.append(acoustic_data._r)
# stg.depth_2D.append(acoustic_data.compute_r_2D())
# stg.depth_reshape.append(acoustic_data.reshape_r())
# stg.time.append(acoustic_data._time)
# stg.time_reshape.append(acoustic_data.reshape_t())
# stg.freq.append(acoustic_data._freq)
# stg.freq_text.append(acoustic_data._freq_text)
# stg.date.append(acoustic_data._date)
# stg.hour.append(acoustic_data._hour)
# stg.nb_profiles.append(acoustic_data._nb_profiles)
# stg.nb_profiles_per_sec.append(acoustic_data._nb_profiles_per_sec)
# stg.nb_cells.append(acoustic_data._nb_cells)
# stg.cell_size.append(acoustic_data._cell_size)
# stg.pulse_length.append(acoustic_data._cell_size)
# stg.nb_pings_per_sec.append(acoustic_data._nb_pings_per_sec)
# stg.nb_pings_averaged_per_profile.append(acoustic_data._nb_pings_averaged_per_profile)
# stg.kt_read.append(acoustic_data._kt)
# stg.kt_corrected.append(acoustic_data._kt)
# stg.gain_rx.append(acoustic_data._gain_rx)
# stg.gain_tx.append(acoustic_data._gain_tx)
# stg.temperature.append(self.spinbox_temperature.value())
elif self.combobox_ABS_system_choice.currentIndex() == 2:
acoustic_data = AcousticDataLoaderUBSediFlow(p + "/" + f)
self.initiate_setting_parameters(acoustic_data=acoustic_data)
else:
for k in range(self.fileListWidget.count(), len(stg.filename_BS_raw_data), 1):
if self.combobox_ABS_system_choice.currentIndex() == 1:
acoustic_data = AcousticDataLoader(stg.path_BS_raw_data[k] + "/" + stg.filename_BS_raw_data[k])
elif self.combobox_ABS_system_choice.currentIndex() == 2:
acoustic_data = AcousticDataLoaderUBSediFlow(stg.path_BS_raw_data[k] + "/" + stg.filename_BS_raw_data[k])
self.initiate_setting_parameters(acoustic_data=acoustic_data)
def initiate_setting_parameters(self, acoustic_data):
# --- The acoustic variables are field with loaded data ---
stg.ABS_name.append(self.combobox_ABS_system_choice.currentText())
@ -2181,7 +2076,6 @@ class AcousticDataTab(QWidget):
stg.water_velocity.append(0)
stg.water_attenuation.append([])
# --- The other acoustic variables lists are filled with empty object. ---
# --- They will be used for pre- and post-processing ---
@ -2240,70 +2134,6 @@ class AcousticDataTab(QWidget):
stg.SSC_fine.append(np.array([]))
stg.SSC_sand.append(np.array([]))
# if self.fileListWidget.count() == 0:
#
# stg.ABS_name = [self.combobox_ABS_system_choice.currentText()]
# stg.date = [acoustic_data._date]
# stg.hour = [acoustic_data._hour]
# stg.freq = [acoustic_data._freq]
# stg.time = [acoustic_data._time]
# stg.depth = [acoustic_data._r]
# stg.depth_2D = [acoustic_data.compute_r_2D()]
# stg.freq_text = [acoustic_data._freq_text]
# stg.BS_raw_data = [acoustic_data._BS_raw_data]
# stg.BS_raw_data_reshape = acoustic_data.reshape_BS_raw_data()
# stg.depth_reshape = acoustic_data.reshape_r()
# stg.time_reshape = acoustic_data.reshape_t()
#
# else:
#
# stg.ABS_name.append(self.combobox_ABS_system_choice.currentText())
# stg.date.append(acoustic_data._date)
# stg.hour.append(acoustic_data._hour)
# stg.freq.append(acoustic_data._freq)
# stg.time.append(acoustic_data._time)
# stg.depth.append(acoustic_data._r)
# stg.depth_2D.append(acoustic_data.compute_r_2D())
# stg.freq_text.append(acoustic_data._freq_text)
# stg.BS_raw_data.append(acoustic_data._BS_raw_data)
# stg.SNR_data = acoustic_data._SNR_data
# stg.snr_reshape = acoustic_data.reshape_SNR_data()
# print(f"r = {stg.depth}")
# def load_noise_data_and_compute_SNR(self):
# if self.combobox_ABS_system_choice.currentIndex() == 1:
#
# noise_data = AcousticDataLoader(stg.path_BS_noise_data + "/" + stg.filename_BS_noise_data)
# stg.BS_noise_raw_data = noise_data._BS_raw_data
# stg.date_noise = noise_data._date
# stg.hour_noise = noise_data._hour
# stg.time_snr = stg.time
# stg.time_snr_reshape = stg.time_reshape
# print(stg.time_snr.shape)
# noise = np.zeros(stg.BS_raw_data.shape)
# for f, _ in enumerate(noise_data._freq):
# noise[f, :, :] = np.mean(stg.BS_noise_raw_data[f, :, :], axis=(0, 1))
# stg.BS_noise_averaged_data = noise
# stg.SNR_data = np.divide((stg.BS_raw_data - stg.BS_noise_averaged_data) ** 2, stg.BS_noise_averaged_data ** 2)
# stg.SNR_reshape = np.reshape(stg.SNR_data, (stg.depth.shape[1] * stg.time.shape[1], stg.freq.shape[0]), order="F")
#
# elif self.combobox_ABS_system_choice.currentIndex() == 2:
#
# noise_data = AcousticDataLoaderUBSediFlow(stg.path_BS_noise_data + "/" + stg.filename_BS_noise_data)
# stg.BS_noise_raw_data = noise_data._BS_raw_data
# print(f"BS noise raw data : {stg.BS_noise_raw_data}")
# stg.date_noise = noise_data._date
# print(f"date noise : {stg.date_noise}")
# stg.hour_noise = noise_data._hour
# print(f"hour noise : {stg.hour_noise}")
# stg.time_snr = noise_data._time_snr
# stg.time_snr_reshape = noise_data.reshape_t_snr()
# print(f"BS shape : {stg.BS_noise_raw_data.shape}")
# # stg.SNR_data = noise_data._SNR_data
# # stg.SNR_reshape = noise_data.reshape_SNR_data()
def fill_measurements_information_groupbox(self):
# if self.combobox_ABS_system_choice.currentIndex() == 1:
@ -2495,7 +2325,7 @@ class AcousticDataTab(QWidget):
def combobox_frequency_information_update(self):
if self.fileListWidget.count() > 0:
print("stg.water_attenuation ", stg.water_attenuation)
# print("stg.water_attenuation ", stg.water_attenuation)
if stg.water_attenuation[self.fileListWidget.currentRow()]:
self.spinbox_sound_attenuation.clear()
self.spinbox_sound_attenuation.setValue(stg.water_attenuation[self.fileListWidget.currentRow()]
@ -2544,11 +2374,11 @@ class AcousticDataTab(QWidget):
self.spinbox_kt.clear()
if self.checkbox_kt.isChecked():
print("combobox information update : checkbox checked")
# print("combobox information update : checkbox checked")
self.spinbox_kt.setValue(stg.kt_corrected[self.fileListWidget.currentRow()]
[self.combobox_frequency_information.currentIndex()])
else:
print("combobox information update : checkbox unchecked")
# print("combobox information update : checkbox unchecked")
self.spinbox_kt.setValue(stg.kt_read[self.fileListWidget.currentRow()]
[self.combobox_frequency_information.currentIndex()])
self.spinbox_kt.setSuffix(f" V.m^{1.5}")
@ -2563,13 +2393,13 @@ class AcousticDataTab(QWidget):
def activate_unactivate_spinbox_kt(self):
if self.checkbox_kt.isChecked():
print(f"checkbox checked : kt corrected {stg.kt_corrected}")
# print(f"checkbox checked : kt corrected {stg.kt_corrected}")
self.spinbox_kt.setValue(stg.kt_corrected[self.fileListWidget.currentRow()]
[self.combobox_frequency_information.currentIndex()])
self.spinbox_kt.setEnabled(True)
else:
print(f"checkbox unchecked : kt read {stg.kt_read}")
# print(f"checkbox unchecked : kt read {stg.kt_read}")
self.spinbox_kt.setValue(stg.kt_read[self.fileListWidget.currentRow()]
[self.combobox_frequency_information.currentIndex()])
self.spinbox_kt.setDisabled(True)
@ -2589,13 +2419,13 @@ class AcousticDataTab(QWidget):
self.spinbox_tx.setDisabled(True)
def kt_value(self):
print(f"0 stg.kt_read : {stg.kt_read}")
print(f"0 stg.kt_corrected {stg.kt_corrected}")
# print(f"0 stg.kt_read : {stg.kt_read}")
# print(f"0 stg.kt_corrected {stg.kt_corrected}")
if self.checkbox_kt.isChecked():
stg.kt_corrected[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()] = (
self.spinbox_kt.value())
print(f"1 stg.kt_read : {stg.kt_read}")
print(f"1 stg.kt_corrected {stg.kt_corrected}")
# print(f"1 stg.kt_read : {stg.kt_read}")
# print(f"1 stg.kt_corrected {stg.kt_corrected}")
def gain_rx_value(self):
stg.gain_rx[self.fileListWidget.currentRow()][self.combobox_frequency_information.currentIndex()] =\
@ -3263,11 +3093,13 @@ class AcousticDataTab(QWidget):
if self.fileListWidget.currentRow() != -1:
self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.removeWidget(self.toolbar_BS)
self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.removeWidget(self.scroll_BS)
self.fig_BS, self.axis_BS = plt.subplots(nrows=stg.freq[self.fileListWidget.currentRow()].shape[0], ncols=1,
sharex=True, sharey=False, layout="constrained")
self.canvas_BS = FigureCanvas(self.fig_BS)
self.toolbar_BS = NavigationToolBar(self.canvas_BS, self)
# self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.addWidget(self.canvas_BS)
# self.scroll_BS = QScrollArea()
@ -3276,6 +3108,8 @@ class AcousticDataTab(QWidget):
# self.scroll_BS.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
# # self.scroll_BS.setWidgetResizable(True)
# self.scroll_BS.setAlignment(Qt.AlignCenter)
self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.addWidget(self.toolbar_BS)
self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.addWidget(self.scroll_BS)
for f, _ in enumerate(stg.freq[self.fileListWidget.currentRow()]):
@ -3690,11 +3524,15 @@ class AcousticDataTab(QWidget):
# self.slider.setMaximum(stg.BS_raw_data[self.fileListWidget.currentRow()].shape[2])
self.slider.setMaximum(stg.time[self.fileListWidget.currentRow()].shape[1])
self.verticalLayout_groupbox_plot_profile.removeWidget(self.toolbar_profile)
self.verticalLayout_groupbox_plot_profile.removeWidget(self.canvas_plot_profile)
# --- Figure to plot profiles ---
self.fig_profile, self.axis_profile = plt.subplots(nrows=1, ncols=1, layout="constrained")
self.canvas_plot_profile = FigureCanvas(self.fig_profile)
self.toolbar_profile = NavigationToolBar(self.canvas_plot_profile, self)
self.verticalLayout_groupbox_plot_profile.addWidget(self.toolbar_profile)
self.verticalLayout_groupbox_plot_profile.addWidget(self.canvas_plot_profile)
# for f, _ in enumerate(stg.freq[0]):