The calibration can be save in a csv file.
parent
2aae88e0b5
commit
97a3ed2dbb
|
|
@ -25,6 +25,7 @@ from View.checkable_combobox import CheckableComboBox
|
||||||
|
|
||||||
from Model.acoustic_inversion_method_high_concentration import AcousticInversionMethodHighConcentration
|
from Model.acoustic_inversion_method_high_concentration import AcousticInversionMethodHighConcentration
|
||||||
from settings import depth_cross_section, BS_raw_data_pre_process_average, BS_raw_data_pre_process_SNR, BS_raw_data
|
from settings import depth_cross_section, BS_raw_data_pre_process_average, BS_raw_data_pre_process_SNR, BS_raw_data
|
||||||
|
# from virtual_env.bin.odfimg import directory
|
||||||
|
|
||||||
|
|
||||||
class SedimentCalibrationTab(QWidget):
|
class SedimentCalibrationTab(QWidget):
|
||||||
|
|
@ -332,6 +333,10 @@ class SedimentCalibrationTab(QWidget):
|
||||||
self.spinbox_zeta_freq2.setSuffix(" /m")
|
self.spinbox_zeta_freq2.setSuffix(" /m")
|
||||||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.spinbox_zeta_freq2, 6, 2, 1, 1)
|
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.spinbox_zeta_freq2, 6, 2, 1, 1)
|
||||||
|
|
||||||
|
self.pushbutton_save_calibration = QPushButton()
|
||||||
|
self.pushbutton_save_calibration.setText("Save calibration")
|
||||||
|
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.pushbutton_save_calibration,7, 3, 1, 1)
|
||||||
|
|
||||||
# self.groupbox_calibration_compute_size_change()
|
# self.groupbox_calibration_compute_size_change()
|
||||||
|
|
||||||
# self.animaiton_groupbox_compute = QPropertyAnimation(self.groupbox_sediment_calibration_compute, b"size")
|
# self.animaiton_groupbox_compute = QPropertyAnimation(self.groupbox_sediment_calibration_compute, b"size")
|
||||||
|
|
@ -459,6 +464,8 @@ class SedimentCalibrationTab(QWidget):
|
||||||
|
|
||||||
self.pushbutton_compute_calibration.clicked.connect(self.function_pushbutton_compute_calibration)
|
self.pushbutton_compute_calibration.clicked.connect(self.function_pushbutton_compute_calibration)
|
||||||
|
|
||||||
|
self.pushbutton_save_calibration.clicked.connect(self.save_calibration)
|
||||||
|
|
||||||
self.pushbutton_left_to_begin_FCB.clicked.connect(self.slider_profile_number_to_begin_FCB)
|
self.pushbutton_left_to_begin_FCB.clicked.connect(self.slider_profile_number_to_begin_FCB)
|
||||||
self.pushbutton_left_FCB.clicked.connect(self.slider_profile_number_to_left_FCB)
|
self.pushbutton_left_FCB.clicked.connect(self.slider_profile_number_to_left_FCB)
|
||||||
self.pushbutton_right_FCB.clicked.connect(self.slider_profile_number_to_right_FCB)
|
self.pushbutton_right_FCB.clicked.connect(self.slider_profile_number_to_right_FCB)
|
||||||
|
|
@ -1096,7 +1103,7 @@ class SedimentCalibrationTab(QWidget):
|
||||||
|
|
||||||
filename = QFileDialog.getOpenFileName(self, "Open file",
|
filename = QFileDialog.getOpenFileName(self, "Open file",
|
||||||
[stg.path_BS_raw_data[-1] if stg.path_BS_raw_data[-1] != "" else ""][0],
|
[stg.path_BS_raw_data[-1] if stg.path_BS_raw_data[-1] != "" else ""][0],
|
||||||
"Calibration file (*.xls, *.ods)")
|
"Calibration file (*.xls, *.ods, *csv)")
|
||||||
dir_name = path.dirname(filename[0])
|
dir_name = path.dirname(filename[0])
|
||||||
name = path.basename(filename[0])
|
name = path.basename(filename[0])
|
||||||
|
|
||||||
|
|
@ -1122,12 +1129,18 @@ class SedimentCalibrationTab(QWidget):
|
||||||
|
|
||||||
def read_calibration_file_and_fill_parameter(self):
|
def read_calibration_file_and_fill_parameter(self):
|
||||||
# --- Read calibration file ---
|
# --- Read calibration file ---
|
||||||
data = pd.read_excel(stg.calibration_file[0] + "/" + stg.calibration_file[1], header=0, index_col=0)
|
data = pd.read_csv(stg.calibration_file[0] + "/" + stg.calibration_file[1], header=0, index_col=0)
|
||||||
print(data.head())
|
print(data.head())
|
||||||
print(data.iloc[0][0])
|
print(data.iloc[0][0])
|
||||||
print(type(data.iloc[0][0]))
|
print(type(data.iloc[0][0]))
|
||||||
|
|
||||||
# --- Fill spinboxes of calibration parameter ---
|
# --- Fill spinboxes of calibration parameter ---
|
||||||
|
self.label_freq1.clear()
|
||||||
|
self.label_freq1.setText(data.columns[0])
|
||||||
|
|
||||||
|
self.label_freq2.clear()
|
||||||
|
self.label_freq2.setText(data.columns[1])
|
||||||
|
|
||||||
self.spinbox_ks_freq1.clear()
|
self.spinbox_ks_freq1.clear()
|
||||||
self.spinbox_ks_freq1.setValue(float(data.iloc[0][0]))
|
self.spinbox_ks_freq1.setValue(float(data.iloc[0][0]))
|
||||||
|
|
||||||
|
|
@ -1813,6 +1826,25 @@ class SedimentCalibrationTab(QWidget):
|
||||||
self.spinbox_zeta_freq2.clear()
|
self.spinbox_zeta_freq2.clear()
|
||||||
self.spinbox_zeta_freq2.setValue(zeta_freq2)
|
self.spinbox_zeta_freq2.setValue(zeta_freq2)
|
||||||
|
|
||||||
|
def save_calibration(self):
|
||||||
|
|
||||||
|
dir_save_cal = QFileDialog.getExistingDirectory(caption="Save calibration")
|
||||||
|
|
||||||
|
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'" +
|
||||||
|
")")
|
||||||
|
|
||||||
# --- Compute FCB ---
|
# --- Compute FCB ---
|
||||||
|
|
||||||
# ------------ Computing real cell size ------------ #
|
# ------------ Computing real cell size ------------ #
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue