Compare commits

..

No commits in common. "a8bb150bf85ff9275d24c2937e0b2fff44f877fa" and "26bd4767729d2e1083a405cbe9573a7dc715fd6e" have entirely different histories.

2 changed files with 27 additions and 49 deletions

View File

@ -1177,18 +1177,10 @@ class AcousticDataTab(QWidget):
str("%4s" % stg.distance_from_ABS_to_free_surface[self.fileListWidget.currentRow()])) str("%4s" % stg.distance_from_ABS_to_free_surface[self.fileListWidget.currentRow()]))
def refresh_distance_from_ABS_to_free_surface(self): def refresh_distance_from_ABS_to_free_surface(self):
self.pushbutton_distance_from_ABS_to_free_surface.blockSignals(True) acoustic_data = AcousticDataLoader(
stg.path_BS_raw_data[self.fileListWidget.currentRow()] + "/" +
if self.combobox_ABS_system_choice.currentIndex() == 1: stg.filename_BS_raw_data[self.fileListWidget.currentRow()]
acoustic_data = AcousticDataLoader( )
stg.path_BS_raw_data[self.fileListWidget.currentRow()] + "/" +
stg.filename_BS_raw_data[self.fileListWidget.currentRow()]
)
elif self.combobox_ABS_system_choice.currentIndex() == 2:
acoustic_data = AcousticDataLoaderUBSediFlow(
stg.path_BS_raw_data[self.fileListWidget.currentRow()] + "/" +
stg.filename_BS_raw_data[self.fileListWidget.currentRow()]
)
stg.depth[self.fileListWidget.currentRow()] = acoustic_data._r stg.depth[self.fileListWidget.currentRow()] = acoustic_data._r
stg.depth_reshape[self.fileListWidget.currentRow()] = acoustic_data.reshape_r() stg.depth_reshape[self.fileListWidget.currentRow()] = acoustic_data.reshape_r()
@ -1214,8 +1206,6 @@ class AcousticDataTab(QWidget):
self.update_plot_backscattered_acoustic_signal_recording() self.update_plot_backscattered_acoustic_signal_recording()
self.update_plot_profile() self.update_plot_profile()
self.pushbutton_distance_from_ABS_to_free_surface.blockSignals(False)
def temperature_value(self): def temperature_value(self):
if findall(r",", self.lineEdit_temperature.text()): if findall(r",", self.lineEdit_temperature.text()):

View File

@ -14,7 +14,7 @@
# # # #
# You should have received a copy of the GNU General Public License # # You should have received a copy of the GNU General Public License #
# along with this program. If not, see <https://www.gnu.org/licenses/>. # # along with this program. If not, see <https://www.gnu.org/licenses/>. #
import math
# by Brahim MOUDJED # # by Brahim MOUDJED #
# ============================================================================== # # ============================================================================== #
@ -47,8 +47,6 @@ from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as Navigatio
from matplotlib.colors import LogNorm, BoundaryNorm from matplotlib.colors import LogNorm, BoundaryNorm
from os import path from os import path
from numba.np.arraymath import np_average
from View.show_popup_combobox import ComboBoxShowPopUpWindow from View.show_popup_combobox import ComboBoxShowPopUpWindow
from View.plot_noise_window import PlotNoiseWindow from View.plot_noise_window import PlotNoiseWindow
@ -1443,7 +1441,8 @@ class SignalProcessingTab(QWidget):
val_max = np.nanmax( val_max = np.nanmax(
BS_data[data_id][f, :, :] BS_data[data_id][f, :, :]
) )
if val_min == 0 or math.isinf(val_min):
if val_min == 0:
val_min = 1e-5 val_min = 1e-5
pcm = self.axis_BS[f].pcolormesh( pcm = self.axis_BS[f].pcolormesh(
@ -1479,10 +1478,10 @@ class SignalProcessingTab(QWidget):
self.fig_BS.supxlabel('Time (sec)', fontsize=10) self.fig_BS.supxlabel('Time (sec)', fontsize=10)
self.fig_BS.supylabel('Depth (m)', fontsize=10) self.fig_BS.supylabel('Depth (m)', fontsize=10)
# cbar = self.fig_BS.colorbar(pcm, ax=self.axis_BS[:], cbar = self.fig_BS.colorbar(pcm, ax=self.axis_BS[:],
# shrink=1, location='right') shrink=1, location='right')
# cbar.set_label(label='Acoustic backscatter signal (V)', cbar.set_label(label='Acoustic backscatter signal (V)',
# rotation=270, labelpad=10) rotation=270, labelpad=10)
self.fig_BS.canvas.draw_idle() self.fig_BS.canvas.draw_idle()
else: else:
self.verticalLayout_groupbox_plot_pre_processed_data_2D_field\ self.verticalLayout_groupbox_plot_pre_processed_data_2D_field\
@ -1528,8 +1527,15 @@ class SignalProcessingTab(QWidget):
msgBox.exec() msgBox.exec()
else: else:
data_id = self.combobox_acoustic_data_choice.currentIndex() data_id = self.combobox_acoustic_data_choice.currentIndex()
n_average = 2 * int(float(self.lineEdit_horizontal_average.text().replace(",", "."))) + 1 kernel_avg = np.ones(
kernel_avg = np.ones(n_average) 2 * int(
float(
self.lineEdit_horizontal_average\
.text()\
.replace(",", ".")
)
) + 1
)
logger.debug(f"kernel_avg: {kernel_avg}") logger.debug(f"kernel_avg: {kernel_avg}")
stg.Nb_cells_to_average_BS_signal[data_id] = ( stg.Nb_cells_to_average_BS_signal[data_id] = (
@ -1593,34 +1599,16 @@ class SignalProcessingTab(QWidget):
logger.debug(f"BS_data: {BS_data[data_id].shape}") logger.debug(f"BS_data: {BS_data[data_id].shape}")
# BS_data_ppa[data_id] = deepcopy(BS_data[data_id]) BS_data_ppa[data_id] = deepcopy(BS_data[data_id])
#
# for f, _ in enumerate(stg.freq[data_id]):
# for i in range(y_depth.shape[1]):
# BS_data_ppa[data_id][f, i, :] = (
# convolve(
# BS_data[data_id][f, i, :],
# kernel_avg
# )
# )
temp_list = []
for f, _ in enumerate(stg.freq[data_id]): for f, _ in enumerate(stg.freq[data_id]):
temp0 = np.array([])
for i in range(y_depth.shape[1]): for i in range(y_depth.shape[1]):
# temp = convolve(BS_data[data_id][f, i, :], kernel_avg, "same") / n_average BS_data_ppa[data_id][f, i, :] = (
temp = convolve(array=BS_data[data_id][f, i, :], convolve(
kernel=kernel_avg, BS_data[data_id][f, i, :],
nan_treatment='interpolate') kernel_avg
if temp0.shape == (0,): )
temp0 = np.array([temp]) )
else:
temp0 = np.append(temp0, np.array([temp]), axis=0)
temp_list.append(temp0)
BS_data_ppa[data_id] = np.array([temp_list[0]])
for j in range(stg.freq[data_id].shape[0]-1):
BS_data_ppa[data_id] = np.append(BS_data_ppa[data_id], np.array([temp_list[j+1]]), axis=0)
logger.debug( logger.debug(
f"BS_data_ppa: {BS_data_ppa[data_id].shape}" f"BS_data_ppa: {BS_data_ppa[data_id].shape}"