Corrections have been made when the user close the file dialog, to download a file (or select a directory), without selecteting a file (or a folder).
parent
111bc21d5a
commit
a62895d8ad
|
|
@ -607,12 +607,14 @@ class SampleDataTab(QWidget):
|
|||
msgBox.setStandardButtons(QMessageBox.Ok)
|
||||
msgBox.exec()
|
||||
else:
|
||||
self.lineEdit_fine_sediment.clear()
|
||||
self.lineEdit_fine_sediment.setText(stg.filename_fine)
|
||||
self.lineEdit_fine_sediment.setToolTip(stg.path_fine)
|
||||
self.fill_table_fine()
|
||||
|
||||
# --- Function to select directory and file name of sand sediments sample data ---
|
||||
def open_dialog_box_sand_sediment(self):
|
||||
|
||||
print("Sand sediment file", [stg.path_sand if stg.path_sand else stg.path_fine if stg.path_fine
|
||||
else stg.path_BS_raw_data[-1] if self.combobox_acoustic_data.count() > 0 else ""][0])
|
||||
filename_sand_sediment = QFileDialog.getOpenFileName(
|
||||
|
|
@ -992,7 +994,7 @@ class SampleDataTab(QWidget):
|
|||
depth_bottom_to_plot_fine = []
|
||||
print("time fine ", stg.time_fine)
|
||||
for k in range(len(position_list_fine)):
|
||||
print("k = ", k, "type(k) = ", type(k))
|
||||
# print("k = ", k, "type(k) = ", type(k))
|
||||
Ctot_fine_to_plot.append(stg.Ctot_fine[position_list_fine[k]])
|
||||
Ctot_fine_percent_to_plot.append(stg.Ctot_fine_per_cent[position_list_fine[k]])
|
||||
sample_depth_to_plot_fine.append(stg.depth_fine[position_list_fine[k]])
|
||||
|
|
@ -1043,7 +1045,7 @@ class SampleDataTab(QWidget):
|
|||
stg.time_fine[position_list_fine[k]])))[
|
||||
0][0])
|
||||
|
||||
print("indices_bottom_fine ", indices_bottom_fine)
|
||||
# print("indices_bottom_fine ", indices_bottom_fine)
|
||||
|
||||
if stg.depth_cross_section[self.combobox_acoustic_data.currentIndex()].shape != (0,):
|
||||
|
||||
|
|
@ -1063,7 +1065,7 @@ class SampleDataTab(QWidget):
|
|||
|
||||
|
||||
|
||||
print("depth_bottom_to_plot_fine ", depth_bottom_to_plot_fine)
|
||||
# print("depth_bottom_to_plot_fine ", depth_bottom_to_plot_fine)
|
||||
|
||||
return Ctot_fine_to_plot, Ctot_fine_percent_to_plot, sample_depth_to_plot_fine, indices_bottom_fine, depth_bottom_to_plot_fine
|
||||
|
||||
|
|
@ -1078,7 +1080,7 @@ class SampleDataTab(QWidget):
|
|||
position.append(i)
|
||||
eval(f"color_list.append(self.comboBox_sample_table_sand{i}.currentText())")
|
||||
sample_checkbox[0, i] = 2
|
||||
print("SAND : position ", position, " color_list ", color_list)
|
||||
# print("SAND : position ", position, " color_list ", color_list)
|
||||
# self.update_plot_sample_position_on_transect()
|
||||
return position, color_list
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ from os import path
|
|||
from View.checkable_combobox import CheckableComboBox
|
||||
|
||||
from Model.acoustic_inversion_method_high_concentration import AcousticInversionMethodHighConcentration
|
||||
from settings import J_cross_section
|
||||
from settings import J_cross_section, alpha_s
|
||||
|
||||
|
||||
# from settings import depth_cross_section, BS_raw_data_pre_process_average, BS_raw_data_pre_process_SNR, BS_raw_data, \
|
||||
|
|
@ -2195,27 +2195,42 @@ class SedimentCalibrationTab(QWidget):
|
|||
|
||||
def save_calibration(self):
|
||||
|
||||
dir_save_cal = QFileDialog.getExistingDirectory(
|
||||
caption="Save calibration",
|
||||
directory=[stg.path_calibration_file if stg.path_calibration_file else stg.path_BS_raw_data[-1] if self.combobox_acoustic_data_choice.count() > 0 else ""][0],
|
||||
options=QFileDialog.DontUseNativeDialog)
|
||||
if stg.alpha_s:
|
||||
|
||||
stg.path_calibration_file = path.dirname(dir_save_cal)
|
||||
dir_save_cal = QFileDialog.getExistingDirectory(
|
||||
caption="Save calibration",
|
||||
directory=[stg.path_calibration_file if stg.path_calibration_file else stg.path_BS_raw_data[-1] if self.combobox_acoustic_data_choice.count() > 0 else ""][0],
|
||||
options=QFileDialog.DontUseNativeDialog)
|
||||
|
||||
cal_array = [[' ', stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[0][1]],
|
||||
stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[1][1]]],
|
||||
['ks', stg.ks[0], stg.ks[1]],
|
||||
['sv', stg.sv[0], stg.sv[1]],
|
||||
['X', stg.X_exponent[0], 0],
|
||||
['alphas', stg.alpha_s[0], stg.alpha_s[1]],
|
||||
['zeta', stg.zeta[0], stg.zeta[1]]]
|
||||
print("dir_save_cal ", dir_save_cal)
|
||||
|
||||
eval("np.savetxt('"+ dir_save_cal + "/Sediment_calibration_" +
|
||||
str(stg.filename_BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][:-4]) + ".csv' ," +
|
||||
"cal_array, " +
|
||||
"delimiter=',' ," +
|
||||
"fmt ='% s'" +
|
||||
")")
|
||||
if dir_save_cal:
|
||||
|
||||
stg.path_calibration_file = path.dirname(dir_save_cal)
|
||||
|
||||
cal_array = [[' ', stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[0][1]],
|
||||
stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()][stg.frequencies_for_calibration[1][1]]],
|
||||
['ks', stg.ks[0], stg.ks[1]],
|
||||
['sv', stg.sv[0], stg.sv[1]],
|
||||
['X', stg.X_exponent[0], 0],
|
||||
['alphas', stg.alpha_s[0], stg.alpha_s[1]],
|
||||
['zeta', stg.zeta[0], stg.zeta[1]]]
|
||||
|
||||
eval("np.savetxt('"+ dir_save_cal + "/Sediment_calibration_" +
|
||||
str(stg.filename_BS_raw_data[self.combobox_acoustic_data_choice.currentIndex()][:-4]) + ".csv' ," +
|
||||
"cal_array, " +
|
||||
"delimiter=',' ," +
|
||||
"fmt ='% s'" +
|
||||
")")
|
||||
|
||||
else:
|
||||
|
||||
msgBox = QMessageBox()
|
||||
msgBox.setWindowTitle("Save Error")
|
||||
msgBox.setIcon(QMessageBox.Warning)
|
||||
msgBox.setText("Please compute calibration before saving")
|
||||
msgBox.setStandardButtons(QMessageBox.Ok)
|
||||
msgBox.exec()
|
||||
|
||||
# --- Compute FCB ---
|
||||
|
||||
|
|
|
|||
|
|
@ -922,12 +922,15 @@ class SignalProcessingTab(QWidget):
|
|||
[stg.path_BS_raw_data[-1] if self.combobox_acoustic_data_choice.count() > 0 else ""][0],
|
||||
"Aquascat file (*.aqa)",
|
||||
options=QFileDialog.DontUseNativeDialog)
|
||||
dir_name = path.dirname(filename[0][0])
|
||||
name = path.basename(filename[0][0])
|
||||
|
||||
try:
|
||||
print("filename noise ", filename)
|
||||
if filename[0]:
|
||||
dir_name = path.dirname(filename[0][0])
|
||||
name = path.basename(filename[0][0])
|
||||
stg.path_BS_noise_data[self.combobox_acoustic_data_choice.currentIndex()] = dir_name
|
||||
stg.filename_BS_noise_data[self.combobox_acoustic_data_choice.currentIndex()] = name
|
||||
|
||||
try:
|
||||
|
||||
print("stg.path_BS_noise_data : ", stg.path_BS_noise_data)
|
||||
print("stg.filename_BS_noise_data : ", stg.filename_BS_noise_data)
|
||||
self.load_noise_data_and_compute_SNR()
|
||||
|
|
@ -992,6 +995,15 @@ class SignalProcessingTab(QWidget):
|
|||
|
||||
self.activate_list_of_pre_processed_data()
|
||||
|
||||
else:
|
||||
|
||||
msgBox = QMessageBox()
|
||||
msgBox.setWindowTitle("Download Error")
|
||||
msgBox.setIcon(QMessageBox.Warning)
|
||||
msgBox.setText("Please upload acoustic data")
|
||||
msgBox.setStandardButtons(QMessageBox.Ok)
|
||||
msgBox.exec()
|
||||
|
||||
|
||||
def load_noise_data_and_compute_SNR(self):
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue