From 58138d0e4e1d7b8bb5ce7ce93920b81963690f97 Mon Sep 17 00:00:00 2001 From: brahim Date: Tue, 8 Aug 2023 15:40:35 +0200 Subject: [PATCH] File setting is created to store global variables used all along tabs. Acoustic data tab is re-write with global variables. --- Model/acoustic_data_loader.py | 45 +-- View/acoustic_data_tab.py | 541 +++++++++++++++++++++------------- settings.py | 45 +++ 3 files changed, 405 insertions(+), 226 deletions(-) create mode 100644 settings.py diff --git a/Model/acoustic_data_loader.py b/Model/acoustic_data_loader.py index 0259b97..569fc47 100644 --- a/Model/acoustic_data_loader.py +++ b/Model/acoustic_data_loader.py @@ -5,10 +5,10 @@ import pandas as pd import matplotlib.pyplot as plt from matplotlib.colors import LogNorm -path_BS_raw_data = "/home/bmoudjed/Documents/3 SSC acoustic meas project/Graphical interface project/" \ - "Data/Acoustic_data/20180107123500.aqa" -path_noise_data = "/home/bmoudjed/Documents/3 SSC acoustic meas project/Graphical interface project/" \ - "Data/AcousticNoise_data/20180107121600.aqa" +# path_BS_raw_data = "/home/bmoudjed/Documents/3 SSC acoustic meas project/Graphical interface project/" \ +# "Data/Acoustic_data/20180107123500.aqa" +# path_noise_data = "/home/bmoudjed/Documents/3 SSC acoustic meas project/Graphical interface project/" \ +# "Data/AcousticNoise_data/20180107121600.aqa" class AcousticDataLoader(): @@ -39,29 +39,32 @@ class AcousticDataLoader(): self._gain_rx = self._data_BS.RxGain self._gain_tx = self._data_BS.TxGain - self._snr = np.array([]) - self._snr_reshape = np.array([]) - self._time_snr = np.array([]) + # self._snr = np.array([]) + # self._snr_reshape = np.array([]) + # self._time_snr = np.array([]) + + # print(type(self._gain_tx)) # print(["BS - " + f for f in self._freq_text]) # print(self._time.shape[0]*self._r.shape[0]*4) # fig, ax = plt.subplots(nrows=1, ncols=1) - # ax.pcolormesh(self._time, self._r, np.flipud(self._BS_raw_data[:, 1, :]), + # ax.pcolormesh(self._time, self._r, (self._BS_raw_data[:, 1, :]), # cmap='viridis', # norm=LogNorm(vmin=1e-5, vmax=np.max(self._BS_raw_data[:, 0, :]))) # , shading='gouraud') - # ax.pcolormesh(range(self._BS_raw_data.shape[2]), range(self._BS_raw_data.shape[0]), self._BS_raw_data[:, 1, :], cmap='viridis', - # norm=LogNorm(vmin=1e-5, vmax=np.max(self._BS_raw_data[:, 0, :]))) # , shading='gouraud') + # # ax.pcolormesh(range(self._BS_raw_data.shape[2]), range(self._BS_raw_data.shape[0]), self._BS_raw_data[:, 1, :], cmap='viridis', + # # norm=LogNorm(vmin=1e-5, vmax=np.max(self._BS_raw_data[:, 0, :]))) # , shading='gouraud') # plt.show() + # fig, ax = plt.subplots(nrows=1, ncols=1) + # ax.plot(self._BS_raw_data[:, 0, 100] , self._r) + # ax.set_ylim(2, 20) + # plt.show() # print(self.reshape_BS_raw_cross_section()[0, 0]) # self.reshape_r() # self.reshape_t() - # dataframe = self.concatenate_data() - # print(dataframe) - def reshape_BS_raw_cross_section(self): BS_raw_cross_section = np.reshape(self._BS_raw_data, (self._r.shape[0]*len(self._time), self._freq.shape[0]), @@ -78,14 +81,14 @@ class AcousticDataLoader(): t = np.reshape(np.repeat(self._time, self._r.shape[0]), (self._time.shape[0]*self._r.shape[0], 1)) return t - def concatenate_data(self): - self.reshape_t() - self.reshape_BS_raw_cross_section() - # print(self.reshape_t().shape) - # print(se.lf.reshape_BS_raw_cross_section().shape) - df = pd.DataFrame(np.concatenate((self.reshape_t(), self.reshape_BS_raw_cross_section()), axis=1), - columns=["time"] + self._freq_text) - return df + # def concatenate_data(self): + # self.reshape_t() + # self.reshape_BS_raw_cross_section() + # # print(self.reshape_t().shape) + # # print(se.lf.reshape_BS_raw_cross_section().shape) + # df = pd.DataFrame(np.concatenate((self.reshape_t(), self.reshape_BS_raw_cross_section()), axis=1), + # columns=["time"] + self._freq_text) + # return df # if __name__ == "__main__": diff --git a/View/acoustic_data_tab.py b/View/acoustic_data_tab.py index f57f0e7..962bd03 100644 --- a/View/acoustic_data_tab.py +++ b/View/acoustic_data_tab.py @@ -1,8 +1,9 @@ import sys -from PyQt5.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QGroupBox, QPushButton, QComboBox, QLineEdit, QLabel, \ +from PyQt5.QtWidgets import (QWidget, QVBoxLayout, QHBoxLayout, QGroupBox, QPushButton, QComboBox, QLineEdit, QLabel, \ QGridLayout, QSpinBox, QDoubleSpinBox, QTableView, QTableWidget, QSpacerItem, QSizePolicy, \ - QAbstractScrollArea, QFileDialog, QTableWidgetItem, QMessageBox, QScrollBar, QScrollArea + QAbstractScrollArea, QFileDialog, QTableWidgetItem, QMessageBox, QScrollBar, QScrollArea, + QProgressBar) from PyQt5.QtGui import QPixmap, QIcon from PyQt5.QtCore import Qt, QCoreApplication, pyqtSignal, pyqtSlot, QEvent @@ -31,6 +32,8 @@ from View.window_noise_level_averaged_profile import WindowNoiseLevelTailAverage from View.sample_data_tab import SampleDataTab +import settings as stg + _translate = QCoreApplication.translate @@ -336,7 +339,7 @@ class AcousticDataTab(QWidget): self.spinbox_tmin.setRange(0, 9999) self.gridLayout_groupbox_xaxis_time.addWidget(self.spinbox_tmin, 0, 2, 1, 1) self.spinbox_tmin.valueChanged.connect(self.update_xaxis_transect_with_BS_raw_data) - self.spinbox_tmin.valueChanged.connect(self.update_xaxis_transect_with_SNR_data) + # self.spinbox_tmin.valueChanged.connect(self.plot_transect_with_BS_raw_data) self.label_tmin_unit = QLabel() self.label_tmin_unit.setText("sec") @@ -354,7 +357,7 @@ class AcousticDataTab(QWidget): self.spinbox_tmax.setRange(0, 9999) self.gridLayout_groupbox_xaxis_time.addWidget(self.spinbox_tmax, 0, 6, 1, 1) self.spinbox_tmax.valueChanged.connect(self.update_xaxis_transect_with_BS_raw_data) - self.spinbox_tmax.valueChanged.connect(self.update_xaxis_transect_with_SNR_data) + # self.spinbox_tmax.valueChanged.connect(self.update_xaxis_transect_with_SNR_data) self.label_tmax_unit = QLabel() self.label_tmax_unit.setText("sec") @@ -405,7 +408,7 @@ class AcousticDataTab(QWidget): self.gridlayout_compute_bathymetry = QGridLayout(self.groupbox_compute_bathymetry) self.combobox_freq_choice = QComboBox() - self.combobox_freq_choice.addItems(['', '0.3 MHz', '0.5 Mhz', '1 MHz', '5 MHz']) + # self.combobox_freq_choice.addItems(['', '0.3 MHz', '0.5 Mhz', '1 MHz', '5 MHz']) self.gridlayout_compute_bathymetry.addWidget(self.combobox_freq_choice, 0, 0, 2, 1) self.gridlayout_compute_bathymetry.addWidget(self.label_from, 0, 1, 1, 1) self.spinbox_depth_min = QSpinBox() @@ -631,6 +634,7 @@ class AcousticDataTab(QWidget): self.WindowNoiseLevelTailAveragedProfile().show() def open_dialog_box(self): + # --- Open dialog box + choice directory and select file --- if self.combobox_ABS_system_choice.currentIndex() == 0: msgBox = QMessageBox() msgBox.setWindowTitle("Download Error") @@ -648,100 +652,109 @@ class AcousticDataTab(QWidget): filename = QFileDialog.getOpenFileName(self, "Open file", "", "UBSediFlow file (*.udt)") dir_name = path.dirname(filename[0]) name = path.basename(filename[0]) + + # --- Fill lineEdit with path and file names + load acoustic data --- + # --- fill date, hour and measurements information + fill frequency combobox for bottom detection --- if self.combobox_ABS_system_choice.currentIndex() != 0: if self.sender().objectName() == "pushbutton_acoustic_file": - self.lineEdit_acoustic_file.setText(name) - self.lineEdit_acoustic_file.setToolTip(dir_name) - acoustic_data = self.load_BS_acoustic_raw_data() + stg.path_BS_raw_data = dir_name + stg.filename_BS_raw_data = name + self.load_BS_acoustic_raw_data() + self.lineEdit_acoustic_file.setText(stg.filename_BS_raw_data) + self.lineEdit_acoustic_file.setToolTip(stg.path_BS_raw_data) self.label_date_groupbox_acoustic_file.setText( - _translate("CONSTANT_STRING", cs.DATE) + ": " + str(acoustic_data._date)) + _translate("CONSTANT_STRING", cs.DATE) + ": " + str(stg.date)) self.label_hour_groupbox_acoustic_file.setText( - _translate("CONSTANT_STRING", cs.HOUR) + ": " + str(acoustic_data._hour)) + _translate("CONSTANT_STRING", cs.HOUR) + ": " + str(stg.hour)) self.fill_measurements_information_groupbox() + self.combobox_freq_choice.addItems([f for f in stg.freq_text]) if self.sender().objectName() == "pushbutton_noise_file": - self.lineEdit_noise_file.setText(name) - self.lineEdit_noise_file.setToolTip(dir_name) - noise_data = self.load_noise_data() + stg.path_BS_noise_data = dir_name + stg.filename_BS_noise_data = name + self.load_noise_data_and_compute_SNR() + self.lineEdit_noise_file.setText(stg.filename_BS_noise_data) + self.lineEdit_noise_file.setToolTip(stg.path_BS_noise_data) self.label_date_groupbox_noise_file.setText( - _translate("CONSTANT_STRING", cs.DATE) + ": " + str(noise_data._date)) + _translate("CONSTANT_STRING", cs.DATE) + ": " + str(stg.date_noise)) self.label_hour_groupbox_noise_file.setText( - _translate("CONSTANT_STRING", cs.HOUR) + ": " + str(noise_data._hour)) - # return filename[0] + _translate("CONSTANT_STRING", cs.HOUR) + ": " + str(stg.hour_noise)) def load_BS_acoustic_raw_data(self): - acoustic_data = \ - AcousticDataLoader(self.lineEdit_acoustic_file.toolTip() + "/" + self.lineEdit_acoustic_file.text()) - return acoustic_data + acoustic_data = AcousticDataLoader(stg.path_BS_raw_data + "/" + stg.filename_BS_raw_data) + stg.BS_raw_data = acoustic_data._BS_raw_data + stg.BS_raw_data_reshape = acoustic_data.reshape_BS_raw_cross_section() + stg.r = acoustic_data._r + stg.r_reshape = acoustic_data.reshape_r() + stg.time = acoustic_data._time + stg.time_reshape = acoustic_data.reshape_t() + stg.freq = acoustic_data._freq + stg.freq_text = acoustic_data._freq_text + stg.date = acoustic_data._date + stg.hour = acoustic_data._hour + stg.nb_profiles = acoustic_data._nb_profiles + stg.nb_profiles_per_sec = acoustic_data._nb_profiles_per_sec + stg.nb_cells = acoustic_data._nb_cells + stg.cell_size = acoustic_data._cell_size + stg.pulse_length = acoustic_data._cell_size + stg.nb_pings_per_sec = acoustic_data._nb_pings_per_sec + stg.nb_pings_averaged_per_profile = acoustic_data._nb_pings_averaged_per_profile + stg.kt = acoustic_data._kt + stg.gain_rx = acoustic_data._gain_rx + stg.gain_tx = acoustic_data._gain_tx - def load_noise_data(self): - noise_data = AcousticDataLoader(self.lineEdit_noise_file.toolTip() + "/" + self.lineEdit_noise_file.text()) - return noise_data - - def compute_SNR(self): - acoustic_data = self.load_BS_acoustic_raw_data() - noise_data = self.load_noise_data() - noise = np.zeros(acoustic_data._BS_raw_data.shape) + def load_noise_data_and_compute_SNR(self): + noise_data = AcousticDataLoader(stg.path_BS_noise_data + "/" + stg.filename_BS_noise_data) + stg.BS_noise_data = noise_data._BS_raw_data + stg.date_noise = noise_data._date + stg.hour_noise = noise_data._hour + stg.time_snr = noise_data._time + noise = np.zeros(stg.BS_raw_data.shape) for f in range(noise_data._freq.shape[0]): - # print(np.mean(self.V_noise[:, f, :], axis=(0, 1))) - # BS_noise_section[0:BS_noise_section.shape[0], f, 0:BS_noise_section.shape[2]] = \ - noise[:, f, :] = np.mean(noise_data._BS_raw_data[:, f, :], axis=(0, 1)) - noise_data._time_snr = acoustic_data._time - noise_data._snr = np.divide((acoustic_data._BS_raw_data - noise)**2, noise**2) - noise_data._snr_reshape = np.reshape(noise_data._snr, - (acoustic_data._r.shape[0] * acoustic_data._time.shape[0], - noise_data._freq.shape[0]), - order="F") - return noise_data + noise[:, f, :] = np.mean(stg.BS_noise_data[:, f, :], axis=(0, 1)) + stg.snr = np.divide((stg.BS_raw_data - noise) ** 2, noise ** 2) + stg.snr_reshape = np.reshape(stg.snr, (stg.r.shape[0] * stg.time.shape[0], stg.freq.shape[0]), order="F") def fill_measurements_information_groupbox(self): - acoustic_data = self.load_BS_acoustic_raw_data() + # acoustic_data = self.load_BS_acoustic_raw_data() self.label_profiles.setText( - _translate("CONSTANT_STRING", cs.NB_PROFILES) + ": " + str(acoustic_data._nb_profiles)) + _translate("CONSTANT_STRING", cs.NB_PROFILES) + ": " + str(stg.nb_profiles)) self.label_profiles_per_sec.setText( _translate("CONSTANT_STRING", cs.NB_PROFILES_PER_SEC) + ": " + - str(acoustic_data._nb_profiles_per_sec) + " Hz") + str(stg.nb_profiles_per_sec) + " Hz") self.label_freq.setText( - _translate("CONSTANT_STRING", cs.FREQUENCY) + ": " + ', '.join(acoustic_data._freq_text)) + _translate("CONSTANT_STRING", cs.FREQUENCY) + ": " + ', '.join(stg.freq_text)) self.label_cells.setText( - _translate("CONSTANT_STRING", cs.NB_CELLS) + ": " + str(acoustic_data._nb_cells)) + _translate("CONSTANT_STRING", cs.NB_CELLS) + ": " + str(stg.nb_cells)) self.label_cell_size.setText( - _translate("CONSTANT_STRING", cs.CELL_SIZE) + ": " + str(100*round(acoustic_data._cell_size, 3)) + " cm") + _translate("CONSTANT_STRING", cs.CELL_SIZE) + ": " + str(100*round(stg.cell_size, 3)) + " cm") self.label_pulse_length.setText( - _translate("CONSTANT_STRING", cs.PULSE_LENGHT) + ": " + str(round(acoustic_data._pulse_length,6)) + "sec") + _translate("CONSTANT_STRING", cs.PULSE_LENGHT) + ": " + str(round(stg.pulse_length,6)) + "sec") self.label_pings_per_sec.setText( - _translate("CONSTANT_STRING", cs.NB_PINGS_PER_SEC) + ": " + str(acoustic_data._nb_pings_per_sec) + " Hz") + _translate("CONSTANT_STRING", cs.NB_PINGS_PER_SEC) + ": " + str(stg.nb_pings_per_sec) + " Hz") self.label_pings_per_profile.setText( _translate("CONSTANT_STRING", cs.NB_PINGS_PER_PROFILE) + ": " + - str(acoustic_data._nb_pings_averaged_per_profile)) + str(stg.nb_pings_averaged_per_profile)) self.label_kt.setText( - _translate("CONSTANT_STRING", cs.KT) + ": " + ', '.join(map(str, acoustic_data._kt))) + _translate("CONSTANT_STRING", cs.KT) + ": " + ', '.join(map(str, stg.kt))) self.label_rx.setText( - _translate("CONSTANT_STRING", cs.GAIN_RX) + ": " + ', '.join(map(str, acoustic_data._gain_rx))) + _translate("CONSTANT_STRING", cs.GAIN_RX) + ": " + ', '.join(map(str, stg.gain_rx))) self.label_tx.setText( - _translate("CONSTANT_STRING", cs.GAIN_TX) + ": " + ', '.join(map(str, acoustic_data._gain_tx))) + _translate("CONSTANT_STRING", cs.GAIN_TX) + ": " + ', '.join(map(str, stg.gain_tx))) def fill_table(self): if ((self.lineEdit_acoustic_file.text()) and (self.lineEdit_noise_file.text())): - # --- Load data --- - acoustic_data = self.load_BS_acoustic_raw_data() - noise_data = self.compute_SNR() - # --- Fill table with data --- - data = pd.DataFrame( - np.concatenate((acoustic_data.reshape_t(), acoustic_data.reshape_BS_raw_cross_section(), - noise_data._snr_reshape), axis=1), - columns=list(map(str, ["Time"] + ["BS - " + f for f in acoustic_data._freq_text] + - ["SNR - " + f for f in acoustic_data._freq_text]))) - self.tableModel = TableModel(data) + stg.DataFrame_acoustic = pd.DataFrame( + np.concatenate((stg.time_reshape, stg.BS_raw_data_reshape, stg.snr_reshape), axis=1), + columns=list(map(str, ["Time"] + ["BS - " + f for f in stg.freq_text] + + ["SNR - " + f for f in stg.freq_text]))) + self.tableModel = TableModel(stg.DataFrame_acoustic) self.tableView.setModel(self.tableModel) elif self.lineEdit_acoustic_file.text(): - # --- Load data --- - acoustic_data = self.load_BS_acoustic_raw_data() - # --- Fill table with data --- - data = pd.DataFrame( - np.concatenate((acoustic_data.reshape_t(), acoustic_data.reshape_BS_raw_cross_section()), axis=1), - columns=list(map(str, ["Time"] + ["BS - " + f for f in acoustic_data._freq_text]))) - self.tableModel = TableModel(data) + stg.DataFrame_acoustic = pd.DataFrame( + np.concatenate((stg.time_reshape, stg.BS_raw_data_reshape), axis=1), + columns=list(map(str, ["Time"] + ["BS - " + f for f in stg.freq_text]))) + self.tableModel = TableModel(stg.DataFrame_acoustic) self.tableView.setModel(self.tableModel) else: msgBox = QMessageBox() @@ -773,16 +786,21 @@ class AcousticDataTab(QWidget): # self.groupbox_xaxis_space.setDisabled(True) def plot_transect_with_BS_raw_data(self): - if self.tableModel.rowCount(1) > 11: - acoustic_data = self.load_BS_acoustic_raw_data() - # print(np.max(acoustic_data._time)) + # --- Condition if table is not filled --- - # print("tmin value ", self.spinbox_tmin.value()) - # print("tmin index ", np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmin.value())[0][0]) + if self.tableModel.rowCount(1) == 10: + msgBox = QMessageBox() + msgBox.setWindowTitle("Plot transect Error") + msgBox.setIcon(QMessageBox.Warning) + msgBox.setText("Fill table before plot transect 2D field") + msgBox.setStandardButtons(QMessageBox.Ok) + msgBox.exec() - # print("tmax value ", self.spinbox_tmax.value()) - # print("tmax index ", np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]) - self.fig_BS, self.axis_BS = plt.subplots(nrows=acoustic_data._freq.shape[0], ncols=1, sharex=True, sharey=False, layout="constrained") + # --- Condition if table is filled and figure is not plotted --- + # --- => Then plot transect for each frequency by pressing the button "Plot transect" + + elif (self.tableModel.rowCount(1) > 10) and (self.canvas_BS == None): + self.fig_BS, self.axis_BS = plt.subplots(nrows=stg.freq.shape[0], ncols=1, sharex=True, sharey=False, layout="constrained") self.canvas_BS = FigureCanvas(self.fig_BS) # self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.addWidget(self.canvas_BS) @@ -794,57 +812,76 @@ class AcousticDataTab(QWidget): self.scroll_BS.setAlignment(Qt.AlignCenter) self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.addWidget(self.scroll_BS) - self.spinbox_tmin.setValue(np.min(acoustic_data._time)) - self.spinbox_tmax.setValue(np.round(np.max(acoustic_data._time), 2)) + self.spinbox_tmin.setValue(np.min(stg.time)) + self.spinbox_tmax.setValue(np.round(np.max(stg.time), 2)) - for f in range(acoustic_data._freq.shape[0]): - # self.ax = self.fig.add_subplot((4, 1, f+1), sharex=True, sharey=False) - # val_min = np.min(self.model.V[:, f, :2300]) - val_min = np.min(acoustic_data._BS_raw_data[:, f, :]) - # val_max = np.max(self.model.V[:, f, :2300]) - val_max = np.max(acoustic_data._BS_raw_data[:, f, :]) + for f in range(stg.freq.shape[0]): + + val_min = np.nanmin(stg.BS_raw_data[:, f, :]) + val_max = np.nanmax(stg.BS_raw_data[:, f, :]) if val_min == 0: val_min = 1e-5 - # if val_min == 0: - # val_min = 1e-5 - # self.ax[f].imshow(np.asarray(np.array(self.model.BS_raw_cross_section.V[:, f, :], dtype=float)), aspect='auto', - # extent=[0, 1912, self.model.depth[-1][0], self.model.depth[0][0]], - # cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) - # self.ax[f].plot(self.model.r_bottom_cross_section, color='red', linewidth=2) + pcm = self.axis_BS[f].pcolormesh( - acoustic_data._time[np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmin.value())[0][0]: - np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]], - acoustic_data._r , - np.flipud(acoustic_data._BS_raw_data[:, f, - np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmin.value())[0][0]: - np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]]), - cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))#, shading='gouraud') - # self.axis_BS[f].plot(self._model.dist_BS_section, - # np.max(self._model.r_bottom_cross_section) - self._model.r_bottom_cross_section + np.min(self._model.r_bottom_cross_section), - # color='red', linewidth=2) - # x, y = np.meshgrid(self.model.dist_BS_section, self.model.BS_raw_cross_section.r) - # z = np.cos(x) + np.sin(y) - # self.ax[f].contour(x, y, z, levels = 0, colors='k') - # self.ax[f].plot([25, 200], [5, 5], '-k') - self.axis_BS[f].text(1, .70, acoustic_data._freq_text[f], - fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5, - horizontalalignment='right', verticalalignment='bottom', transform=self.axis_BS[f].transAxes) + stg.time[np.where(np.round(stg.time, 2) == self.spinbox_tmin.value())[0][0]: + np.where(np.round(stg.time, 2) == self.spinbox_tmax.value())[0][0]], + -stg.r, + stg.BS_raw_data[:, f, + np.where(np.round(stg.time, 2) == self.spinbox_tmin.value())[0][0]: + np.where(np.round(stg.time, 2) == self.spinbox_tmax.value())[0][0]], + cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + + self.axis_BS[f].text(1, .70, stg.freq_text[f], + fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5, + horizontalalignment='right', verticalalignment='bottom', + transform=self.axis_BS[f].transAxes) self.fig_BS.supxlabel('Distance from left bank (m)', fontsize=10) self.fig_BS.supylabel('Depth (m)', fontsize=10) - # plt.subplots_adjust(bottom=0.125, top=0.98, right=1.03, left=0.08, hspace=0.1) - # self.fig.tight_layout() cbar = self.fig_BS.colorbar(pcm, ax=self.axis_BS[:], shrink=1, location='right') cbar.set_label(label='Backscatter acoustic signal (V)', rotation=270, labelpad=10) self.fig_BS.canvas.draw_idle() - else: + + def update_xaxis_transect_with_BS_raw_data(self): + + # --- Condition if table is filled but transect is not plotted + # --- => Error message if spin box values of tmin or tmax is change + if self.canvas_BS == None: msgBox = QMessageBox() msgBox.setWindowTitle("Plot transect Error") msgBox.setIcon(QMessageBox.Warning) - msgBox.setText("Fill table before plot transect 2D field") + msgBox.setText("Plot transect before change x-axis value") msgBox.setStandardButtons(QMessageBox.Ok) msgBox.exec() + else: + + for f in range(stg.freq.shape[0]): + self.axis_BS[f].cla() + + val_min = np.min(stg.BS_raw_data[:, f, :]) + val_max = np.max(stg.BS_raw_data[:, f, :]) + if val_min == 0: + val_min = 1e-5 + + pcm = self.axis_BS[f].pcolormesh( + stg.time[np.where(np.round(stg.time, 2) == self.spinbox_tmin.value())[0][0]: + np.where(np.round(stg.time, 2) == self.spinbox_tmax.value())[0][0]], + -stg.r, + (stg.BS_raw_data[:, f, + np.where(np.round(stg.time, 2) == self.spinbox_tmin.value())[0][0]: + np.where(np.round(stg.time, 2) == self.spinbox_tmax.value())[0][0]]), + cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) + + self.axis_BS[f].text(1, .70, stg.freq_text[f], + fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5, + horizontalalignment='right', verticalalignment='bottom', + transform=self.axis_BS[f].transAxes) + + self.fig_BS.supxlabel('Distance from left bank (m)', fontsize=10) + self.fig_BS.supylabel('Depth (m)', fontsize=10) + self.fig_BS.canvas.draw_idle() + def plot_transect_with_SNR_data(self): if self.tableModel.rowCount(1) == 10: msgBox = QMessageBox() @@ -895,10 +932,10 @@ class AcousticDataTab(QWidget): bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2] norm = BoundaryNorm(boundaries=bounds, ncolors=300) - cf = self.axis_SNR[f].contourf(x, y, - np.flipud(noise_data._snr[:, f, + cf = self.axis_SNR[f].contourf(x, -y, + noise_data._snr[:, f, np.where(np.round(noise_data._time_snr, 2) == self.spinbox_tmin.value())[0][0]: - np.where(np.round(noise_data._time_snr, 2) == self.spinbox_tmax.value())[0][0]]), + np.where(np.round(noise_data._time_snr, 2) == self.spinbox_tmax.value())[0][0]], levels, cmap='gist_rainbow', norm=norm)#, shading='gouraud') self.axis_SNR[f].text(1, .70, noise_data._freq_text[f], @@ -914,93 +951,51 @@ class AcousticDataTab(QWidget): cbar.set_ticklabels(['0', '1', '2', '10', '100', r'10$^3$', r'10$^6$']) self.fig_SNR.canvas.draw_idle() - def update_xaxis_transect_with_BS_raw_data(self): - if self.canvas_BS == None: - msgBox = QMessageBox() - msgBox.setWindowTitle("Plot transect Error") - msgBox.setIcon(QMessageBox.Warning) - msgBox.setText("Plot transect before change x-axis value") - msgBox.setStandardButtons(QMessageBox.Ok) - msgBox.exec() - else: - # print(self.axis_BS.cla()) - # self.fig_BS.clf() - - acoustic_data = self.load_BS_acoustic_raw_data() - # self.fig_BS, self.axis_BS = plt.subplots(nrows=acoustic_data._freq.shape[0], ncols=1, sharex=True, - # sharey=False, layout="constrained") - # self.canvas_BS = FigureCanvas(self.fig_BS) - # self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.addWidget(self.canvas_BS) - - for f in range(acoustic_data._freq.shape[0]): - self.axis_BS[f].cla() - val_min = np.min(acoustic_data._BS_raw_data[:, f, :]) - val_max = np.max(acoustic_data._BS_raw_data[:, f, :]) - if val_min == 0: - val_min = 1e-5 - pcm = self.axis_BS[f].pcolormesh( - acoustic_data._time[np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmin.value())[0][0]: - np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]], - acoustic_data._r , - np.flipud(acoustic_data._BS_raw_data[:, f, - np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmin.value())[0][0]: - np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]]), - cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))#, shading='gouraud') - - self.axis_BS[f].text(1, .70, acoustic_data._freq_text[f], - fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5, - horizontalalignment='right', verticalalignment='bottom', transform=self.axis_BS[f].transAxes) - - self.fig_BS.supxlabel('Distance from left bank (m)', fontsize=10) - self.fig_BS.supylabel('Depth (m)', fontsize=10) - # cbar = self.fig_BS.colorbar(pcm, ax=self.axis_BS[:], shrink=1, location='right') - # cbar.set_label(label='Backscatter acoustic signal (V)', rotation=270, labelpad=10) - self.fig_BS.canvas.draw_idle() - def update_xaxis_transect_with_SNR_data(self): - noise_data = self.compute_SNR() - if ((self.canvas_BS != None) and (self.canvas_SNR != None)): + if self.lineEdit_noise_file.text(): + noise_data = self.compute_SNR() + if ((self.canvas_BS != None) and (self.canvas_SNR != None)): - x, y = np.meshgrid( - noise_data._time_snr[np.where(np.round(noise_data._time_snr, 2) == self.spinbox_tmin.value())[0][0]: - np.where(np.round(noise_data._time_snr, 2) == self.spinbox_tmax.value())[0][0]], - noise_data._r) + x, y = np.meshgrid( + noise_data._time_snr[np.where(np.round(noise_data._time_snr, 2) == self.spinbox_tmin.value())[0][0]: + np.where(np.round(noise_data._time_snr, 2) == self.spinbox_tmax.value())[0][0]], + noise_data._r) - for f in range(noise_data._freq.shape[0]): - self.axis_SNR[f].cla() + for f in range(noise_data._freq.shape[0]): + self.axis_SNR[f].cla() - val_min = np.min(noise_data._snr[:, f, :]) - val_max = np.max(noise_data._snr[:, f, :]) - if val_min == 0: - val_min = 1e-5 - if val_max > 1000: - levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6]) - else: - levels = np.array([00.1, 1, 2, 10, 100, val_max]) - bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2] - norm = BoundaryNorm(boundaries=bounds, ncolors=300) + val_min = np.min(noise_data._snr[:, f, :]) + val_max = np.max(noise_data._snr[:, f, :]) + if val_min == 0: + val_min = 1e-5 + if val_max > 1000: + levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6]) + else: + levels = np.array([00.1, 1, 2, 10, 100, val_max]) + bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2] + norm = BoundaryNorm(boundaries=bounds, ncolors=300) - cf = self.axis_SNR[f].contourf(x, y, - np.flipud(noise_data._snr[:, f, - np.where(np.round(noise_data._time_snr, - 2) == self.spinbox_tmin.value())[0][0]: - np.where(np.round(noise_data._time_snr, - 2) == self.spinbox_tmax.value())[0][0]]), - levels, cmap='gist_rainbow', norm=norm) # , shading='gouraud') + cf = self.axis_SNR[f].contourf(x, -y, + noise_data._snr[:, f, + np.where(np.round(noise_data._time_snr, + 2) == self.spinbox_tmin.value())[0][0]: + np.where(np.round(noise_data._time_snr, + 2) == self.spinbox_tmax.value())[0][0]], + levels, cmap='gist_rainbow', norm=norm) # , shading='gouraud') - self.axis_SNR[f].text(1, .70, noise_data._freq_text[f], - fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5, - horizontalalignment='right', verticalalignment='bottom', - transform=self.axis_SNR[f].transAxes) + self.axis_SNR[f].text(1, .70, noise_data._freq_text[f], + fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5, + horizontalalignment='right', verticalalignment='bottom', + transform=self.axis_SNR[f].transAxes) - self.fig_SNR.supxlabel('Distance from left bank (m)', fontsize=10) - self.fig_SNR.supylabel('Depth (m)', fontsize=10) - # plt.subplots_adjust(bottom=0.125, top=0.98, right=1.03, left=0.08, hspace=0.1) - # self.fig.tight_layout() - # cbar = self.fig_SNR.colorbar(cf, ax=self.axis_SNR[:], shrink=1, location='right') - # cbar.set_label(label='Signal to Noise Ratio', rotation=270, labelpad=10) - # cbar.set_ticklabels(['0', '1', '2', '10', '100', r'10$^3$', r'10$^6$']) - self.fig_SNR.canvas.draw_idle() + self.fig_SNR.supxlabel('Distance from left bank (m)', fontsize=10) + self.fig_SNR.supylabel('Depth (m)', fontsize=10) + # plt.subplots_adjust(bottom=0.125, top=0.98, right=1.03, left=0.08, hspace=0.1) + # self.fig.tight_layout() + # cbar = self.fig_SNR.colorbar(cf, ax=self.axis_SNR[:], shrink=1, location='right') + # cbar.set_label(label='Signal to Noise Ratio', rotation=270, labelpad=10) + # cbar.set_ticklabels(['0', '1', '2', '10', '100', r'10$^3$', r'10$^6$']) + self.fig_SNR.canvas.draw_idle() def detect_bottom(self): if self.lineEdit_acoustic_file.text() == "": @@ -1024,6 +1019,14 @@ class AcousticDataTab(QWidget): msgBox.setText("Plot transect before compute bathymety algorithm") msgBox.setStandardButtons(QMessageBox.Ok) msgBox.exec() + # elif self.canvas_SNR == None: + # msgBox = QMessageBox() + # msgBox.setWindowTitle("Detect bottom Error") + # msgBox.setIcon(QMessageBox.Warning) + # msgBox.setText("Plot transect before compute bathymety algorithm") + # msgBox.setStandardButtons(QMessageBox.Ok) + # msgBox.exec() + # elif (self.canvas_BS) and (self.canvas_SNR == None): else: acoustic_data = self.load_BS_acoustic_raw_data() # Selecting the range in which we look for the bottom reflection @@ -1035,16 +1038,18 @@ class AcousticDataTab(QWidget): val_bottom = np.zeros(acoustic_data._nb_profiles) r_bottom_ind = [] # ----------- Detecting the bottom ------------- + progessBar = QProgressBar() for d in range(acoustic_data._nb_profiles): + progessBar.setValue(d) # Index of the range where we look for the peak ind_min = np.where(acoustic_data._r >= rmin)[0][0] ind_max = np.where(acoustic_data._r <= rmax)[0][-1] # Getting the peak val_bottom[d] = np.nanmax(acoustic_data._BS_raw_data[ind_min:ind_max, - self.combobox_freq_choice.currentIndex() - 1, d]) + self.combobox_freq_choice.currentIndex(), d]) # Getting the range cell of the peak ind_bottom = np.where(acoustic_data._BS_raw_data[ind_min:ind_max, - self.combobox_freq_choice.currentIndex() - 1, d] == val_bottom[d])[0][0] + self.combobox_freq_choice.currentIndex(), d] == val_bottom[d])[0][0] r_bottom[d] = acoustic_data._r[ind_bottom + ind_min] r_bottom_ind.append(ind_bottom + ind_min) # Updating the range where we will look for the peak (in the next cell) @@ -1059,7 +1064,7 @@ class AcousticDataTab(QWidget): BS_section_bottom[r_bottom_ind[i]][i] = 1 # print(BS_section_bottom[r_bottom_temp_ind[i]][i]) - # --- Plot transect with bathymetry --- + # --- Plot transect BS with bathymetry --- for f in range(acoustic_data._freq.shape[0]): self.axis_BS[f].cla() @@ -1071,8 +1076,8 @@ class AcousticDataTab(QWidget): pcm = self.axis_BS[f].pcolormesh( acoustic_data._time[np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmin.value())[0][0]: np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]], - acoustic_data._r , - np.flipud(acoustic_data._BS_raw_data[:, f, + -acoustic_data._r , + (acoustic_data._BS_raw_data[:, f, np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmin.value())[0][0]: np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]]), cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))#, shading='gouraud') @@ -1080,18 +1085,143 @@ class AcousticDataTab(QWidget): self.axis_BS[f].plot( acoustic_data._time[np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmin.value())[0][0]: np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]], - np.max(r_bottom[np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmin.value())[0][0]: - np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]]) + # np.max(r_bottom[np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmin.value())[0][0]: + # np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]]), - r_bottom[np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmin.value())[0][0]: - np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]] - + np.min(r_bottom[np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmin.value())[0][0]: - np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]]), + np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]], + # + np.min(r_bottom[np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmin.value())[0][0]: + # np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]]), # np.max(self._model.r_bottom_cross_section) - self._model.r_bottom_cross_section + np.min(self._model.r_bottom_cross_section), color='black', linewidth=1, linestyle="solid") - # self.axis_BS[f].text(1, .70, acoustic_data._freq_text[f], - # fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5, - # horizontalalignment='right', verticalalignment='bottom', transform=self.axis_BS[f].transAxes) + self.axis_BS[f].text(1, .70, acoustic_data._freq_text[f], + fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5, + horizontalalignment='right', verticalalignment='bottom', + transform=self.axis_BS[f].transAxes) + + # else: + # + # acoustic_data = self.load_BS_acoustic_raw_data() + # # Selecting the range in which we look for the bottom reflection + # rmin = np.int(self.spinbox_depth_min.text()) # 4 + # rmax = np.int(self.spinbox_depth_max.text()) # 8 + # + # # empty result arrays + # r_bottom = np.zeros(acoustic_data._nb_profiles) + # val_bottom = np.zeros(acoustic_data._nb_profiles) + # r_bottom_ind = [] + # # ----------- Detecting the bottom ------------- + # for d in range(acoustic_data._nb_profiles): + # # Index of the range where we look for the peak + # ind_min = np.where(acoustic_data._r >= rmin)[0][0] + # ind_max = np.where(acoustic_data._r <= rmax)[0][-1] + # # Getting the peak + # val_bottom[d] = np.nanmax(acoustic_data._BS_raw_data[ind_min:ind_max, + # self.combobox_freq_choice.currentIndex() - 1, d]) + # # Getting the range cell of the peak + # ind_bottom = np.where(acoustic_data._BS_raw_data[ind_min:ind_max, + # self.combobox_freq_choice.currentIndex() - 1, d] == val_bottom[d])[0][0] + # r_bottom[d] = acoustic_data._r[ind_bottom + ind_min] + # r_bottom_ind.append(ind_bottom + ind_min) + # # Updating the range where we will look for the peak (in the next cell) + # rmin = r_bottom[d] - locale.atof(self.doublespinbox_next_cell.text()) # 0.75 + # rmax = r_bottom[d] + locale.atof(self.doublespinbox_next_cell.text()) # 0.75 + # + # BS_section_bottom = np.zeros((acoustic_data._BS_raw_data.shape[0], acoustic_data._BS_raw_data.shape[2])) + # + # for i in range(BS_section_bottom.shape[0]): + # # print(r_bottom_temp_ind[i]) + # # print(i) + # BS_section_bottom[r_bottom_ind[i]][i] = 1 + # # print(BS_section_bottom[r_bottom_temp_ind[i]][i]) + # + # # --- Plot transect BS with bathymetry --- + # for f in range(acoustic_data._freq.shape[0]): + # self.axis_BS[f].cla() + # + # val_min = np.min(acoustic_data._BS_raw_data[:, f, :]) + # val_max = np.max(acoustic_data._BS_raw_data[:, f, :]) + # if val_min == 0: + # val_min = 1e-5 + # + # pcm = self.axis_BS[f].pcolormesh( + # acoustic_data._time[np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmin.value())[0][0]: + # np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]], + # -acoustic_data._r, + # (acoustic_data._BS_raw_data[:, f, + # np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmin.value())[0][0]: + # np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]]), + # cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max)) # , shading='gouraud') + # + # self.axis_BS[f].plot( + # acoustic_data._time[np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmin.value())[0][0]: + # np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]], + # # np.max(r_bottom[np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmin.value())[0][0]: + # # np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]]), + # - r_bottom[np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmin.value())[0][0]: + # np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]], + # # + np.min(r_bottom[np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmin.value())[0][0]: + # # np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]]), + # # np.max(self._model.r_bottom_cross_section) - self._model.r_bottom_cross_section + np.min(self._model.r_bottom_cross_section), + # color='black', linewidth=1, linestyle="solid") + # + # self.axis_BS[f].text(1, .70, acoustic_data._freq_text[f], + # fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5, + # horizontalalignment='right', verticalalignment='bottom', + # transform=self.axis_BS[f].transAxes) + # + # + # # --- Plot transect SNR with bathymetry --- + # + # noise_data = self.compute_SNR() + # + # x, y = np.meshgrid( + # noise_data._time_snr[np.where(np.round(noise_data._time_snr, 2) == self.spinbox_tmin.value())[0][0]: + # np.where(np.round(noise_data._time_snr, 2) == self.spinbox_tmax.value())[0][0]], + # noise_data._r) + # + # for f in range(noise_data._freq.shape[0]): + # self.axis_SNR[f].cla() + # + # val_min = np.min(noise_data._snr[:, f, :]) + # val_max = np.max(noise_data._snr[:, f, :]) + # if val_min == 0: + # val_min = 1e-5 + # if val_max > 1000: + # levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6]) + # else: + # levels = np.array([00.1, 1, 2, 10, 100, val_max]) + # bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2] + # norm = BoundaryNorm(boundaries=bounds, ncolors=300) + # + # cf = self.axis_SNR[f].contourf(x, -y, + # noise_data._snr[:, f, + # np.where(np.round(noise_data._time_snr, + # 2) == self.spinbox_tmin.value())[0][0]: + # np.where(np.round(noise_data._time_snr, + # 2) == self.spinbox_tmax.value())[0][0]], + # levels, cmap='gist_rainbow', norm=norm) # , shading='gouraud') + # + # self.axis_SNR[f].text(1, .70, noise_data._freq_text[f], + # fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5, + # horizontalalignment='right', verticalalignment='bottom', + # transform=self.axis_SNR[f].transAxes) + # + # self.axis_SNR[f].plot( + # noise_data._time_snr[np.where(np.round(noise_data._time_snr, 2) == self.spinbox_tmin.value())[0][0]: + # np.where(np.round(noise_data._time_snr, 2) == self.spinbox_tmax.value())[0][0]], + # # np.max(r_bottom[np.where(np.round(noise_data._time, 2) == self.spinbox_tmin.value())[0][0]: + # # np.where(np.round(noise_data._time, 2) == self.spinbox_tmax.value())[0][0]]) + # - r_bottom[np.where(np.round(noise_data._time_snr, 2) == self.spinbox_tmin.value())[0][0]: + # np.where(np.round(noise_data._time_snr, 2) == self.spinbox_tmax.value())[0][0]], + # # + np.min(r_bottom[np.where(np.round(noise_data._time, 2) == self.spinbox_tmin.value())[0][0]: + # # np.where(np.round(noise_data._time, 2) == self.spinbox_tmax.value())[0][0]]), + # # np.max(self._model.r_bottom_cross_section) - self._model.r_bottom_cross_section + np.min(self._model.r_bottom_cross_section), + # color='black', linewidth=1, linestyle="solid") + # + # self.axis_SNR[f].text(1, .70, acoustic_data._freq_text[f], + # fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5, + # horizontalalignment='right', verticalalignment='bottom', transform=self.axis_BS[f].transAxes) # self.fig_BS.supxlabel('Distance from left bank (m)', fontsize=10) # self.fig_BS.supylabel('Depth (m)', fontsize=10) @@ -1100,4 +1230,5 @@ class AcousticDataTab(QWidget): # cbar = self.fig_BS.colorbar(pcm, ax=self.axis_BS[:], shrink=1, location='right') # cbar.set_label(label='Backscatter acoustic signal (V)', rotation=270, labelpad=10) self.fig_BS.canvas.draw_idle() + # self.fig_SNR.canvas.draw_idle() return r_bottom, val_bottom, r_bottom_ind, BS_section_bottom diff --git a/settings.py b/settings.py new file mode 100644 index 0000000..35f027e --- /dev/null +++ b/settings.py @@ -0,0 +1,45 @@ +""" this file includs global variables shared between tab """ + +import numpy as np +import pandas as pd +import datetime + +path_BS_raw_data = "" +filename_BS_raw_data = "" +BS_raw_data = np.array([]) +r = np.array([]) +freq = np.array([]) +freq_text = list() +time = np.array([]) + +path_BS_noise_data = "" +filename_BS_noise_data = "" +BS_noise_data = np.array([]) +snr = np.array([]) + +date = [] +date_noise = [] +hour = [] +hour_noise = [] +nb_profiles = 0 +nb_profiles_per_sec = 0.0 +nb_cells = 0 +cell_size = 0.0 +pulse_length = 0.0 +nb_pings_per_sec = 0 +nb_pings_averaged_per_profile = 0.0 +kt = np.array([]) +gain_rx = np.array([]) +gain_tx = np.array([]) + +snr = np.array([]) +snr_reshape = np.array([]) +time_snr = np.array([]) + +time_reshape = np.array([]) +r_reshape = np.array([]) +BS_raw_data_reshape = np.array([]) +snr_reshape = np.array([]) +DataFrame_acoustic = pd.DataFrame() + +