Profile scrolling is done in time with the slider, and not with the number of the profile. That's for all tabs

dev-brahim
brahim 2024-10-31 13:33:28 +01:00
parent 8e359a7552
commit 76c654046a
4 changed files with 155 additions and 43 deletions

View File

@ -3959,37 +3959,42 @@ class AcousticDataTab(QWidget):
def slide_profile_number_to_begin(self): def slide_profile_number_to_begin(self):
self.slider.setValue(int(self.slider.minimum())) self.slider.setValue(int(self.slider.minimum()))
self.update_lineEdit_by_moving_slider() self.update_lineEdit_by_moving_slider()
# self.lineEdit_slider.setText(str(self.slider.value()))
def slide_profile_number_to_right(self): def slide_profile_number_to_right(self):
self.slider.setValue(int(self.slider.value()) + 1) self.slider.setValue(int(self.slider.value()) + 1)
self.update_lineEdit_by_moving_slider() self.update_lineEdit_by_moving_slider()
# self.lineEdit_slider.setText(str(self.slider.value()))
def slide_profile_number_to_left(self): def slide_profile_number_to_left(self):
self.slider.setValue(int(self.slider.value()) - 1) self.slider.setValue(int(self.slider.value()) - 1)
self.update_lineEdit_by_moving_slider() self.update_lineEdit_by_moving_slider()
# self.lineEdit_slider.setText(str(self.slider.value()))
def slide_profile_number_to_end(self): def slide_profile_number_to_end(self):
self.slider.setValue(int(self.slider.maximum())) self.slider.setValue(int(self.slider.maximum()))
self.update_lineEdit_by_moving_slider() self.update_lineEdit_by_moving_slider()
# self.lineEdit_slider.setText(str(self.slider.value()))
def profile_number_on_lineEdit(self): def profile_number_on_lineEdit(self):
self.slider.setValue( if stg.time_cross_section[self.fileListWidget.currentRow()].shape != (0,):
int(np.where(np.abs(stg.time[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex()] - self.slider.setValue(
float(self.lineEdit_slider.text().replace(",", "."))) == int(np.where(np.abs(stg.time_cross_section[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex()] -
np.nanmin(np.abs(stg.time[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex()] - float(self.lineEdit_slider.text().replace(",", "."))) ==
float(self.lineEdit_slider.text().replace(",", ".")))))[0][0])) np.nanmin(np.abs(stg.time_cross_section[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex()] -
float(self.lineEdit_slider.text().replace(",", ".")))))[0][0]))
else:
self.slider.setValue(
int(np.where(np.abs(stg.time[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex()] -
float(self.lineEdit_slider.text().replace(",", "."))) ==
np.nanmin(np.abs(stg.time[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex()] -
float(self.lineEdit_slider.text().replace(",", ".")))))[0][0]))
def update_lineEdit_by_moving_slider(self): def update_lineEdit_by_moving_slider(self):
print("min ", np.nanmin(stg.time[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex()]))
print("max ", np.nanmax(stg.time[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex()]))
if stg.time_cross_section[self.fileListWidget.currentRow()].shape != (0,): if stg.time_cross_section[self.fileListWidget.currentRow()].shape != (0,):
self.lineEdit_slider.setText( self.lineEdit_slider.setText(
str(stg.time_cross_section[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex(), self.slider.value()])) str(stg.time_cross_section[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex(), self.slider.value()-1]))
else: else:
self.lineEdit_slider.setText( self.lineEdit_slider.setText(
str(stg.time[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex(), self.slider.value()])) str(stg.time[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex(), self.slider.value()-1]))
# def plot_transect_with_SNR_data(self): # def plot_transect_with_SNR_data(self):
# if not self.lineEdit_noise_file.text(): # if not self.lineEdit_noise_file.text():

View File

@ -76,15 +76,23 @@ class AcousticInversionTab(QWidget):
### --- Combobox acoustic data choice + pushbutton Run Inversion --- ### --- Combobox acoustic data choice + pushbutton Run Inversion ---
self.combobox_acoustic_data_choice = ComboBoxShowPopUpWindow() self.pushbutton_update_acoustic_data_choice = QPushButton()
self.pushbutton_update_acoustic_data_choice.setIcon(self.icon_update)
self.pushbutton_update_acoustic_data_choice.setMaximumWidth(50)
self.horizontalLayout_Run_Inversion.addWidget(self.pushbutton_update_acoustic_data_choice)
self.combobox_acoustic_data_choice = QComboBox()
self.combobox_acoustic_data_choice.setMaximumWidth(300) self.combobox_acoustic_data_choice.setMaximumWidth(300)
self.horizontalLayout_Run_Inversion.addWidget(self.combobox_acoustic_data_choice) self.horizontalLayout_Run_Inversion.addWidget(self.combobox_acoustic_data_choice)
self.pushbutton_run_inversion = QPushButton() self.pushbutton_run_inversion = QPushButton()
self.pushbutton_run_inversion.setText("RUN INVERSION") self.pushbutton_run_inversion.setText("RUN INVERSION")
self.pushbutton_run_inversion.setMaximumWidth(100) self.pushbutton_run_inversion.setMaximumWidth(110)
self.horizontalLayout_Run_Inversion.addWidget(self.pushbutton_run_inversion) self.horizontalLayout_Run_Inversion.addWidget(self.pushbutton_run_inversion)
self.spacerItem_RunInversion = QSpacerItem(1000, 10)#, QSizePolicy.Expanding, QSizePolicy.Minimum)
self.horizontalLayout_Run_Inversion.addSpacerItem(self.spacerItem_RunInversion)
### --- Layout of groupbox in the Top horizontal layout box ### --- Layout of groupbox in the Top horizontal layout box
# Plot SSC 2D field | SSC vertical profile | Plot SSC graph sample vs inversion ===>>> FINE # Plot SSC 2D field | SSC vertical profile | Plot SSC graph sample vs inversion ===>>> FINE
@ -330,7 +338,7 @@ class AcousticInversionTab(QWidget):
# ---------------------------------------- Connect signal of widget -------------------------------------------- # ---------------------------------------- Connect signal of widget --------------------------------------------
# ============================================================================================================== # ==============================================================================================================
self.combobox_acoustic_data_choice.ShowPopUpWindowSignal.connect(self.event_combobobx_acoustic_data_choice) self.pushbutton_update_acoustic_data_choice.clicked.connect(self.update_acoustic_data_choice)
self.pushbutton_run_inversion.clicked.connect(self.function_run_inversion) self.pushbutton_run_inversion.clicked.connect(self.function_run_inversion)
@ -358,7 +366,7 @@ class AcousticInversionTab(QWidget):
# ------------------------------------ Functions for Acoustic Inversion Tab ---------------------------------------- # ------------------------------------ Functions for Acoustic Inversion Tab ----------------------------------------
# ================================================================================================================== # ==================================================================================================================
def event_combobobx_acoustic_data_choice(self): def update_acoustic_data_choice(self):
print("(stg.filename_BS_noise_data ", (stg.filename_BS_noise_data)) print("(stg.filename_BS_noise_data ", (stg.filename_BS_noise_data))
self.combobox_acoustic_data_choice.clear() self.combobox_acoustic_data_choice.clear()
@ -788,25 +796,51 @@ class AcousticInversionTab(QWidget):
def slider_profile_number_to_begin_fine(self): def slider_profile_number_to_begin_fine(self):
self.slider_fine.setValue(int(self.slider_fine.minimum())) self.slider_fine.setValue(int(self.slider_fine.minimum()))
self.lineEdit_slider_fine.setText(str(self.slider_fine.value())) self.update_lineEdit_by_moving_slider_fine()
def slider_profile_number_to_right_fine(self): def slider_profile_number_to_right_fine(self):
self.slider_fine.setValue(int(self.slider_fine.value()) + 1) self.slider_fine.setValue(int(self.slider_fine.value()) + 1)
self.lineEdit_slider_fine.setText(str(self.slider_fine.value())) self.update_lineEdit_by_moving_slider_fine()
def slider_profile_number_to_left_fine(self): def slider_profile_number_to_left_fine(self):
self.slider_fine.setValue(int(self.slider_fine.value()) - 1) self.slider_fine.setValue(int(self.slider_fine.value()) - 1)
self.lineEdit_slider_fine.setText(str(self.slider_fine.value())) self.update_lineEdit_by_moving_slider_fine()
def slider_profile_number_to_end_fine(self): def slider_profile_number_to_end_fine(self):
self.slider_fine.setValue(int(self.slider_fine.maximum())) self.slider_fine.setValue(int(self.slider_fine.maximum()))
self.lineEdit_slider_fine.setText(str(self.slider_fine.value())) self.update_lineEdit_by_moving_slider_fine()
def profile_number_on_lineEdit_fine(self): def profile_number_on_lineEdit_fine(self):
self.slider_fine.setValue(int(self.lineEdit_slider_fine.text())) if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
self.slider_fine.setValue(
int(np.where(
np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]] -
float(self.lineEdit_slider_fine.text().replace(",", "."))) ==
np.nanmin(
np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]] -
float(self.lineEdit_slider_fine.text().replace(",", ".")))))[0][0]))
else:
self.slider_fine.setValue(
int(np.where(
np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]] -
float(self.lineEdit_slider_fine.text().replace(",", "."))) ==
np.nanmin(
np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]] -
float(self.lineEdit_slider_fine.text().replace(",", ".")))))[0][0]))
def update_lineEdit_by_moving_slider_fine(self): def update_lineEdit_by_moving_slider_fine(self):
self.lineEdit_slider_fine.setText(str(self.slider_fine.value())) if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
self.lineEdit_slider_fine.setText(
str(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1], self.slider_fine.value()]))
else:
self.lineEdit_slider_fine.setText(
str(stg.time[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1], self.slider_fine.value()]))
# --- Plot fine SSC : measured vs inverted --- # --- Plot fine SSC : measured vs inverted ---
@ -1229,7 +1263,7 @@ class AcousticInversionTab(QWidget):
cbar_SSC_sand = self.figure_SSC_sand.colorbar(pcm_SSC_sand, ax=self.axis_SSC_sand, shrink=1, cbar_SSC_sand = self.figure_SSC_sand.colorbar(pcm_SSC_sand, ax=self.axis_SSC_sand, shrink=1,
location='right') location='right')
cbar_SSC_sand.set_label(label='Fine SSC (g/L', rotation=270, labelpad=15) cbar_SSC_sand.set_label(label='Sand SSC (g/L', rotation=270, labelpad=15)
elif stg.ABS_name[0] == "UB-SediFlow": elif stg.ABS_name[0] == "UB-SediFlow":
pcm_SSC_sand = self.axis_SSC_sand.pcolormesh(stg.t[0, :], pcm_SSC_sand = self.axis_SSC_sand.pcolormesh(stg.t[0, :],
@ -1386,25 +1420,51 @@ class AcousticInversionTab(QWidget):
def slider_profile_number_to_begin_sand(self): def slider_profile_number_to_begin_sand(self):
self.slider_sand.setValue(int(self.slider_sand.minimum())) self.slider_sand.setValue(int(self.slider_sand.minimum()))
self.lineEdit_slider_sand.setText(str(self.slider_sand.value())) self.update_lineEdit_by_moving_slider_sand()
def slider_profile_number_to_right_sand(self): def slider_profile_number_to_right_sand(self):
self.slider_sand.setValue(int(self.slider_sand.value()) + 1) self.slider_sand.setValue(int(self.slider_sand.value()) + 1)
self.lineEdit_slider_sand.setText(str(self.slider_sand.value())) self.update_lineEdit_by_moving_slider_sand()
def slider_profile_number_to_left_sand(self): def slider_profile_number_to_left_sand(self):
self.slider_sand.setValue(int(self.slider_sand.value()) - 1) self.slider_sand.setValue(int(self.slider_sand.value()) - 1)
self.lineEdit_slider_sand.setText(str(self.slider_sand.value())) self.update_lineEdit_by_moving_slider_sand()
def slider_profile_number_to_end_sand(self): def slider_profile_number_to_end_sand(self):
self.slider_sand.setValue(int(self.slider_sand.maximum())) self.slider_sand.setValue(int(self.slider_sand.maximum()))
self.lineEdit_slider_sand.setText(str(self.slider_sand.value())) self.update_lineEdit_by_moving_slider_sand()
def profile_number_on_lineEdit_sand(self): def profile_number_on_lineEdit_sand(self):
self.slider_sand.setValue(int(self.lineEdit_slider_sand.text())) if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
self.slider_sand.setValue(
int(np.where(
np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]] -
float(self.lineEdit_slider_sand.text().replace(",", "."))) ==
np.nanmin(
np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]] -
float(self.lineEdit_slider_sand.text().replace(",", ".")))))[0][0]))
else:
self.slider_sand.setValue(
int(np.where(
np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]] -
float(self.lineEdit_slider_sand.text().replace(",", "."))) ==
np.nanmin(
np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1]] -
float(self.lineEdit_slider_sand.text().replace(",", ".")))))[0][0]))
def update_lineEdit_by_moving_slider_sand(self): def update_lineEdit_by_moving_slider_sand(self):
self.lineEdit_slider_sand.setText(str(self.slider_sand.value())) if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
self.lineEdit_slider_sand.setText(
str(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1], self.slider_sand.value()-1]))
else:
self.lineEdit_slider_sand.setText(
str(stg.time[self.combobox_acoustic_data_choice.currentIndex()][
stg.frequency_for_inversion[1], self.slider_sand.value()-1]))
# --- Plot sand SSC : measured vs inverted --- # --- Plot sand SSC : measured vs inverted ---

View File

@ -2676,23 +2676,49 @@ class SedimentCalibrationTab(QWidget):
def slider_profile_number_to_begin_FCB(self): def slider_profile_number_to_begin_FCB(self):
self.slider_FCB.setValue(int(self.slider_FCB.minimum())) self.slider_FCB.setValue(int(self.slider_FCB.minimum()))
self.lineEdit_slider_FCB.setText(str(self.slider_FCB.value())) self.update_lineEdit_by_moving_slider_FCB()
def slider_profile_number_to_right_FCB(self): def slider_profile_number_to_right_FCB(self):
self.slider_FCB.setValue(int(self.slider_FCB.value()) + 1) self.slider_FCB.setValue(int(self.slider_FCB.value()) + 1)
self.lineEdit_slider_FCB.setText(str(self.slider_FCB.value())) self.update_lineEdit_by_moving_slider_FCB()
def slider_profile_number_to_left_FCB(self): def slider_profile_number_to_left_FCB(self):
self.slider_FCB.setValue(int(self.slider_FCB.value()) - 1) self.slider_FCB.setValue(int(self.slider_FCB.value()) - 1)
self.lineEdit_slider_FCB.setText(str(self.slider_FCB.value())) self.update_lineEdit_by_moving_slider_FCB()
def slider_profile_number_to_end_FCB(self): def slider_profile_number_to_end_FCB(self):
self.slider_FCB.setValue(int(self.slider_FCB.maximum())) self.slider_FCB.setValue(int(self.slider_FCB.maximum()))
self.lineEdit_slider_FCB.setText(str(self.slider_FCB.value())) self.update_lineEdit_by_moving_slider_FCB()
def profile_number_on_lineEdit_FCB(self): def profile_number_on_lineEdit_FCB(self):
self.slider_FCB.setValue(int(self.lineEdit_slider_FCB.text())) if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
self.slider_FCB.setValue(
int(np.where(
np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex()] -
float(self.lineEdit_slider_FCB.text().replace(",", "."))) ==
np.nanmin(
np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex()] -
float(self.lineEdit_slider_FCB.text().replace(",", ".")))))[0][0]))
else:
self.slider_FCB.setValue(
int(np.where(
np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex()] -
float(self.lineEdit_slider_FCB.text().replace(",", "."))) ==
np.nanmin(
np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex()] -
float(self.lineEdit_slider_FCB.text().replace(",", ".")))))[0][0]))
def update_lineEdit_by_moving_slider_FCB(self): def update_lineEdit_by_moving_slider_FCB(self):
self.lineEdit_slider_FCB.setText(str(self.slider_FCB.value())) if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
self.lineEdit_slider_FCB.setText(
str(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex(), self.slider_FCB.value()-1]))
else:
self.lineEdit_slider_FCB.setText(
str(stg.time[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_FCB.currentIndex(), self.slider_FCB.value()-1]))

View File

@ -3005,23 +3005,44 @@ class SignalProcessingTab(QWidget):
def slide_profile_number_to_begin(self): def slide_profile_number_to_begin(self):
self.slider.setValue(int(self.slider.minimum())) self.slider.setValue(int(self.slider.minimum()))
self.lineEdit_slider.setText(str(self.slider.value())) self.update_lineEdit_by_moving_slider()
def slide_profile_number_to_right(self): def slide_profile_number_to_right(self):
self.slider.setValue(int(self.slider.value()) + 1) self.slider.setValue(int(self.slider.value()) + 1)
self.lineEdit_slider.setText(str(self.slider.value())) self.update_lineEdit_by_moving_slider()
def profile_number_on_lineEdit(self):
self.slider.setValue(int(self.lineEdit_slider.text()))
def slide_profile_number_to_left(self): def slide_profile_number_to_left(self):
self.slider.setValue(int(self.slider.value()) - 1) self.slider.setValue(int(self.slider.value()) - 1)
self.lineEdit_slider.setText(str(self.slider.value())) self.update_lineEdit_by_moving_slider()
def slide_profile_number_to_end(self): def slide_profile_number_to_end(self):
self.slider.setValue(int(self.slider.maximum())) self.slider.setValue(int(self.slider.maximum()))
self.lineEdit_slider.setText(str(self.slider.value())) self.update_lineEdit_by_moving_slider()
def profile_number_on_lineEdit(self):
if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
self.slider.setValue(
int(np.where(
np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_frequency_profile.currentIndex()] -
float(self.lineEdit_slider.text().replace(",", "."))) ==
np.nanmin(
np.abs(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_frequency_profile.currentIndex()] -
float(self.lineEdit_slider.text().replace(",", ".")))))[0][0]))
else:
self.slider.setValue(
int(np.where(
np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_frequency_profile.currentIndex()] -
float(self.lineEdit_slider.text().replace(",", "."))) ==
np.nanmin(
np.abs(stg.time[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_frequency_profile.currentIndex()] -
float(self.lineEdit_slider.text().replace(",", ".")))))[0][0]))
def update_lineEdit_by_moving_slider(self): def update_lineEdit_by_moving_slider(self):
self.lineEdit_slider.setText(str(self.slider.value())) if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
self.lineEdit_slider.setText(
str(stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_profile.currentIndex(), self.slider.value()-1]))
else:
self.lineEdit_slider.setText(
str(stg.time[self.combobox_acoustic_data_choice.currentIndex()][
self.combobox_frequency_profile.currentIndex(), self.slider.value()-1]))