Compare commits

..

No commits in common. "79ee1c3cfa39c6c41bc46dc99afef88a6ba276a8" and "cb46917101b6c2c79df9b45646e1ced34249b589" have entirely different histories.

4 changed files with 188 additions and 325 deletions

View File

@ -100,10 +100,10 @@ class CreateTableForSaveAs:
acoustic_data INTEGER,
temperature FLOAT,
distance_to_free_surface FLOAT,
tmin_index INTEGER, tmin_value FLOAT,
tmax_index INTEGER, tmax_value FLOAT,
rmin_index INTEGER, rmin_value FLOAT,
rmax_index INTEGER, rmax_value FLOAT,
tmin_index FLOAT, tmin_value FLOAT,
tmax_index FLOAT, tmax_value FLOAT,
rmin_index FLOAT, rmin_value FLOAT,
rmax_index FLOAT, rmax_value FLOAT,
freq_bottom_detection_index FLOAT,
freq_bottom_detection_value STRING,
depth_bottom_detection_min FLOAT,
@ -449,10 +449,10 @@ class CreateTableForSaveAs:
(
stg.acoustic_data[i], stg.temperature,
stg.distance_from_ABS_to_free_surface[i],
int(stg.tmin[i][0]), stg.tmin[i][1],
int(stg.tmax[i][0]), stg.tmax[i][1],
int(stg.rmin[i][0]), stg.rmin[i][1],
int(stg.rmax[i][0]), stg.rmax[i][1],
stg.tmin[i][0], stg.tmin[i][1],
stg.tmax[i][0], stg.tmax[i][1],
stg.rmin[i][0], stg.rmin[i][1],
stg.rmax[i][0], stg.rmax[i][1],
stg.freq_bottom_detection[i][0],
stg.freq_bottom_detection[i][1],
stg.depth_bottom_detection_min,

View File

@ -524,7 +524,7 @@ class ReadTableForOpen:
logger.debug(f"stg.temperature: {stg.temperature}")
logger.debug(f"stg.tmin: {stg.tmin}")
logger.debug(f"stg.tmax: {stg.tmax}")
logger.debug(f"stg.tmin: {stg.tmax}")
logger.debug(f"stg.SNR_filter_value: {stg.SNR_filter_value}")
def read_table_sediment_file(self):

View File

@ -1396,6 +1396,7 @@ class AcousticDataTab(QWidget):
self.open_acoustic_data()
@trace
def open_acoustic_data(self):
# --- Fill lineEdit with path and file names + load acoustic data ---
# --- fill date, hour and measurements information + fill frequency combobox for bottom detection ---
@ -2167,344 +2168,209 @@ class AcousticDataTab(QWidget):
if self.fileListWidget.currentRow() == -1:
return
data_id = self.fileListWidget.currentRow()
file_id = self.fileListWidget.currentRow()
tmin_indice = np.where(
np.abs(
stg.time[data_id][0, :] - np.nanmin(stg.time[data_id][0, :])
stg.time[file_id][0, :] - np.nanmin(stg.time[file_id][0, :])
) == np.nanmin(
np.abs(
stg.time[data_id][0, :]
- np.nanmin(stg.time[data_id][0, :])
stg.time[file_id][0, :]
- np.nanmin(stg.time[file_id][0, :])
)
)
)[0][0]
tmin_value = np.round(
np.nanmin(stg.time[data_id][0, :]), 2
np.nanmin(stg.time[file_id][0, :]), 2
)
stg.tmin[data_id] = (tmin_indice, tmin_value)
stg.tmin[file_id] = (tmin_indice, tmin_value)
tmax_indice = np.where(
np.abs(
stg.time[data_id][0, :] - np.nanmax(stg.time[data_id][0, :])
stg.time[file_id][0, :] - np.nanmax(stg.time[file_id][0, :])
) == np.nanmin(
np.abs(
stg.time[data_id][0, :]
- np.nanmax(stg.time[data_id][0, :])
stg.time[file_id][0, :]
- np.nanmax(stg.time[file_id][0, :])
)
)
)[0][0]
tmax_value = np.round(np.nanmax(stg.time[data_id][0, :]), 2)
stg.tmax[data_id] = (tmax_indice + 1, tmax_value)
tmax_value = np.round(np.nanmax(stg.time[file_id][0, :]), 2)
stg.tmax[file_id] = (tmax_indice + 1, tmax_value)
self.set_range_for_time_boundaries_option()
def set_range_for_time_boundaries_option(self):
data_id = self.fileListWidget.currentRow()
self.label_time_min.clear()
self.label_time_min.setText(
f"{stg.time[data_id][0, 0]:.1f}"
)
self.label_time_min.setText("%.5s" % str(stg.time[self.fileListWidget.currentRow()][0, 0]))
self.label_time_max.clear()
self.label_time_max.setText(
f"{stg.time[data_id][0, -1]:.1f}"
)
self.label_time_max.setText("%.5s" % str(stg.time[self.fileListWidget.currentRow()][0, -1]))
if stg.time_cross_section[self.fileListWidget.currentRow()].shape != (0,):
self.lineEdit_time_min_limits.setText("%.5s" % str(stg.time_cross_section[self.fileListWidget.currentRow()][0, 0]))
self.lineEdit_time_max_limits.setText("%.5s" % str(stg.time_cross_section[self.fileListWidget.currentRow()][0, -1]))
if stg.time_cross_section[data_id].shape != (0,):
self.lineEdit_time_min_limits.setText(
f"{stg.time_cross_section[data_id][0, 0]:.1f}"
)
self.lineEdit_time_max_limits.setText(
f"{stg.time_cross_section[data_id][0, -1]:.1f}"
)
else:
self.lineEdit_time_min_limits.setText(
f"{stg.time[data_id][0, 0]:.1f}"
)
self.lineEdit_time_max_limits.setText(
f"{stg.time[data_id][0, -1]:.1f}"
)
self.lineEdit_time_min_limits.setText("%.5s" % str(stg.time[self.fileListWidget.currentRow()][0, 0]))
self.lineEdit_time_max_limits.setText("%.5s" % str(stg.time[self.fileListWidget.currentRow()][0, -1]))
def compute_time_cross_section(self):
''' tmin and tmax are updated with double slider of time '''
data_id = max(0, self.fileListWidget.currentRow())
time_min = float(self.lineEdit_time_min_limits.text().replace(",", "."))
time_max = float(self.lineEdit_time_max_limits.text().replace(",", "."))
stg.tmin[data_id] = ((
np.where(
np.abs(
np.round(
stg.time[data_id][0, :], 2
) - time_min
) == np.nanmin(
np.abs(
np.round(
stg.time[data_id][0, :], 2
) - time_min
)
)
)[0][0],
time_min
stg.tmin[self.fileListWidget.currentRow()] = ((
np.where(np.abs(np.round(stg.time[self.fileListWidget.currentRow()][0, :], 2) -
float(self.lineEdit_time_min_limits.text().replace(",", "."))) ==
np.nanmin(np.abs(np.round(stg.time[self.fileListWidget.currentRow()][0, :],
2) - float(self.lineEdit_time_min_limits.text().replace(",", ".")))))[0][0],
float(self.lineEdit_time_min_limits.text().replace(",", "."))
))
stg.tmax[data_id] = ((
np.where(
np.abs(
np.round(
stg.time[data_id][0, :], 2)
- time_max
) == np.nanmin(
np.abs(
np.round(
stg.time[data_id][0, :],2)
- time_max
)
)
)[0][0] + 1,
time_max
stg.tmax[self.fileListWidget.currentRow()] = ((
np.where(np.abs(np.round(stg.time[self.fileListWidget.currentRow()][0, :], 2) -
float(self.lineEdit_time_max_limits.text().replace(",", "."))) ==
np.nanmin(np.abs(np.round(stg.time[self.fileListWidget.currentRow()][0, :],
2) - float(self.lineEdit_time_max_limits.text().replace(",", ".")))))[0][0]+1,
float(self.lineEdit_time_max_limits.text().replace(",", "."))
))
stg.time_cross_section[data_id] = (
stg.time[data_id][
:, stg.tmin[data_id][0]: stg.tmax[data_id][0]
]
stg.time_cross_section[self.fileListWidget.currentRow()] = (
stg.time[self.fileListWidget.currentRow()][:, stg.tmin[self.fileListWidget.currentRow()][0]:
stg.tmax[self.fileListWidget.currentRow()][0]]
)
def compute_rmin_rmax(self):
''' rmin and rmax are filled with min and max of depth when data are uploaded and
double slider of depth are updated with these values '''
if self.fileListWidget.currentRow() == -1:
return
data_id = self.fileListWidget.currentRow()
if self.fileListWidget.currentRow() != -1:
# --- rmim / rmax ---
rmin_indice = np.where(
np.abs(
stg.depth[data_id][0, :] - np.nanmin(stg.depth[data_id][0, :])
) == np.nanmin(
np.abs(
stg.depth[data_id][0, :]
- np.nanmin(stg.depth[data_id][0, :])
)
)
)[0][0]
rmin_indice = np.where(np.abs(stg.depth[self.fileListWidget.currentRow()][0, :] - np.nanmin(
stg.depth[self.fileListWidget.currentRow()][0, :])) ==
np.nanmin(np.abs(stg.depth[self.fileListWidget.currentRow()][0, :] - np.nanmin(
stg.depth[self.fileListWidget.currentRow()][0, :]))))[0][0]
rmin_value = np.round(np.nanmin(stg.depth[self.fileListWidget.currentRow()][0, :]), 2)
stg.rmin[self.fileListWidget.currentRow()] = (rmin_indice, rmin_value)
rmin_value = np.round(np.nanmin(stg.depth[data_id][0, :]), 2)
stg.rmin[data_id] = (rmin_indice, rmin_value)
rmax_indice = np.where(
np.abs(
stg.depth[data_id][0, :] - np.nanmax(stg.depth[data_id][0, :])
) == np.nanmin(
np.abs(
stg.depth[data_id][0, :]
- np.nanmax(stg.depth[data_id][0, :])
)
)
)[0][0]
rmax_value = np.round(np.nanmax(stg.depth[data_id][0, :]), 2)
stg.rmax[data_id] = (rmax_indice + 1, rmax_value)
rmax_indice = np.where(np.abs(stg.depth[self.fileListWidget.currentRow()][0, :] - np.nanmax(
stg.depth[self.fileListWidget.currentRow()][0, :])) ==
np.nanmin(np.abs(stg.depth[self.fileListWidget.currentRow()][0, :] - np.nanmax(
stg.depth[self.fileListWidget.currentRow()][0, :]))))[0][0]
rmax_value = np.round(np.nanmax(stg.depth[self.fileListWidget.currentRow()][0, :]), 2)
stg.rmax[self.fileListWidget.currentRow()] = (rmax_indice + 1, rmax_value)
self.set_range_for_depth_boundaries_option()
def set_range_for_depth_boundaries_option(self):
data_id = self.fileListWidget.currentRow()
self.label_depth_min.clear()
self.label_depth_min.setText("-" + str("%.5s" % stg.depth[data_id][0, -1]))
self.label_depth_min.setText("-" + str("%.5s" % stg.depth[self.fileListWidget.currentRow()][0, -1]))
self.label_depth_max.clear()
self.label_depth_max.setText("-" + str("%.5s" % stg.depth[data_id][0, 0]))
self.label_depth_max.setText("-" + str("%.5s" % stg.depth[self.fileListWidget.currentRow()][0, 0]))
if stg.depth_cross_section[self.fileListWidget.currentRow()].shape != (0,):
self.lineEdit_depth_min_limits.setText("-" + str("%.5s" % stg.depth_cross_section[self.fileListWidget.currentRow()][0, -1]))
self.lineEdit_depth_max_limits.setText("-" + str("%.5s" % stg.depth_cross_section[self.fileListWidget.currentRow()][0, 0]))
if stg.depth_cross_section[data_id].shape != (0,):
self.lineEdit_depth_min_limits.setText(
"-" + str("%.5s" % stg.depth_cross_section[data_id][0, -1])
)
self.lineEdit_depth_max_limits.setText(
"-" + str("%.5s" % stg.depth_cross_section[data_id][0, 0])
)
else:
self.lineEdit_depth_min_limits.setText(
"-" + str("%.5s" % stg.depth[data_id][0, -1])
)
self.lineEdit_depth_max_limits.setText(
"-" + str("%.5s" % stg.depth[data_id][0, 0])
)
self.lineEdit_depth_min_limits.setText("-" + str("%.5s" % stg.depth[self.fileListWidget.currentRow()][0, -1]))
self.lineEdit_depth_max_limits.setText("-" + str("%.5s" % stg.depth[self.fileListWidget.currentRow()][0, 0]))
def compute_depth_cross_section(self):
''' rmin and rmax are updated with double slider of depth '''
data_id = self.fileListWidget.currentRow()
stg.rmin[data_id] = ((
np.where(
np.abs(
np.round(
stg.depth[data_id][0, :], 2
) - float(
"".join(
findall(
"[.0-9]",
self.lineEdit_depth_max_limits.text()
)
)
)
) == np.nanmin(
np.abs(
np.round(stg.depth[data_id][0, :], 2)
- float(
"".join(
findall(
"[.0-9]",
self.lineEdit_depth_max_limits.text()
)
)
)
)
)
)[0][0]+1,
float(
"".join(
findall(
"[.0-9]",
self.lineEdit_depth_max_limits.text()
)
)
)
stg.rmin[self.fileListWidget.currentRow()] = ((
np.where(np.abs(np.round(stg.depth[self.fileListWidget.currentRow()][0, :], 2) -
float("".join(findall("[.0-9]", self.lineEdit_depth_max_limits.text())))) ==
np.nanmin(np.abs(np.round(stg.depth[self.fileListWidget.currentRow()][0, :],
2) - (float("".join(findall("[.0-9]", self.lineEdit_depth_max_limits.text()))))
)))[0][0]+1,
float("".join(findall("[.0-9]", self.lineEdit_depth_max_limits.text())))
))
stg.rmax[data_id] = ((
np.where(
np.abs(
np.round(
stg.depth[data_id][0, :], 2
) - float(
"".join(
findall(
"[.0-9]",
self.lineEdit_depth_min_limits.text()
)
)
)
) == np.nanmin(
np.abs(
np.round(stg.depth[data_id][0, :], 2)
- float(
"".join(
findall(
"[.0-9]",
self.lineEdit_depth_min_limits.text()
)
)
)
)
)
)[0][0],
float(
"".join(
findall(
"[.0-9]",
self.lineEdit_depth_min_limits.text()
)
)
)
stg.rmax[self.fileListWidget.currentRow()] = ((
np.where(np.abs(np.round(stg.depth[self.fileListWidget.currentRow()][0, :], 2) -
float("".join(findall("[.0-9]", self.lineEdit_depth_min_limits.text())))) ==
np.nanmin(np.abs(np.round(stg.depth[self.fileListWidget.currentRow()][0, :],
2) - (float("".join(findall("[.0-9]", self.lineEdit_depth_min_limits.text()))))
)))[0][0],
float("".join(findall("[.0-9]", self.lineEdit_depth_min_limits.text())))
))
stg.depth_cross_section[data_id] = (
stg.depth[data_id][:,
stg.rmin[data_id][0]:stg.rmax[data_id][0]]
stg.depth_cross_section[self.fileListWidget.currentRow()] = (
stg.depth[self.fileListWidget.currentRow()][:,
stg.rmin[self.fileListWidget.currentRow()][0]:stg.rmax[self.fileListWidget.currentRow()][0]]
)
def compute_BS_cross_section(self):
if self.fileListWidget.currentRow() == -1:
return
data_id = self.fileListWidget.currentRow()
if self.fileListWidget.currentRow() != -1:
self.compute_depth_cross_section()
self.compute_time_cross_section()
stg.BS_cross_section[data_id] = (
stg.BS_raw_data[data_id][
:,
stg.rmin[data_id][0]:stg.rmax[data_id][0],
stg.tmin[data_id][0]:stg.tmax[data_id][0]
]
)
stg.BS_cross_section[self.fileListWidget.currentRow()] = (
stg.BS_raw_data[self.fileListWidget.currentRow()]
[:, stg.rmin[self.fileListWidget.currentRow()][0]:stg.rmax[self.fileListWidget.currentRow()][0],
stg.tmin[self.fileListWidget.currentRow()][0]:stg.tmax[self.fileListWidget.currentRow()][0]])
def update_frequency_combobox(self):
data_id = self.fileListWidget.currentRow()
if data_id == -1:
return
if self.fileListWidget.currentRow() != -1:
self.combobox_frequency_bathymetry.clear()
self.combobox_frequency_bathymetry.addItems(
[f for f in stg.freq_text[data_id]]
)
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[data_id]]
)
self.combobox_frequency_profile.addItems([f for f in stg.freq_text[self.fileListWidget.currentRow()]])
def set_range_for_doubleRangeSlider_intg_area(self):
if self.fileListWidget.currentRow() == -1:
return
if self.fileListWidget.currentRow() != -1:
data_id = self.fileListWidget.currentRow()
if stg.depth_cross_section[data_id].shape == (0,):
if stg.depth_cross_section[self.fileListWidget.currentRow()].shape == (0,):
self.doubleRangeSlider_intg_area.setRange(
min=-stg.depth[data_id][0, -1],
max=-stg.depth[data_id][0, 0]
)
min=-stg.depth[self.fileListWidget.currentRow()][0, -1],
max=-stg.depth[self.fileListWidget.currentRow()][0, 0])
self.doubleRangeSlider_intg_area.setValue(
value=(
-stg.depth[data_id][0, -1],
-stg.depth[data_id][0, 0]
)
)
value=(-stg.depth[self.fileListWidget.currentRow()][0, -1],
-stg.depth[self.fileListWidget.currentRow()][0, 0]))
else:
self.doubleRangeSlider_intg_area.setRange(
min=-stg.depth_cross_section[data_id][0, -1],
max=-stg.depth_cross_section[data_id][0, 0]
)
min=-stg.depth_cross_section[self.fileListWidget.currentRow()][0, -1],
max=-stg.depth_cross_section[self.fileListWidget.currentRow()][0, 0])
self.doubleRangeSlider_intg_area.setValue(
value=(
-stg.depth_cross_section[data_id][0, -1],
-stg.depth_cross_section[data_id][0, 0]
)
)
value=(-stg.depth_cross_section[self.fileListWidget.currentRow()][0, -1],
-stg.depth_cross_section[self.fileListWidget.currentRow()][0, 0]))
def set_range_for_spinboxes_bathymetry(self):
if self.fileListWidget.currentRow() == -1:
return
if self.fileListWidget.currentRow() != -1:
data_id = self.fileListWidget.currentRow()
if stg.depth_cross_section[self.fileListWidget.currentRow()].shape != (0,):
if stg.depth_cross_section[data_id].shape != (0,):
# self.spinbox_depth_min_bathy.setValue(stg.depth_cross_section[self.fileListWidget.currentRow()][0, 0])
self.lineEdit_depth_min_bathy.setText(
"-" + str("%.5s" % stg.depth_cross_section[data_id][0, -1])
)
"-" + str("%.5s" % stg.depth_cross_section[self.fileListWidget.currentRow()][0, -1]))
# self.spinbox_depth_max_bathy.setValue(stg.depth_cross_section[self.fileListWidget.currentRow()][0, -1])
self.lineEdit_depth_max_bathy.setText(
"-" + str("%.5s" % stg.depth_cross_section[data_id][0, 0])
)
"-" + str("%.5s" % stg.depth_cross_section[self.fileListWidget.currentRow()][0, 0]))
else:
self.lineEdit_depth_min_bathy.setText(
"-" + str("%.5s" % stg.depth[data_id][0, -1])
)
"-" + str("%.5s" % stg.depth[self.fileListWidget.currentRow()][0, -1]))
self.lineEdit_depth_max_bathy.setText(
"-" + str("%.5s" % stg.depth[data_id][0, 0])
)
"-" + str("%.5s" % stg.depth[self.fileListWidget.currentRow()][0, 0]))
def plot_backscattered_acoustic_signal_recording(self):
if self.fileListWidget.count() <= 0:
@ -2600,7 +2466,7 @@ class AcousticDataTab(QWidget):
msgBox.exec()
return
data_id = max(0, self.fileListWidget.currentRow())
data_id = self.fileListWidget.currentRow()
if data_id == -1:
return
@ -2890,6 +2756,8 @@ class AcousticDataTab(QWidget):
float(self.lineEdit_slider.text().replace(",", ".")))))[0][0]))
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,):
self.lineEdit_slider.setText(
str(stg.time_cross_section[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex(), self.slider.value()-1]))
@ -2947,7 +2815,7 @@ class AcousticDataTab(QWidget):
self.detect_bottom_compute()
def detect_bottom_compute(self):
data_id = max(0, self.fileListWidget.currentRow())
data_id = self.fileListWidget.currentRow()
freq_id = self.combobox_frequency_bathymetry.currentIndex()
freq_text = self.combobox_frequency_bathymetry.currentText()
@ -3082,7 +2950,7 @@ class AcousticDataTab(QWidget):
def detect_bottom_compute_plot_BS_with_bathymetry(
self, BS_data, time_data, depth_data
):
data_id = max(0, self.fileListWidget.currentRow())
data_id = self.fileListWidget.currentRow()
freq_id = self.combobox_frequency_bathymetry.currentIndex()
for f, _ in enumerate(stg.freq[data_id]):

View File

@ -431,13 +431,11 @@ class SignalProcessingTab(QWidget):
self.widget_scrollArea_list_preprocessed_data.setLayout(self.verticalLayout_scrollArea_list_pre_processed_data)
# Add content to the widget (labels in this example)
self.lineEdit_list_pre_processed_data = []
for i in range(20):
self.lineEdit_list_pre_processed_data.append(QLineEdit())
self.verticalLayout_scrollArea_list_pre_processed_data.addWidget(
self.lineEdit_list_pre_processed_data[i]
)
self.lineEdit_list_pre_processed_data[i].setDisabled(True)
exec("self.lineEdit_list_pre_processed_data_" + str(i) + "= QLineEdit()")
eval("self.verticalLayout_scrollArea_list_pre_processed_data.addWidget("
"self.lineEdit_list_pre_processed_data_" + str(i) + ")")
eval("self.lineEdit_list_pre_processed_data_" + str(i) + ".setDisabled(True)")
# Set the widget as the scroll area's widget
@ -533,7 +531,7 @@ class SignalProcessingTab(QWidget):
self.blockSignals(False)
def full_update_fill_text(self):
data_id = max(0, self.combobox_acoustic_data_choice.currentIndex())
data_id = self.combobox_acoustic_data_choice.currentIndex()
self.lineEdit_profile_tail_value.setText(
str(stg.noise_value[data_id])
@ -561,7 +559,7 @@ class SignalProcessingTab(QWidget):
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec()
else:
data_id = max(0, self.combobox_acoustic_data_choice.currentIndex())
data_id = self.combobox_acoustic_data_choice.currentIndex()
self.combobox_acoustic_data_choice.blockSignals(True)
self.combobox_freq_noise_from_profile_tail.blockSignals(True)
@ -594,7 +592,7 @@ class SignalProcessingTab(QWidget):
self.combobox_acoustic_data_choice.blockSignals(False)
def _is_correct_shape(self, data):
data_id = max(0, self.combobox_acoustic_data_choice.currentIndex())
data_id = self.combobox_acoustic_data_choice.currentIndex()
if stg.time_cross_section[data_id].shape != (0,):
x_time = stg.time_cross_section[data_id]
@ -621,7 +619,7 @@ class SignalProcessingTab(QWidget):
return (y == depth_shape and z == time_shape)
def recompute(self):
data_id = max(0, self.combobox_acoustic_data_choice.currentIndex())
data_id = self.combobox_acoustic_data_choice.currentIndex()
self.compute_average_profile_tail()
@ -641,21 +639,19 @@ class SignalProcessingTab(QWidget):
self.plot_pre_processed_profile()
def activate_list_of_pre_processed_data(self):
data_id = max(0, self.combobox_acoustic_data_choice.currentIndex())
for i in range(self.combobox_acoustic_data_choice.count()):
self.lineEdit_list_pre_processed_data[i].setDisabled(True)
eval("self.lineEdit_list_pre_processed_data_" + str(i) + ".setDisabled(True)")
eval("self.lineEdit_list_pre_processed_data_" + str(
self.combobox_acoustic_data_choice.currentIndex()) + ".setEnabled(True)")
eval("self.lineEdit_list_pre_processed_data_" + str(
self.combobox_acoustic_data_choice.currentIndex()) + ".returnPressed.connect(self.rename_preprocessed_data)")
self.lineEdit_list_pre_processed_data[data_id].setEnabled(True)
self.lineEdit_list_pre_processed_data[data_id]\
.returnPressed.connect(self.rename_preprocessed_data)
self.lineEdit_list_pre_processed_data[data_id]\
.setText(stg.filename_BS_raw_data[data_id])
eval("self.lineEdit_list_pre_processed_data_" + str(self.combobox_acoustic_data_choice.currentIndex()) +
".setText(stg.filename_BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()])")
def rename_preprocessed_data(self):
stg.data_preprocessed[data_id] = \
self.lineEdit_list_pre_processed_data[data_id].text()
exec("stg.data_preprocessed[self.combobox_acoustic_data_choice.currentIndex()] = "
"self.lineEdit_list_pre_processed_data_" + str(self.combobox_acoustic_data_choice.currentIndex()) + ".text()")
# ------------------------------------------------------
@ -707,7 +703,7 @@ class SignalProcessingTab(QWidget):
# ------------------------------------------------------
def compute_average_profile_tail(self):
data_id = max(0, self.combobox_acoustic_data_choice.currentIndex())
data_id = self.combobox_acoustic_data_choice.currentIndex()
freq_noise_id = self.combobox_freq_noise_from_profile_tail.currentIndex()
if ((float(self.lineEdit_val1.text()) == 0)
@ -794,7 +790,7 @@ class SignalProcessingTab(QWidget):
msgBox.exec()
else:
data_id = max(0, self.combobox_acoustic_data_choice.currentIndex())
data_id = self.combobox_acoustic_data_choice.currentIndex()
freq_noise_id = self.combobox_freq_noise_from_profile_tail.currentIndex()
if stg.BS_mean[data_id].shape == (0,):
@ -855,35 +851,35 @@ class SignalProcessingTab(QWidget):
# ------------------------------------------------------
def combobox_acoustic_data_choice_change_index(self):
data_id = max(0, self.combobox_acoustic_data_choice.currentIndex())
self.combobox_frequency_profile.blockSignals(True)
self.compute_average_profile_tail()
logger.debug(f"stg.SNR_filter_value: {stg.SNR_filter_value}")
self.lineEdit_SNR_criterion.setText(
str(stg.SNR_filter_value[data_id])
str(stg.SNR_filter_value[
self.combobox_acoustic_data_choice.currentIndex()
])
)
self.lineEdit_horizontal_average.setText(
str(stg.Nb_cells_to_average_BS_signal[data_id])
str(stg.Nb_cells_to_average_BS_signal[
self.combobox_acoustic_data_choice.currentIndex()
])
)
self.combobox_frequency_profile.clear()
self.combobox_frequency_profile.addItems(
[f for f in stg.freq_text[data_id]]
)
[f for f in stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]])
self.recompute()
self.replot()
if self.combobox_acoustic_data_choice.count() > 0:
for i in range(self.combobox_acoustic_data_choice.count()):
self.lineEdit_list_pre_processed_data[i].setDisabled(True)
self.lineEdit_list_pre_processed_data[data_id].setEnabled(True)
for i in range(self.combobox_acoustic_data_choice.count()):
eval("self.lineEdit_list_pre_processed_data_" + str(i) + ".setDisabled(True)")
#
eval("self.lineEdit_list_pre_processed_data_" + str(
self.combobox_acoustic_data_choice.currentIndex()) + ".setEnabled(True)")
self.combobox_frequency_profile.blockSignals(False)
@ -891,7 +887,7 @@ class SignalProcessingTab(QWidget):
if len(stg.filename_BS_raw_data) == 0:
pass
else:
data_id = max(0, self.combobox_acoustic_data_choice.currentIndex())
data_id = self.combobox_acoustic_data_choice.currentIndex()
stg.BS_noise_raw_data[data_id] = np.array([])
stg.BS_noise_averaged_data[data_id] = np.array([])
@ -1030,7 +1026,7 @@ class SignalProcessingTab(QWidget):
def load_noise_data_and_compute_SNR(self):
data_id = max(0, self.combobox_acoustic_data_choice.currentIndex())
data_id = self.combobox_acoustic_data_choice.currentIndex()
stg.noise_method[data_id] = 0
@ -1084,7 +1080,7 @@ class SignalProcessingTab(QWidget):
pnw.exec()
def compute_noise_from_profile_tail_value(self):
data_id = max(0, self.combobox_acoustic_data_choice.currentIndex())
data_id = self.combobox_acoustic_data_choice.currentIndex()
stg.noise_method[data_id] = 1
stg.noise_value[data_id] = (
@ -1137,6 +1133,7 @@ class SignalProcessingTab(QWidget):
stg.BS_noise_raw_data[data_id] ** 2)) #
else:
stg.BS_noise_raw_data[data_id] = (
np.full(stg.BS_raw_data[data_id].shape,
float(self.lineEdit_profile_tail_value.text().replace(",", "."))))
@ -1215,7 +1212,7 @@ class SignalProcessingTab(QWidget):
# elif self.canvas_SNR == None:
else:
data_id = max(0, self.combobox_acoustic_data_choice.currentIndex())
data_id = self.combobox_acoustic_data_choice.currentIndex()
if ((data_id != -1)
and (stg.BS_noise_raw_data[data_id].shape != (0,))):
@ -1344,7 +1341,7 @@ class SignalProcessingTab(QWidget):
msgBox.exec()
else:
data_id = max(0, self.combobox_acoustic_data_choice.currentIndex())
data_id = self.combobox_acoustic_data_choice.currentIndex()
stg.SNR_filter_value[data_id] = (
float(self.lineEdit_SNR_criterion.text().replace(",", ".")))
@ -1391,7 +1388,7 @@ class SignalProcessingTab(QWidget):
self.compute_averaged_BS_data()
def plot_pre_processed_BS_signal(self):
data_id = max(0, self.combobox_acoustic_data_choice.currentIndex())
data_id = self.combobox_acoustic_data_choice.currentIndex()
self.lineEdit_horizontal_average.setText(
str(stg.Nb_cells_to_average_BS_signal[data_id])
@ -1520,18 +1517,16 @@ class SignalProcessingTab(QWidget):
.addWidget(self.scroll_BS)
def update_label_cells_sec(self):
data_id = max(0, self.combobox_acoustic_data_choice.currentIndex())
print("Je change la valeur du moyennage")
print(stg.nb_profiles_per_sec)
print(stg.nb_profiles_per_sec[self.combobox_acoustic_data_choice.currentIndex()][0])
print(self.combobox_acoustic_data_choice.currentIndex())
self.label_cells_horizontal.clear()
self.label_cells_horizontal.setText(
"cells = +/- "
+ str(
(float(
self.lineEdit_horizontal_average.text().replace(",", ".")
) // 2)
* (1 / stg.nb_profiles_per_sec[data_id][0])
) + " sec"
)
"cells = +/- " +
str((float(self.lineEdit_horizontal_average.text().replace(",", ".")) // 2) *
(1 / stg.nb_profiles_per_sec[self.combobox_acoustic_data_choice.currentIndex()][0])) +
" sec")
def compute_averaged_BS_data(self):
if len(stg.filename_BS_raw_data) == 0:
@ -1549,7 +1544,7 @@ class SignalProcessingTab(QWidget):
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec()
else:
data_id = max(0, self.combobox_acoustic_data_choice.currentIndex())
data_id = self.combobox_acoustic_data_choice.currentIndex()
n_average = 2 * int(float(self.lineEdit_horizontal_average.text().replace(",", "."))) + 1
kernel_avg = np.ones(n_average)
logger.debug(f"kernel_avg: {kernel_avg}")
@ -1633,7 +1628,7 @@ class SignalProcessingTab(QWidget):
)
def plot_pre_processed_profile(self):
data_id = max(0, self.combobox_acoustic_data_choice.currentIndex())
data_id = self.combobox_acoustic_data_choice.currentIndex()
if ((data_id != -1) and
(stg.BS_noise_raw_data[data_id].shape != (0,))):
@ -1865,7 +1860,7 @@ class SignalProcessingTab(QWidget):
self.slider.setMaximum(10)
def update_plot_pre_processed_profile(self):
data_id = max(0, self.combobox_acoustic_data_choice.currentIndex())
data_id = self.combobox_acoustic_data_choice.currentIndex()
if ((data_id != -1) and
(stg.BS_noise_raw_data[data_id].shape != (0,))):