Water attenuation spinbox is activated when the Enter key is pressed.

dev-brahim
brahim 2024-07-25 15:26:14 +02:00
parent fe52e097e7
commit 3e52edb45b
1 changed files with 11 additions and 4 deletions

View File

@ -242,6 +242,7 @@ class AcousticDataTab(QWidget):
self.spinbox_temperature = QDoubleSpinBox() self.spinbox_temperature = QDoubleSpinBox()
self.spinbox_temperature.setSuffix("°C") self.spinbox_temperature.setSuffix("°C")
self.spinbox_temperature.setKeyboardTracking(False)
self.label_speed_of_sound = QLabel("Speed of sound : ") self.label_speed_of_sound = QLabel("Speed of sound : ")
@ -1196,7 +1197,8 @@ class AcousticDataTab(QWidget):
self.radiobutton_value.toggled.connect(self.onClicked_radiobutton_gps) self.radiobutton_value.toggled.connect(self.onClicked_radiobutton_gps)
self.radiobutton_file.toggled.connect(self.onClicked_radiobutton_gps) self.radiobutton_file.toggled.connect(self.onClicked_radiobutton_gps)
self.spinbox_temperature.valueChanged.connect(self.temperature_value) # self.spinbox_temperature.valueChanged.connect(self.temperature_value)
self.spinbox_temperature.lineEdit().returnPressed.connect(self.temperature_value)
# self.spinbox_tmax.lineEdit().returnPressed.connect(self.time_spin_box_value) # self.spinbox_tmax.lineEdit().returnPressed.connect(self.time_spin_box_value)
# self.spinbox_tmax.lineEdit().returnPressed.connect(self.compute_time) # self.spinbox_tmax.lineEdit().returnPressed.connect(self.compute_time)
@ -1672,10 +1674,13 @@ class AcousticDataTab(QWidget):
stg.water_velocity[self.fileListWidget.currentRow()] = C stg.water_velocity[self.fileListWidget.currentRow()] = C
self.spinbox_speed_of_sound.setValue(stg.water_velocity[self.fileListWidget.currentRow()]) self.spinbox_speed_of_sound.setValue(stg.water_velocity[self.fileListWidget.currentRow()])
print("water velocity ", stg.water_velocity)
# -------- Computing water attenuation coefficient ----------- # # -------- Computing water attenuation coefficient ----------- #
def water_attenuation(self): def water_attenuation(self):
"""Computing attenuation from François and Garrison 1982""" """Computing attenuation from François and Garrison 1982"""
stg.water_attenuation[self.fileListWidget.currentRow()].clear()
for f in stg.freq[self.fileListWidget.currentRow()]: for f in stg.freq[self.fileListWidget.currentRow()]:
if self.spinbox_temperature.value() > 20: if self.spinbox_temperature.value() > 20:
alpha = ((3.964 * 1e-4 - alpha = ((3.964 * 1e-4 -
@ -1692,9 +1697,11 @@ class AcousticDataTab(QWidget):
stg.water_attenuation[self.fileListWidget.currentRow()].append(alpha) stg.water_attenuation[self.fileListWidget.currentRow()].append(alpha)
self.spinbox_sound_attenuation.setValue(stg.water_attenuation[self.fileListWidget.currentRow()] self.spinbox_sound_attenuation.setValue(stg.water_attenuation[self.fileListWidget.currentRow()]
[self.combobox_frequency_information.currentIndex()]) [self.combobox_frequency_information.currentIndex()])
print("water attenuation ", stg.water_attenuation)
def clicked_pushbutton_noise_level(self): def clicked_pushbutton_noise_level(self):
self.WindowNoiseLevelTailAveragedProfile().show() self.WindowNoiseLevelTailAveragedProfile().show()
@ -4223,8 +4230,8 @@ class AcousticDataTab(QWidget):
# Index of the range where we look for the peak # Index of the range where we look for the peak
# print(f"self.combobox_freq_choice.currentIndex() : {self.combobox_freq_choice.currentIndex()}") # print(f"self.combobox_freq_choice.currentIndex() : {self.combobox_freq_choice.currentIndex()}")
# print(f"r = {stg.r}") # print(f"r = {stg.r}")
print(f"ind_min : {np.where(stg.depth_cross_section[self.fileListWidget.currentRow()][int(self.combobox_frequency_bathymetry.currentIndex()), :] >= rmin)}") # print(f"ind_min : {np.where(stg.depth_cross_section[self.fileListWidget.currentRow()][int(self.combobox_frequency_bathymetry.currentIndex()), :] >= rmin)}")
print(f"ind_max : {np.where(stg.depth_cross_section[self.fileListWidget.currentRow()][int(self.combobox_frequency_bathymetry.currentIndex()), :] <= rmax)}") # print(f"ind_max : {np.where(stg.depth_cross_section[self.fileListWidget.currentRow()][int(self.combobox_frequency_bathymetry.currentIndex()), :] <= rmax)}")
ind_min = np.where(stg.depth_cross_section[self.fileListWidget.currentRow()][int(self.combobox_frequency_bathymetry.currentIndex()), :] >= rmin)[0][0] ind_min = np.where(stg.depth_cross_section[self.fileListWidget.currentRow()][int(self.combobox_frequency_bathymetry.currentIndex()), :] >= rmin)[0][0]
ind_max = np.where(stg.depth_cross_section[self.fileListWidget.currentRow()][int(self.combobox_frequency_bathymetry.currentIndex()), :] <= rmax)[0][-1] ind_max = np.where(stg.depth_cross_section[self.fileListWidget.currentRow()][int(self.combobox_frequency_bathymetry.currentIndex()), :] <= rmax)[0][-1]