mirror of
https://forgemia.inra.fr/theophile.terraz/acoused.git
synced 2026-10-30 03:10:40 +01:00
Implementation of UBSediFlow data in Acoused. They are organized with dictionaries and updated to numpy array for Acoused
This commit is contained in:
1 parent
4537a7d414
commit
92a0b5fa54
40 files changed
+2836
-157
No files matched your search
+224
-115
@@ -28,6 +28,7 @@ import Translation.constant_string as cs
|
||||
from Model.TableModel import TableModel
|
||||
from Model.AquascatDataLoader import RawAquascatData
|
||||
from Model.acoustic_data_loader import AcousticDataLoader
|
||||
from Model.acoustic_data_loader_UBSediFlow import AcousticDataLoaderUBSediFlow
|
||||
# from View.window_noise_level_averaged_profile import WindowNoiseLevelTailAveragedProfile
|
||||
|
||||
from View.sample_data_tab import SampleDataTab
|
||||
@@ -204,8 +205,8 @@ class AcousticDataTab(QWidget):
|
||||
self.label_rx = QLabel()
|
||||
self.label_tx = QLabel()
|
||||
|
||||
self.label_to_do = QLabel()
|
||||
self.label_to_do.setText("UBSediFlow data : to do for Oct. 20th")
|
||||
# self.label_to_do = QLabel()
|
||||
# self.label_to_do.setText("UBSediFlow data : to do for Oct. 20th")
|
||||
|
||||
# self.groupbox_measurement_information_Aquascat()
|
||||
self.combobox_ABS_system_choice.currentTextChanged.connect(self.ABS_system_choice)
|
||||
@@ -611,16 +612,21 @@ class AcousticDataTab(QWidget):
|
||||
self.lineEdit_acoustic_file.clear()
|
||||
self.label_date_groupbox_acoustic_file.clear()
|
||||
self.label_date_groupbox_acoustic_file.setText(_translate("CONSTANT_STRING", cs.DATE) + ": ")
|
||||
self.label_hour_groupbox_acoustic_file.clear()
|
||||
self.label_hour_groupbox_acoustic_file.setText(_translate("CONSTANT_STRING", cs.HOUR) + ": ")
|
||||
elif self.combobox_ABS_system_choice.currentText() == "UB-SediFlow":
|
||||
self.groupbox_measurement_information_UBSediFlow()
|
||||
self.lineEdit_acoustic_file.clear()
|
||||
self.label_date_groupbox_acoustic_file.clear()
|
||||
self.label_date_groupbox_acoustic_file.setText(_translate("CONSTANT_STRING", cs.DATE) + ": ")
|
||||
self.label_hour_groupbox_acoustic_file.clear()
|
||||
self.label_hour_groupbox_acoustic_file.setText(_translate("CONSTANT_STRING", cs.HOUR) + ": ")
|
||||
|
||||
def groupbox_measurement_information_Aquascat(self):
|
||||
# self.gridLayout_goupbox_info.itemAt(0).widget().deleteLater()
|
||||
self.label_to_do.hide()
|
||||
# self.label_to_do.hide()
|
||||
|
||||
self.label_freq.hide()
|
||||
|
||||
self.label_profiles.show()
|
||||
self.label_profiles_per_sec.show()
|
||||
@@ -661,9 +667,15 @@ class AcousticDataTab(QWidget):
|
||||
self.label_rx.hide()
|
||||
self.label_tx.hide()
|
||||
|
||||
self.label_to_do.show()
|
||||
# self.label_to_do.show()
|
||||
#
|
||||
# self.gridLayout_goupbox_info.addWidget(self.label_to_do, 0, 0, 1, 1)
|
||||
|
||||
self.label_freq.show()
|
||||
|
||||
self.gridLayout_goupbox_info.addWidget(self.label_freq, 0, 0, 1, 1)
|
||||
|
||||
|
||||
self.gridLayout_goupbox_info.addWidget(self.label_to_do, 0, 0, 1, 1)
|
||||
|
||||
def clicked_pushbutton_noise_level(self):
|
||||
self.WindowNoiseLevelTailAveragedProfile().show()
|
||||
@@ -683,11 +695,13 @@ class AcousticDataTab(QWidget):
|
||||
"Aquascat file (*.aqa)")
|
||||
dir_name = path.dirname(filename[0])
|
||||
name = path.basename(filename[0])
|
||||
|
||||
elif self.combobox_ABS_system_choice.currentIndex() == 2:
|
||||
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:
|
||||
@@ -734,91 +748,148 @@ class AcousticDataTab(QWidget):
|
||||
_translate("CONSTANT_STRING", cs.HOUR) + ": " + str(stg.hour_noise))
|
||||
|
||||
def load_BS_acoustic_raw_data(self):
|
||||
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_2D = acoustic_data.compute_r_2D()
|
||||
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
|
||||
if self.combobox_ABS_system_choice.currentIndex() == 1:
|
||||
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_2D = acoustic_data.compute_r_2D()
|
||||
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
|
||||
elif self.combobox_ABS_system_choice.currentIndex() == 2:
|
||||
acoustic_data = AcousticDataLoaderUBSediFlow(stg.path_BS_raw_data + "/" + stg.filename_BS_raw_data)
|
||||
stg.date = acoustic_data._date
|
||||
stg.hour = acoustic_data._hour
|
||||
stg.freq = acoustic_data._freq
|
||||
stg.time = acoustic_data._time
|
||||
stg.r = acoustic_data._r
|
||||
stg.freq_text = acoustic_data._freq_text
|
||||
stg.BS_raw_data = acoustic_data._BS_raw_data
|
||||
stg.BS_raw_data_reshape = acoustic_data.reshape_BS_raw_cross_section()
|
||||
stg.r_reshape = acoustic_data.reshape_r()
|
||||
stg.time_reshape = acoustic_data.reshape_t()
|
||||
|
||||
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]):
|
||||
noise[:, f, :] = np.mean(noise_data._BS_raw_data[:, f, :], axis=(0, 1))
|
||||
stg.BS_noise_data = noise
|
||||
stg.snr = np.divide((stg.BS_raw_data - stg.BS_noise_data) ** 2, stg.BS_noise_data ** 2)
|
||||
stg.snr_reshape = np.reshape(stg.snr, (stg.r.shape[0] * stg.time.shape[0], stg.freq.shape[0]), order="F")
|
||||
if self.combobox_ABS_system_choice.currentIndex() == 1:
|
||||
|
||||
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]):
|
||||
noise[:, f, :] = np.mean(noise_data._BS_raw_data[:, f, :], axis=(0, 1))
|
||||
stg.BS_noise_data = noise
|
||||
stg.snr = np.divide((stg.BS_raw_data - stg.BS_noise_data) ** 2, stg.BS_noise_data ** 2)
|
||||
stg.snr_reshape = np.reshape(stg.snr, (stg.r.shape[0] * stg.time.shape[0], stg.freq.shape[0]), order="F")
|
||||
|
||||
elif self.combobox_ABS_system_choice.currentIndex() == 2:
|
||||
|
||||
noise_data = AcousticDataLoaderUBSediFlow(stg.path_BS_noise_data + "/" + stg.filename_BS_noise_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]):
|
||||
noise[:, f, :] = np.mean(noise_data._BS_raw_data[:, f, :], axis=(0, 1))
|
||||
stg.BS_noise_data = noise
|
||||
stg.snr = np.divide((stg.BS_raw_data - stg.BS_noise_data) ** 2, stg.BS_noise_data ** 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()
|
||||
if self.combobox_ABS_system_choice.currentIndex() == 1:
|
||||
|
||||
self.label_profiles.setText(
|
||||
_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(stg.nb_profiles_per_sec) + " Hz")
|
||||
self.label_freq.setText(
|
||||
_translate("CONSTANT_STRING", cs.FREQUENCY) + ": " + ', '.join(stg.freq_text))
|
||||
self.label_cells.setText(
|
||||
_translate("CONSTANT_STRING", cs.NB_CELLS) + ": " + str(stg.nb_cells))
|
||||
self.label_cell_size.setText(
|
||||
_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(stg.pulse_length,6)) + "sec")
|
||||
self.label_pings_per_sec.setText(
|
||||
_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(stg.nb_pings_averaged_per_profile))
|
||||
self.label_kt.setText(
|
||||
_translate("CONSTANT_STRING", cs.KT) + ": " + ', '.join(map(str, stg.kt)))
|
||||
self.label_rx.setText(
|
||||
_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, stg.gain_tx)))
|
||||
|
||||
elif self.combobox_ABS_system_choice.currentIndex() == 2:
|
||||
|
||||
self.label_freq.setText(
|
||||
_translate("CONSTANT_STRING", cs.FREQUENCY) + ": " + ', '.join(stg.freq_text))
|
||||
|
||||
self.label_profiles.setText(
|
||||
_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(stg.nb_profiles_per_sec) + " Hz")
|
||||
self.label_freq.setText(
|
||||
_translate("CONSTANT_STRING", cs.FREQUENCY) + ": " + ', '.join(stg.freq_text))
|
||||
self.label_cells.setText(
|
||||
_translate("CONSTANT_STRING", cs.NB_CELLS) + ": " + str(stg.nb_cells))
|
||||
self.label_cell_size.setText(
|
||||
_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(stg.pulse_length,6)) + "sec")
|
||||
self.label_pings_per_sec.setText(
|
||||
_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(stg.nb_pings_averaged_per_profile))
|
||||
self.label_kt.setText(
|
||||
_translate("CONSTANT_STRING", cs.KT) + ": " + ', '.join(map(str, stg.kt)))
|
||||
self.label_rx.setText(
|
||||
_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, stg.gain_tx)))
|
||||
|
||||
def fill_table(self):
|
||||
if ((self.lineEdit_acoustic_file.text()) and (self.lineEdit_noise_file.text())):
|
||||
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():
|
||||
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()
|
||||
msgBox.setWindowTitle("Fill table Error")
|
||||
msgBox.setIcon(QMessageBox.Warning)
|
||||
msgBox.setText("Download files before fill table")
|
||||
msgBox.setStandardButtons(QMessageBox.Ok)
|
||||
msgBox.exec()
|
||||
if self.combobox_ABS_system_choice.currentIndex() == 1:
|
||||
if ((self.lineEdit_acoustic_file.text()) and (self.lineEdit_noise_file.text())):
|
||||
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():
|
||||
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()
|
||||
msgBox.setWindowTitle("Fill table Error")
|
||||
msgBox.setIcon(QMessageBox.Warning)
|
||||
msgBox.setText("Download files before fill table")
|
||||
msgBox.setStandardButtons(QMessageBox.Ok)
|
||||
msgBox.exec()
|
||||
|
||||
elif self.combobox_ABS_system_choice.currentIndex() == 2:
|
||||
if ((self.lineEdit_acoustic_file.text()) and (self.lineEdit_noise_file.text())):
|
||||
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():
|
||||
stg.DataFrame_acoustic = pd.DataFrame(
|
||||
np.concatenate((stg.time_reshape, stg.BS_raw_data_reshape), axis=1),
|
||||
columns=list(map(str, ["Time - " + f for f in stg.freq_text] + ["BS - " + f for f in stg.freq_text])))
|
||||
self.tableModel = TableModel(stg.DataFrame_acoustic)
|
||||
self.tableView.setModel(self.tableModel)
|
||||
else:
|
||||
msgBox = QMessageBox()
|
||||
msgBox.setWindowTitle("Fill table Error")
|
||||
msgBox.setIcon(QMessageBox.Warning)
|
||||
msgBox.setText("Download files before fill table")
|
||||
msgBox.setStandardButtons(QMessageBox.Ok)
|
||||
msgBox.exec()
|
||||
|
||||
def export_table(self):
|
||||
if self.tableWidget.columnCount() == 10:
|
||||
@@ -876,23 +947,38 @@ 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(stg.time))
|
||||
self.spinbox_tmax.setValue(np.round(np.max(stg.time), 2))
|
||||
self.spinbox_tmin.setValue(np.round(np.min(stg.time[0, :]), 2))
|
||||
self.spinbox_tmax.setValue(np.round(np.max(stg.time[0, :]), 2))
|
||||
|
||||
for f in range(stg.freq.shape[0]):
|
||||
stg.tmin = np.array([])
|
||||
stg.tmax = np.array([])
|
||||
|
||||
val_min = np.nanmin(stg.BS_raw_data[:, f, :])
|
||||
val_max = np.nanmax(stg.BS_raw_data[:, f, :])
|
||||
for f, _ in enumerate(stg.freq):
|
||||
|
||||
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
|
||||
|
||||
stg.tmin = (
|
||||
np.append(stg.tmin,
|
||||
np.where(np.abs(np.round(stg.time[f, :], 2) - self.spinbox_tmin.value()) ==
|
||||
np.nanmin(np.abs(np.round(stg.time[f, :], 2) - self.spinbox_tmin.value())))[0][0])
|
||||
)
|
||||
|
||||
stg.tmax = (
|
||||
np.append(stg.tmax,
|
||||
np.where(np.abs(np.round(stg.time[f, :], 2) - self.spinbox_tmax.value()) ==
|
||||
np.nanmin(np.abs(np.round(stg.time[f, :], 2) - self.spinbox_tmax.value())))[0][0])
|
||||
)
|
||||
|
||||
print(f"freq = {f}")
|
||||
print(f"tmin {stg.tmin}")
|
||||
print(f"tmax {stg.tmax}")
|
||||
|
||||
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]],
|
||||
stg.time[f, int(stg.tmin[f]):int(stg.tmax[f])], stg.r[f, :],
|
||||
stg.BS_raw_data[f, :, int(stg.tmin[f]):int(stg.tmax[f])],
|
||||
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
|
||||
|
||||
self.axis_BS[f].text(1, .70, stg.freq_text[f],
|
||||
@@ -919,33 +1005,56 @@ class AcousticDataTab(QWidget):
|
||||
msgBox.exec()
|
||||
|
||||
else:
|
||||
# --- Backscatter acoustic signal is recorded for next tab ---
|
||||
stg.BS_data = stg.BS_raw_data[:, :, 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]]
|
||||
print("stg.time shape ", stg.time.shape)
|
||||
stg.t = 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]]
|
||||
print("stg.t shape ", stg.t.shape)
|
||||
stg.r_2D = stg.r_2D[:, 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]]
|
||||
print("stg.r shape ", stg.r_2D.shape)
|
||||
|
||||
for f in range(stg.freq.shape[0]):
|
||||
# --- Backscatter acoustic signal is recorded for next tab ---
|
||||
|
||||
stg.BS_data = np.array([[[]]])
|
||||
stg.t = np.array([[]])
|
||||
for f, _ in enumerate(stg.freq):
|
||||
|
||||
stg.tmin[f] = np.where(np.abs(np.round(stg.time[f, :], 2) - self.spinbox_tmin.value()) ==
|
||||
np.nanmin(np.abs(np.round(stg.time[f, :], 2) - self.spinbox_tmin.value())))[0][0]
|
||||
|
||||
stg.tmax[f] = np.where(np.abs(np.round(stg.time[f, :], 2) - self.spinbox_tmax.value()) ==
|
||||
np.nanmin(np.abs(np.round(stg.time[f, :], 2) - self.spinbox_tmax.value())))[0][0]
|
||||
|
||||
print("stg.tmin[f] ", stg.tmin[f])
|
||||
print("stg.tmax[f] ", stg.tmax[f])
|
||||
print("shape of BS_raw_data ", np.array([stg.BS_raw_data[f, :, int(stg.tmin[f]):int(stg.tmax[f])]]).shape)
|
||||
print("BS_data shape ", stg.BS_data.shape)
|
||||
if stg.BS_data.shape[2] == 0:
|
||||
stg.BS_data = np.array([stg.BS_raw_data[f, :, int(stg.tmin[f]):int(stg.tmax[f])]])
|
||||
else:
|
||||
stg.BS_data = np.append(stg.BS_data, np.array([stg.BS_raw_data[f, :, int(stg.tmin[f]):int(stg.tmax[f])]]), axis=0)
|
||||
|
||||
|
||||
# stg.BS_data = np.stack(np.array([stg.BS_raw_data[f, :, int(stg.tmin[f]):int(stg.tmax[f])]]), axis=0)
|
||||
# stg.BS_data = np.append(stg.BS_data, np.array([stg.BS_raw_data[f, :, int(stg.tmin[f]):int(stg.tmax[f])]]), axis=2)
|
||||
print("stg.BS_data.shape ", stg.BS_data.shape)
|
||||
print("stg.BS_data.size ", stg.BS_data.size)
|
||||
print("stg.time shape ", stg.time.shape)
|
||||
print("stg.t shape ", stg.t.shape)
|
||||
if stg.t.shape[1] == 0:
|
||||
stg.t = np.array([stg.time[f, int(stg.tmin[f]):int(stg.tmax[f])]])
|
||||
else:
|
||||
stg.t = np.append(stg.t, np.array([stg.time[f, int(stg.tmin[f]):int(stg.tmax[f])]]), axis=0)
|
||||
# stg.t = np.append(stg.t, np.array([stg.time[f, int(stg.tmin[f]):int(stg.tmax[f])]]), axis=0)
|
||||
print("stg.t shape ", stg.t.shape)
|
||||
# stg.r_2D = stg.r_2D[:, 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]]
|
||||
# print("stg.r shape ", stg.r_2D.shape)
|
||||
|
||||
self.axis_BS[f].cla()
|
||||
|
||||
val_min = np.min(stg.BS_raw_data[:, f, :])
|
||||
val_max = np.max(stg.BS_raw_data[:, f, :])
|
||||
val_min = np.min(stg.BS_data[f, :, :])
|
||||
val_max = np.max(stg.BS_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))
|
||||
# print("stg.t[f, :].shape ", stg.t[f])
|
||||
# print("stg.r[f, :].shape ", stg.r[f, :])
|
||||
pcm = self.axis_BS[f].pcolormesh(stg.t[f, :], stg.r[f, :], stg.BS_data[f, :, :],
|
||||
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,
|
||||
|
||||
Reference in new issue
Block a user