Signal processing: Fix open study file crash.
parent
413e8fb18e
commit
0cd9964594
|
|
@ -107,18 +107,18 @@ class ReadTableForOpen:
|
||||||
FROM AcousticFile
|
FROM AcousticFile
|
||||||
WHERE (acoustic_data = {k})
|
WHERE (acoustic_data = {k})
|
||||||
'''
|
'''
|
||||||
data = self.execute(query)
|
data = self.execute(query)[0]
|
||||||
print("data acoustic file", data)
|
print("data acoustic file", data)
|
||||||
|
|
||||||
stg.filename_BS_raw_data.append(
|
stg.filename_BS_raw_data.append(
|
||||||
[str(y[1]) + '.aqa' for y in data][0]
|
str(data[1]) + '.aqa'
|
||||||
)
|
)
|
||||||
stg.ABS_name.append([z[2] for z in data][0])
|
stg.ABS_name.append(data[2])
|
||||||
stg.path_BS_noise_data.append([z[3] for z in data][0])
|
stg.path_BS_noise_data.append(data[3])
|
||||||
stg.filename_BS_noise_data.append([z[4] for z in data][0])
|
stg.filename_BS_noise_data.append(data[4])
|
||||||
stg.noise_method.append([z[5] for z in data][0])
|
stg.noise_method.append(data[5])
|
||||||
stg.noise_value.append([z[6] for z in data][0])
|
stg.noise_value.append(data[6])
|
||||||
stg.data_preprocessed.append([z[7] for z in data][0])
|
stg.data_preprocessed.append(data[7])
|
||||||
|
|
||||||
logger.debug("data acoustic file:")
|
logger.debug("data acoustic file:")
|
||||||
logger.debug(f"- {stg.filename_BS_raw_data}")
|
logger.debug(f"- {stg.filename_BS_raw_data}")
|
||||||
|
|
@ -370,6 +370,7 @@ class ReadTableForOpen:
|
||||||
stg.time_noise.append(np.array([]))
|
stg.time_noise.append(np.array([]))
|
||||||
stg.depth_noise.append(np.array([]))
|
stg.depth_noise.append(np.array([]))
|
||||||
stg.BS_noise_raw_data.append(np.array([]))
|
stg.BS_noise_raw_data.append(np.array([]))
|
||||||
|
stg.BS_noise_averaged_data.append(np.array([]))
|
||||||
else:
|
else:
|
||||||
stg.time_noise.append(
|
stg.time_noise.append(
|
||||||
np_f64_parse(time).reshape(
|
np_f64_parse(time).reshape(
|
||||||
|
|
@ -390,6 +391,7 @@ class ReadTableForOpen:
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
stg.BS_noise_averaged_data.append(np.array([]))
|
||||||
|
|
||||||
def read_table_BS_raw_data_SNR(self, query, i):
|
def read_table_BS_raw_data_SNR(self, query, i):
|
||||||
np_f64_parse = lambda d: np.frombuffer(d, dtype=np.float64)
|
np_f64_parse = lambda d: np.frombuffer(d, dtype=np.float64)
|
||||||
|
|
@ -406,9 +408,11 @@ class ReadTableForOpen:
|
||||||
SNR_vars = [
|
SNR_vars = [
|
||||||
(stg.SNR_raw_data, stg.BS_raw_data),
|
(stg.SNR_raw_data, stg.BS_raw_data),
|
||||||
(stg.SNR_cross_section, stg.BS_cross_section),
|
(stg.SNR_cross_section, stg.BS_cross_section),
|
||||||
(stg.SNR_cross_section, stg.BS_stream_bed),
|
(stg.SNR_stream_bed, stg.BS_stream_bed),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
stg.SNR_stream_bed.append(np.array([]))
|
||||||
|
|
||||||
for dest, resh in SNR_vars:
|
for dest, resh in SNR_vars:
|
||||||
SNR = np_f64_parse(next(it))
|
SNR = np_f64_parse(next(it))
|
||||||
|
|
||||||
|
|
@ -417,7 +421,6 @@ class ReadTableForOpen:
|
||||||
else:
|
else:
|
||||||
dest.append(SNR.reshape(resh[i].shape))
|
dest.append(SNR.reshape(resh[i].shape))
|
||||||
|
|
||||||
|
|
||||||
def read_table_BS_raw_data_rest(self, query, i):
|
def read_table_BS_raw_data_rest(self, query, i):
|
||||||
np_f64_parse = lambda d: np.frombuffer(d, dtype=np.float64)
|
np_f64_parse = lambda d: np.frombuffer(d, dtype=np.float64)
|
||||||
data = self.execute(
|
data = self.execute(
|
||||||
|
|
@ -481,16 +484,21 @@ class ReadTableForOpen:
|
||||||
WHERE (acoustic_data = {s})
|
WHERE (acoustic_data = {s})
|
||||||
'''
|
'''
|
||||||
|
|
||||||
data3 = self.execute(query3)
|
data = self.execute(query3)
|
||||||
|
x = data[0]
|
||||||
|
|
||||||
stg.temperature = [x[1] for x in data3][0]
|
stg.temperature = [x[1]][0]
|
||||||
stg.tmin.append([(x[2], x[3]) for x in data3])
|
stg.tmin.append((x[2], x[3]))
|
||||||
stg.tmax.append([(x[4], x[5]) for x in data3])
|
stg.tmax.append((x[4], x[5]))
|
||||||
stg.rmin.append([(x[6], x[7]) for x in data3])
|
stg.rmin.append((x[6], x[7]))
|
||||||
stg.rmax.append([(x[8], x[9]) for x in data3])
|
stg.rmax.append((x[8], x[9]))
|
||||||
stg.freq_bottom_detection.append([(x[10], x[11]) for x in data3])
|
stg.freq_bottom_detection.append((x[10], x[11]))
|
||||||
stg.SNR_filter_value.append([x[12] for x in data3])
|
stg.SNR_filter_value.append(x[12])
|
||||||
stg.Nb_cells_to_average_BS_signal.append([x[13] for x in data3])
|
stg.Nb_cells_to_average_BS_signal.append(x[13])
|
||||||
|
|
||||||
|
logger.debug(f"stg.tmin: {stg.tmin}")
|
||||||
|
logger.debug(f"stg.tmin: {stg.tmax}")
|
||||||
|
logger.debug(f"stg.SNR_filter_value: {stg.SNR_filter_value}")
|
||||||
|
|
||||||
def read_table_sediment_file(self):
|
def read_table_sediment_file(self):
|
||||||
query = f'''
|
query = f'''
|
||||||
|
|
|
||||||
|
|
@ -1653,9 +1653,9 @@ class AcousticDataTab(QWidget):
|
||||||
stg.gain_tx.append(acoustic_data._gain_tx)
|
stg.gain_tx.append(acoustic_data._gain_tx)
|
||||||
stg.water_attenuation.append([])
|
stg.water_attenuation.append([])
|
||||||
|
|
||||||
# --- The other acoustic variables lists are filled with empty object. ---
|
self.initiate_setting_parameters_new_others()
|
||||||
# --- They will be used for pre- and post-processing ---
|
|
||||||
|
|
||||||
|
def initiate_setting_parameters_new_others(self):
|
||||||
stg.BS_cross_section.append(np.array([]))
|
stg.BS_cross_section.append(np.array([]))
|
||||||
stg.depth_cross_section.append(np.array([]))
|
stg.depth_cross_section.append(np.array([]))
|
||||||
stg.time_cross_section.append(np.array([]))
|
stg.time_cross_section.append(np.array([]))
|
||||||
|
|
|
||||||
|
|
@ -521,15 +521,12 @@ class SignalProcessingTab(QWidget):
|
||||||
self.blockSignals(True)
|
self.blockSignals(True)
|
||||||
self.combobox_acoustic_data_choice.blockSignals(True)
|
self.combobox_acoustic_data_choice.blockSignals(True)
|
||||||
|
|
||||||
self.combobox_acoustic_data_choice.addItems(stg.filename_BS_raw_data)
|
self.update_SignalPreprocessingTab(recompute=True)
|
||||||
|
|
||||||
# self.recompute()
|
|
||||||
# self.replot()
|
|
||||||
|
|
||||||
self.combobox_acoustic_data_choice.blockSignals(False)
|
self.combobox_acoustic_data_choice.blockSignals(False)
|
||||||
self.blockSignals(False)
|
self.blockSignals(False)
|
||||||
|
|
||||||
def update_SignalPreprocessingTab(self):
|
def update_SignalPreprocessingTab(self, recompute=True):
|
||||||
|
|
||||||
""" The tab is updated in two cases :
|
""" The tab is updated in two cases :
|
||||||
- the user remove a file (in the list widget) in the first tab (Acoustic data), so that the combobox
|
- the user remove a file (in the list widget) in the first tab (Acoustic data), so that the combobox
|
||||||
|
|
@ -567,7 +564,9 @@ class SignalProcessingTab(QWidget):
|
||||||
stg.freq_text[data_id]
|
stg.freq_text[data_id]
|
||||||
)
|
)
|
||||||
|
|
||||||
self.recompute()
|
if recompute:
|
||||||
|
self.recompute()
|
||||||
|
|
||||||
self.replot()
|
self.replot()
|
||||||
|
|
||||||
logger.debug("Update the Signal preprocessing tab... Done")
|
logger.debug("Update the Signal preprocessing tab... Done")
|
||||||
|
|
@ -795,9 +794,17 @@ class SignalProcessingTab(QWidget):
|
||||||
|
|
||||||
self.compute_average_profile_tail()
|
self.compute_average_profile_tail()
|
||||||
|
|
||||||
self.lineEdit_SNR_criterion.setText(str(stg.SNR_filter_value[self.combobox_acoustic_data_choice.currentIndex()]))
|
self.lineEdit_SNR_criterion.setText(
|
||||||
|
str(stg.SNR_filter_value[
|
||||||
|
self.combobox_acoustic_data_choice.currentIndex()
|
||||||
|
])
|
||||||
|
)
|
||||||
|
|
||||||
self.lineEdit_horizontal_average.setText(str(stg.Nb_cells_to_average_BS_signal[self.combobox_acoustic_data_choice.currentIndex()]))
|
self.lineEdit_horizontal_average.setText(
|
||||||
|
str(stg.Nb_cells_to_average_BS_signal[
|
||||||
|
self.combobox_acoustic_data_choice.currentIndex()
|
||||||
|
])
|
||||||
|
)
|
||||||
|
|
||||||
self.combobox_frequency_profile.clear()
|
self.combobox_frequency_profile.clear()
|
||||||
self.combobox_frequency_profile.addItems(
|
self.combobox_frequency_profile.addItems(
|
||||||
|
|
|
||||||
2
main.py
2
main.py
|
|
@ -97,7 +97,7 @@ class MainApplication(QMainWindow):
|
||||||
|
|
||||||
self.tabs = [
|
self.tabs = [
|
||||||
self.acoustic_data_tab,
|
self.acoustic_data_tab,
|
||||||
# self.signal_processing_tab,
|
self.signal_processing_tab,
|
||||||
# self.sample_data_tab,
|
# self.sample_data_tab,
|
||||||
# self.sediment_calibration_tab,
|
# self.sediment_calibration_tab,
|
||||||
# self.acoustic_inversion_tab,
|
# self.acoustic_inversion_tab,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue