Sediment calibration: Update calibration parameters at study open.

dev
Pierre-Antoine 2025-04-15 16:43:22 +02:00
parent ee4706737e
commit 2c1b01118e
2 changed files with 153 additions and 121 deletions

View File

@ -129,6 +129,11 @@ class CheckableComboBox(QComboBox):
res.append(i) res.append(i)
return res return res
def setCurrentIndexes(self, indexes):
for i in range(self.model().rowCount()):
if i in indexes:
self.model().item(i).setCheckState(Qt.Checked)
# class CheckableComboBox(QComboBox): # class CheckableComboBox(QComboBox):
# def __init__(self): # def __init__(self):
# super().__init__() # super().__init__()

View File

@ -866,8 +866,39 @@ class SedimentCalibrationTab(QWidget):
self.function_pushbutton_update_acoustic_file() self.function_pushbutton_update_acoustic_file()
self._update_calibration_parameters()
self.function_pushbutton_plot_sample()
self.blockSignals(False) self.blockSignals(False)
def _update_calibration_parameters(self):
if stg.calib_acoustic_data == -1:
return
self.combobox_acoustic_data_choice.blockSignals(True)
self.combobox_freq1.blockSignals(True)
self.combobox_freq2.blockSignals(True)
self.combobox_fine_sample_choice.blockSignals(True)
self.combobox_sand_sample_choice.blockSignals(True)
self.combobox_acoustic_data_choice\
.setCurrentIndex(stg.calib_acoustic_data)
self.combobox_freq1.setCurrentIndex(stg.calib_freq_1)
self.combobox_freq2.setCurrentIndex(stg.calib_freq_2)
self.combobox_fine_sample_choice\
.setCurrentIndexes(stg.calib_fine_profiles)
self.combobox_sand_sample_choice\
.setCurrentIndex(stg.calib_sand_target)
self.combobox_sand_sample_choice.blockSignals(False)
self.combobox_fine_sample_choice.blockSignals(False)
self.combobox_freq2.blockSignals(False)
self.combobox_freq1.blockSignals(False)
self.combobox_acoustic_data_choice.blockSignals(False)
def function_pushbutton_update_acoustic_file(self): def function_pushbutton_update_acoustic_file(self):
if len(stg.data_preprocessed) == 0: if len(stg.data_preprocessed) == 0:
return return
@ -914,8 +945,6 @@ class SedimentCalibrationTab(QWidget):
[s[0] for s in stg.sample_sand] [s[0] for s in stg.sample_sand]
) )
self.plot_acoustic_recording()
self.label_temperature.clear() self.label_temperature.clear()
self.label_temperature.setText("T = " + str(stg.temperature) + " °C") self.label_temperature.setText("T = " + str(stg.temperature) + " °C")
@ -939,32 +968,32 @@ class SedimentCalibrationTab(QWidget):
# --- Record frequencies for calibration --- # --- Record frequencies for calibration ---
stg.calib_acoustic_data = data_id stg.calib_acoustic_data = data_id
index_freq1 = self.combobox_freq1.currentIndex() freq1 = self.combobox_freq1.currentIndex()
index_freq2 = self.combobox_freq2.currentIndex() freq2 = self.combobox_freq2.currentIndex()
stg.frequencies_for_calibration.clear() stg.frequencies_for_calibration.clear()
stg.frequencies_for_calibration.append( stg.frequencies_for_calibration.append(
( (
stg.freq[data_id][index_freq1], stg.freq[data_id][freq1],
index_freq1 freq1
) )
) )
stg.calib_freq_1 = index_freq1 stg.calib_freq_1 = freq1
stg.frequencies_for_calibration.append( stg.frequencies_for_calibration.append(
( (
stg.freq[data_id][index_freq2], stg.freq[data_id][freq2],
index_freq2 freq2
) )
) )
stg.calib_freq_2 = index_freq2 stg.calib_freq_2 = freq2
stg.frequency_for_inversion = tuple() stg.frequency_for_inversion = tuple()
stg.frequency_for_inversion = ( stg.frequency_for_inversion = (
stg.freq[data_id][ stg.freq[data_id][
self.combobox_freq2.currentIndex() freq2
], ],
self.combobox_freq2.currentIndex() freq2
) )
# --- Plot acoustic data recording --- # --- Plot acoustic data recording ---
@ -985,14 +1014,14 @@ class SedimentCalibrationTab(QWidget):
stg.BS_stream_bed_pre_process_average[ stg.BS_stream_bed_pre_process_average[
data_id data_id
][ ][
self.combobox_freq2.currentIndex(), :, : freq2, :, :
] ]
) )
val_max = np.nanmax( val_max = np.nanmax(
stg.BS_stream_bed_pre_process_average[ stg.BS_stream_bed_pre_process_average[
data_id data_id
][ ][
self.combobox_freq2.currentIndex(), :, : freq2, :, :
] ]
) )
if val_min == 0: if val_min == 0:
@ -1002,39 +1031,39 @@ class SedimentCalibrationTab(QWidget):
if stg.depth_cross_section[data_id].shape != (0,): if stg.depth_cross_section[data_id].shape != (0,):
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time_cross_section[data_id][ stg.time_cross_section[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
-stg.depth_cross_section[data_id][ -stg.depth_cross_section[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
stg.BS_stream_bed_pre_process_average[data_id][ stg.BS_stream_bed_pre_process_average[data_id][
self.combobox_freq2.currentIndex(), :, :], freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else: else:
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time_cross_section[data_id][ stg.time_cross_section[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
-stg.depth[data_id][ -stg.depth[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
stg.BS_stream_bed_pre_process_average[data_id][ stg.BS_stream_bed_pre_process_average[data_id][
self.combobox_freq2.currentIndex(), :, :], freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else: else:
if stg.depth_cross_section[data_id].shape != (0,): if stg.depth_cross_section[data_id].shape != (0,):
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time[data_id][ stg.time[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
-stg.depth_cross_section[data_id][ -stg.depth_cross_section[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
stg.BS_stream_bed_pre_process_average[data_id][ stg.BS_stream_bed_pre_process_average[data_id][
self.combobox_freq2.currentIndex(), :, :], freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else: else:
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time[data_id][ stg.time[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
-stg.depth[data_id][ -stg.depth[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
stg.BS_stream_bed_pre_process_average[data_id][ stg.BS_stream_bed_pre_process_average[data_id][
self.combobox_freq2.currentIndex(), :, :], freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
@ -1043,10 +1072,10 @@ class SedimentCalibrationTab(QWidget):
val_min = np.nanmin( val_min = np.nanmin(
stg.BS_stream_bed_pre_process_SNR[data_id][ stg.BS_stream_bed_pre_process_SNR[data_id][
self.combobox_freq2.currentIndex(), :, :]) freq2, :, :])
val_max = np.nanmax( val_max = np.nanmax(
stg.BS_stream_bed_pre_process_SNR[data_id][ stg.BS_stream_bed_pre_process_SNR[data_id][
self.combobox_freq2.currentIndex(), :, :]) freq2, :, :])
if val_min == 0: if val_min == 0:
val_min = 1e-5 val_min = 1e-5
@ -1054,48 +1083,48 @@ class SedimentCalibrationTab(QWidget):
if stg.depth_cross_section[data_id].shape != (0,): if stg.depth_cross_section[data_id].shape != (0,):
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time_cross_section[data_id][ stg.time_cross_section[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
-stg.depth_cross_section[data_id][ -stg.depth_cross_section[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
stg.BS_stream_bed_pre_process_SNR[data_id][ stg.BS_stream_bed_pre_process_SNR[data_id][
self.combobox_freq2.currentIndex(), :, :], freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else: else:
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time_cross_section[data_id][ stg.time_cross_section[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
-stg.depth[data_id][ -stg.depth[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
stg.BS_stream_bed_pre_process_SNR[data_id][ stg.BS_stream_bed_pre_process_SNR[data_id][
self.combobox_freq2.currentIndex(), :, :], freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else: else:
if stg.depth_cross_section[data_id].shape != (0,): if stg.depth_cross_section[data_id].shape != (0,):
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time[data_id][ stg.time[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
-stg.depth_cross_section[data_id][ -stg.depth_cross_section[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
stg.BS_stream_bed_pre_process_SNR[data_id][ stg.BS_stream_bed_pre_process_SNR[data_id][
self.combobox_freq2.currentIndex(), :, :], freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else: else:
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time[data_id][ stg.time[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
-stg.depth[data_id][ -stg.depth[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
stg.BS_stream_bed_pre_process_SNR[data_id][ stg.BS_stream_bed_pre_process_SNR[data_id][
self.combobox_freq2.currentIndex(), :, :], freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
elif stg.BS_stream_bed[data_id].shape != (0,): elif stg.BS_stream_bed[data_id].shape != (0,):
val_min = np.nanmin( val_min = np.nanmin(
stg.BS_stream_bed[data_id][self.combobox_freq2.currentIndex(), stg.BS_stream_bed[data_id][freq2,
:, :]) :, :])
val_max = np.nanmax( val_max = np.nanmax(
stg.BS_stream_bed[data_id][self.combobox_freq2.currentIndex(), stg.BS_stream_bed[data_id][freq2,
:, :]) :, :])
if val_min == 0: if val_min == 0:
val_min = 1e-5 val_min = 1e-5
@ -1104,19 +1133,19 @@ class SedimentCalibrationTab(QWidget):
if stg.depth_cross_section[data_id].shape != (0,): if stg.depth_cross_section[data_id].shape != (0,):
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time_cross_section[data_id][ stg.time_cross_section[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
-stg.depth_cross_section[data_id][ -stg.depth_cross_section[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
stg.BS_stream_bed[data_id][self.combobox_freq2.currentIndex(), stg.BS_stream_bed[data_id][freq2,
:, :], :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else: else:
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time_cross_section[data_id][ stg.time_cross_section[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
-stg.depth[data_id][ -stg.depth[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
stg.BS_stream_bed[data_id][self.combobox_freq2.currentIndex(), stg.BS_stream_bed[data_id][freq2,
:, :], :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
@ -1124,19 +1153,19 @@ class SedimentCalibrationTab(QWidget):
if stg.depth_cross_section[data_id].shape != (0,): if stg.depth_cross_section[data_id].shape != (0,):
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time[data_id][ stg.time[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
-stg.depth_cross_section[data_id][ -stg.depth_cross_section[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
stg.BS_stream_bed[data_id][self.combobox_freq2.currentIndex(), stg.BS_stream_bed[data_id][freq2,
:, :], :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else: else:
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time[data_id][ stg.time[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
-stg.depth[data_id][ -stg.depth[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
stg.BS_stream_bed[data_id][self.combobox_freq2.currentIndex(), stg.BS_stream_bed[data_id][freq2,
:, :], :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
@ -1144,10 +1173,10 @@ class SedimentCalibrationTab(QWidget):
val_min = np.nanmin( val_min = np.nanmin(
stg.BS_cross_section_pre_process_average[data_id][ stg.BS_cross_section_pre_process_average[data_id][
self.combobox_freq2.currentIndex(), :, :]) freq2, :, :])
val_max = np.nanmax( val_max = np.nanmax(
stg.BS_cross_section_pre_process_average[data_id][ stg.BS_cross_section_pre_process_average[data_id][
self.combobox_freq2.currentIndex(), :, :]) freq2, :, :])
if val_min == 0: if val_min == 0:
val_min = 1e-5 val_min = 1e-5
@ -1155,49 +1184,49 @@ class SedimentCalibrationTab(QWidget):
if stg.depth_cross_section[data_id].shape != (0,): if stg.depth_cross_section[data_id].shape != (0,):
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time_cross_section[data_id][ stg.time_cross_section[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
-stg.depth_cross_section[data_id][ -stg.depth_cross_section[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
stg.BS_cross_section_pre_process_average[data_id][ stg.BS_cross_section_pre_process_average[data_id][
self.combobox_freq2.currentIndex(), :, :], freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else: else:
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time_cross_section[data_id][ stg.time_cross_section[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
-stg.depth[data_id][ -stg.depth[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
stg.BS_cross_section_pre_process_average[data_id][ stg.BS_cross_section_pre_process_average[data_id][
self.combobox_freq2.currentIndex(), :, :], freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else: else:
if stg.depth_cross_section[data_id].shape != (0,): if stg.depth_cross_section[data_id].shape != (0,):
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time[data_id][ stg.time[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
-stg.depth_cross_section[data_id][ -stg.depth_cross_section[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
stg.BS_cross_section_pre_process_average[data_id][ stg.BS_cross_section_pre_process_average[data_id][
self.combobox_freq2.currentIndex(), :, :], freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else: else:
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time[data_id][ stg.time[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
-stg.depth[data_id][ -stg.depth[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
stg.BS_cross_section_pre_process_average[data_id][ stg.BS_cross_section_pre_process_average[data_id][
self.combobox_freq2.currentIndex(), :, :], freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
elif stg.BS_cross_section_pre_process_SNR[data_id].shape != (0,): elif stg.BS_cross_section_pre_process_SNR[data_id].shape != (0,):
val_min = np.nanmin( val_min = np.nanmin(
stg.BS_cross_section_pre_process_SNR[data_id][ stg.BS_cross_section_pre_process_SNR[data_id][
self.combobox_freq2.currentIndex(), :, :]) freq2, :, :])
val_max = np.nanmax( val_max = np.nanmax(
stg.BS_cross_section_pre_process_SNR[data_id][ stg.BS_cross_section_pre_process_SNR[data_id][
self.combobox_freq2.currentIndex(), :, :]) freq2, :, :])
if val_min == 0: if val_min == 0:
val_min = 1e-5 val_min = 1e-5
@ -1205,49 +1234,49 @@ class SedimentCalibrationTab(QWidget):
if stg.depth_cross_section[data_id].shape != (0): if stg.depth_cross_section[data_id].shape != (0):
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time_cross_section[data_id][ stg.time_cross_section[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
-stg.depth_cross_section[data_id][ -stg.depth_cross_section[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
stg.BS_cross_section_pre_process_SNR[data_id][ stg.BS_cross_section_pre_process_SNR[data_id][
self.combobox_freq2.currentIndex(), :, :], freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else: else:
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time_cross_section[data_id][ stg.time_cross_section[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
-stg.depth[data_id][ -stg.depth[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
stg.BS_cross_section_pre_process_SNR[data_id][ stg.BS_cross_section_pre_process_SNR[data_id][
self.combobox_freq2.currentIndex(), :, :], freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else: else:
if stg.depth_cross_section[data_id].shape != (0): if stg.depth_cross_section[data_id].shape != (0):
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time[data_id][ stg.time[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
-stg.depth_cross_section[data_id][ -stg.depth_cross_section[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
stg.BS_cross_section_pre_process_SNR[data_id][ stg.BS_cross_section_pre_process_SNR[data_id][
self.combobox_freq2.currentIndex(), :, :], freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else: else:
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time[data_id][ stg.time[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
-stg.depth[data_id][ -stg.depth[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
stg.BS_cross_section_pre_process_SNR[data_id][ stg.BS_cross_section_pre_process_SNR[data_id][
self.combobox_freq2.currentIndex(), :, :], freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
elif stg.BS_cross_section[data_id].shape != (0,): elif stg.BS_cross_section[data_id].shape != (0,):
val_min = np.nanmin( val_min = np.nanmin(
stg.BS_cross_section[data_id][ stg.BS_cross_section[data_id][
self.combobox_freq2.currentIndex(), :, :]) freq2, :, :])
val_max = np.nanmax( val_max = np.nanmax(
stg.BS_cross_section[data_id][ stg.BS_cross_section[data_id][
self.combobox_freq2.currentIndex(), :, :]) freq2, :, :])
if val_min == 0: if val_min == 0:
val_min = 1e-5 val_min = 1e-5
@ -1255,56 +1284,56 @@ class SedimentCalibrationTab(QWidget):
if stg.depth_cross_section[data_id].shape != (0,): if stg.depth_cross_section[data_id].shape != (0,):
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time_cross_section[data_id][ stg.time_cross_section[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
-stg.depth_cross_section[data_id][ -stg.depth_cross_section[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
stg.BS_cross_section[data_id][ stg.BS_cross_section[data_id][
self.combobox_freq2.currentIndex(), :, :], freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else: else:
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time_cross_section[data_id][ stg.time_cross_section[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
-stg.depth[data_id][ -stg.depth[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
stg.BS_cross_section[data_id][ stg.BS_cross_section[data_id][
self.combobox_freq2.currentIndex(), :, :], freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else: else:
if stg.depth_cross_section[data_id].shape != (0,): if stg.depth_cross_section[data_id].shape != (0,):
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time[data_id][ stg.time[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
-stg.depth_cross_section[data_id][ -stg.depth_cross_section[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
stg.BS_cross_section[data_id][ stg.BS_cross_section[data_id][
self.combobox_freq2.currentIndex(), :, :], freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
else: else:
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time[data_id][ stg.time[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
-stg.depth[data_id][ -stg.depth[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
stg.BS_cross_section[data_id][ stg.BS_cross_section[data_id][
self.combobox_freq2.currentIndex(), :, :], freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
elif stg.BS_raw_data_pre_process_average[data_id].shape != (0,): elif stg.BS_raw_data_pre_process_average[data_id].shape != (0,):
val_min = np.nanmin(stg.BS_raw_data_pre_process_average[data_id][ val_min = np.nanmin(stg.BS_raw_data_pre_process_average[data_id][
self.combobox_freq2.currentIndex(), :, :]) freq2, :, :])
val_max = np.nanmax(stg.BS_raw_data_pre_process_average[data_id][ val_max = np.nanmax(stg.BS_raw_data_pre_process_average[data_id][
self.combobox_freq2.currentIndex(), :, :]) freq2, :, :])
if val_min == 0: if val_min == 0:
val_min = 1e-5 val_min = 1e-5
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time[data_id][self.combobox_freq2.currentIndex(), :], stg.time[data_id][freq2, :],
-stg.depth[data_id][self.combobox_freq2.currentIndex(), :], -stg.depth[data_id][freq2, :],
stg.BS_raw_data_pre_process_average[data_id][ stg.BS_raw_data_pre_process_average[data_id][
self.combobox_freq2.currentIndex(), :, :], freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
@ -1312,33 +1341,33 @@ class SedimentCalibrationTab(QWidget):
elif stg.BS_raw_data_pre_process_SNR[data_id].shape != (0,): elif stg.BS_raw_data_pre_process_SNR[data_id].shape != (0,):
val_min = np.nanmin(stg.BS_raw_data_pre_process_SNR[data_id][ val_min = np.nanmin(stg.BS_raw_data_pre_process_SNR[data_id][
self.combobox_freq2.currentIndex(), :, :]) freq2, :, :])
val_max = np.nanmax(stg.BS_raw_data_pre_process_SNR[data_id][ val_max = np.nanmax(stg.BS_raw_data_pre_process_SNR[data_id][
self.combobox_freq2.currentIndex(), :, :]) freq2, :, :])
if val_min == 0: if val_min == 0:
val_min = 1e-5 val_min = 1e-5
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time[data_id][self.combobox_freq2.currentIndex(), :], stg.time[data_id][freq2, :],
-stg.depth[data_id][self.combobox_freq2.currentIndex(), :], -stg.depth[data_id][freq2, :],
stg.BS_raw_data_pre_process_SNR[data_id][ stg.BS_raw_data_pre_process_SNR[data_id][
self.combobox_freq2.currentIndex(), :, :], freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
elif stg.BS_raw_data[data_id].shape != (0,): elif stg.BS_raw_data[data_id].shape != (0,):
val_min = np.nanmin(stg.BS_raw_data[data_id][ val_min = np.nanmin(stg.BS_raw_data[data_id][
self.combobox_freq2.currentIndex(), :, :]) freq2, :, :])
val_max = np.nanmax(stg.BS_raw_data[data_id][ val_max = np.nanmax(stg.BS_raw_data[data_id][
self.combobox_freq2.currentIndex(), :, :]) freq2, :, :])
if val_min == 0: if val_min == 0:
val_min = 1e-5 val_min = 1e-5
self.axis_BS.pcolormesh( self.axis_BS.pcolormesh(
stg.time[data_id][self.combobox_freq2.currentIndex(), :], stg.time[data_id][freq2, :],
-stg.depth[data_id][self.combobox_freq2.currentIndex(), :], -stg.depth[data_id][freq2, :],
stg.BS_raw_data[data_id][ stg.BS_raw_data[data_id][
self.combobox_freq2.currentIndex(), :, :], freq2, :, :],
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
# --- Plot samples --- # --- Plot samples ---
@ -1383,10 +1412,10 @@ class SedimentCalibrationTab(QWidget):
self.red_line_plot_return, = ( self.red_line_plot_return, = (
self.axis_BS.plot( self.axis_BS.plot(
stg.time_cross_section[data_id][ stg.time_cross_section[data_id][
self.combobox_freq2.currentIndex(), stg.sand_sample_target_indice[0][1]] * freq2, stg.sand_sample_target_indice[0][1]] *
np.ones(stg.depth_cross_section[data_id].shape[1]), np.ones(stg.depth_cross_section[data_id].shape[1]),
-stg.depth_cross_section[data_id][ -stg.depth_cross_section[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
color='red', linestyle="solid", linewidth=2)) color='red', linestyle="solid", linewidth=2))
else: else:
@ -1394,10 +1423,10 @@ class SedimentCalibrationTab(QWidget):
self.red_line_plot_return, = ( self.red_line_plot_return, = (
self.axis_BS.plot( self.axis_BS.plot(
stg.time[data_id][ stg.time[data_id][
self.combobox_freq2.currentIndex(), stg.sand_sample_target_indice[0][1]] * freq2, stg.sand_sample_target_indice[0][1]] *
np.ones(stg.depth_cross_section[data_id].shape[1]), np.ones(stg.depth_cross_section[data_id].shape[1]),
-stg.depth_cross_section[data_id][ -stg.depth_cross_section[data_id][
self.combobox_freq2.currentIndex(), :], freq2, :],
color='red', linestyle="solid", linewidth=2)) color='red', linestyle="solid", linewidth=2))
else: else:
@ -1407,10 +1436,9 @@ class SedimentCalibrationTab(QWidget):
self.red_line_plot_return, = ( self.red_line_plot_return, = (
self.axis_BS.plot( self.axis_BS.plot(
stg.time_cross_section[data_id][ stg.time_cross_section[data_id][
self.combobox_freq2.currentIndex(), stg.sand_sample_target_indice[0][1]] * freq2, stg.sand_sample_target_indice[0][1]] *
np.ones(stg.depth[data_id].shape[1]), np.ones(stg.depth[data_id].shape[1]),
-stg.depth[data_id][ -stg.depth[data_id][freq2, :],
self.combobox_freq2.currentIndex(), :],
color='red', linestyle="solid", linewidth=2)) color='red', linestyle="solid", linewidth=2))
else: else:
@ -1418,10 +1446,9 @@ class SedimentCalibrationTab(QWidget):
self.red_line_plot_return, = ( self.red_line_plot_return, = (
self.axis_BS.plot( self.axis_BS.plot(
stg.time[data_id][ stg.time[data_id][
self.combobox_freq2.currentIndex(), stg.sand_sample_target_indice[0][1]] * freq2, stg.sand_sample_target_indice[0][1]] *
np.ones(stg.depth[data_id].shape[1]), np.ones(stg.depth[data_id].shape[1]),
-stg.depth[data_id][ -stg.depth[data_id][freq2, :],
self.combobox_freq2.currentIndex(), :],
color='red', linestyle="solid", linewidth=2)) color='red', linestyle="solid", linewidth=2))
self.axis_BS.set_xlabel("Time (sec)") self.axis_BS.set_xlabel("Time (sec)")