Compare commits
14 Commits
32f0d143f2
...
9ecb70b955
| Author | SHA1 | Date |
|---|---|---|
|
|
9ecb70b955 | |
|
|
0879520fd2 | |
|
|
030213608d | |
|
|
329639e064 | |
|
|
5d16adc521 | |
|
|
9fcbe0e306 | |
|
|
77f28462e6 | |
|
|
2e9f9c3a3c | |
|
|
80d570796a | |
|
|
40d14a2ffb | |
|
|
d3234bff5d | |
|
|
f2db89eef8 | |
|
|
153b136812 | |
|
|
6b22562e57 |
|
|
@ -721,14 +721,14 @@ class RawAquascatData:
|
|||
elif pktType == 41:
|
||||
chan = st.unpack("H", f.read(2))[0] + 1
|
||||
# Increase the Index
|
||||
|
||||
|
||||
|
||||
AbsIndex[chan-1] = AbsIndex[chan-1] + 1
|
||||
Tmp = [st.unpack(
|
||||
"h", f.read(2))[0] for ui in np.arange(
|
||||
1, 2 * AbsNumBins[chan-1]+1)]
|
||||
sss = [x / 32768 for x in Tmp]
|
||||
|
||||
|
||||
AbsData[:, int(
|
||||
AbsIndex[chan-1]), int(chan-1)] = np.abs(np.array(sss[0::2])+complex(0,1)*np.array(sss[1::2]))
|
||||
|
||||
|
|
@ -1097,19 +1097,3 @@ class MeanAquascatProfile:
|
|||
|
||||
file.close()
|
||||
|
||||
# ------------------------- Test --------------------------------------#
|
||||
start_time = time.time()
|
||||
|
||||
if __name__ == "__main__":
|
||||
# path1 = r'C:\Users\vergne\Documents\Donnees_aquascat\2017_juillet - experience cuve sediments fins\2017_07_19 - mercredi eau claire\20170719114700.aqa'
|
||||
path1 = r'//home/brahim.moudjed/Documents/3 Software_Project/river_inversion_project/Data/Aquascat data test/20171213135800.aqa'
|
||||
data1 = RawAquascatData(path1)
|
||||
|
||||
# path2 = r'C:\Users\vergne\Documents\Donnees_aquascat\2017_juillet - experience cuve sediments fins\2017_07_19 - mercredi eau claire\20170719114700.aqa.txt'
|
||||
path2 = r'//home/brahim.moudjed/Documents/3 Software_Project/river_inversion_project/Data/Aquascat data test/20171213135800.txt'
|
||||
data2 = RawAquascatData(path2)
|
||||
|
||||
print(data1.PingRate)
|
||||
print(data2.PingRate)
|
||||
|
||||
print("Computational time: %.2f min" %((time.time() - start_time)/60) )
|
||||
|
|
|
|||
|
|
@ -1,49 +1,35 @@
|
|||
# ============================================================================== #
|
||||
# acoustic_data_loder_UBSediFlow.py - AcouSed #
|
||||
# Copyright (C) 2024 INRAE #
|
||||
# #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
# the Free Software Foundation, either version 3 of the License, or #
|
||||
# (at your option) any later version. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, #
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||
# GNU General Public License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License #
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
||||
|
||||
# by Brahim MOUDJED #
|
||||
# ============================================================================== #
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
import datetime
|
||||
import matplotlib.pyplot as plt
|
||||
from matplotlib.colors import LogNorm, BoundaryNorm
|
||||
from copy import deepcopy
|
||||
|
||||
from scipy.signal import savgol_filter
|
||||
|
||||
from Model.udt_extract.raw_extract import raw_extract
|
||||
# raw_20210519_102332.udt raw_20210520_135452.udt raw_20210525_092759.udt raw_20210525_080454.udt
|
||||
|
||||
# path_BS_raw_data0 = ("/home/bmoudjed/Documents/3 SSC acoustic meas project/Graphical interface project/Data/APAVER_2021/Raw_data_udt/")
|
||||
# filename0 = "raw_20210519_135400.udt"
|
||||
|
||||
# path_BS_raw_data0 = ("/home/bmoudjed/Documents/3 SSC acoustic meas project/Graphical interface project/Data/"
|
||||
# "APAVER_2021/transect_ubsediflow/01-raw_20210519_115128/Raw_data_udt/")
|
||||
# filename0 = "raw_20210519_115128.udt"
|
||||
|
||||
# path_BS_raw_data0 = ("/home/bmoudjed/Documents/3 SSC acoustic meas project/Graphical interface project/Data/"
|
||||
# "APAVER_2021/transect_ubsediflow/02-bb0077eda128f3f7887052eb3e8b0884/Raw_data_udt/")
|
||||
# filename0 = "raw_20210519_161400.udt"
|
||||
|
||||
# path_BS_raw_data0 = ("/home/bmoudjed/Documents/3 SSC acoustic meas project/Graphical interface project/Data/"
|
||||
# "APAVER_2021/transect_ubsediflow/04-fb53d0e92c9c88e2a6cf45e0320fbc76/Raw_data_udt/")
|
||||
# filename0 = "raw_20210520_133200.udt"
|
||||
|
||||
# ("/home/bmoudjed/Documents/3 SSC acoustic meas project/Graphical interface project/Data/APAVER_2021/"
|
||||
# "Rhone_20210519/Rhone_20210519/record/")
|
||||
|
||||
# path_BS_raw_data0 = ("/home/bmoudjed/Documents/3 SSC acoustic meas project/Graphical interface project/Data/Raw_data_udt/")
|
||||
# filename0 = "raw_20210519_130643.udt"
|
||||
|
||||
# path_BS_raw_data0 = ("/home/bmoudjed/Documents/2 Data/APAVER_2021/Raw_data_udt/")
|
||||
# filename0 = "raw_20210520_085958.udt"
|
||||
|
||||
# filename = "raw_20210519_115128.udt"
|
||||
# "raw_20210526_153310.udt"
|
||||
|
||||
|
||||
class AcousticDataLoaderUBSediFlow:
|
||||
|
||||
def __init__(self, path_BS_raw_data: str):
|
||||
|
||||
# path_BS_raw_data = path_BS_raw_data0 + filename0
|
||||
self.path_BS_raw_data = path_BS_raw_data
|
||||
|
||||
# --- Extract Backscatter acoustic raw data with class ---
|
||||
|
|
@ -53,23 +39,10 @@ class AcousticDataLoaderUBSediFlow:
|
|||
device_name, time_begin, time_end, param_us_dicts, data_us_dicts, data_dicts, settings_dict \
|
||||
= raw_extract(self.path_BS_raw_data)
|
||||
|
||||
print(f"device_name : {device_name}")
|
||||
print(f"date begin : {time_begin.date()}")
|
||||
print(f"time begin : {time_begin.time()}")
|
||||
print(f"settings_dict : {settings_dict}")
|
||||
|
||||
# # --- Date and Hour of measurements read on udt data file ---
|
||||
# filename = self.path_BS_raw_data[-23:]
|
||||
# date_and_time = datetime.datetime(year=int(filename[4:8]),
|
||||
# month=int(filename[8:10]),
|
||||
# day=int(filename[10:12]),
|
||||
# hour=int(filename[13:15]),
|
||||
# minute=int(filename[15:17]),
|
||||
# second=int(filename[17:19]))
|
||||
|
||||
self._date = time_begin.date()
|
||||
print(f"date : {self._date}")
|
||||
self._hour = time_begin.time()
|
||||
print(f"time : {self._hour}")
|
||||
|
||||
self._freq = np.array([[]])
|
||||
|
||||
|
|
@ -88,19 +61,11 @@ class AcousticDataLoaderUBSediFlow:
|
|||
self._time = np.array([[]])
|
||||
self._time_snr = np.array([[]])
|
||||
self._BS_raw_data = np.array([[[]]])
|
||||
# self._SNR_data = np.array([[[]]])
|
||||
time_len = []
|
||||
time_snr_len = []
|
||||
|
||||
for config in param_us_dicts.keys():
|
||||
# print("-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x")
|
||||
# print(f"config : {config} \n")
|
||||
|
||||
for channel in param_us_dicts[config].keys():
|
||||
print("-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x")
|
||||
# print(f"channel : {channel} \n")
|
||||
# print("param_us_dicts[config][channel] ", param_us_dicts[config][channel])
|
||||
# print("param_us_dicts ", param_us_dicts)
|
||||
# print(data_us_dicts[config][channel]['echo_avg_profile'])
|
||||
|
||||
# --- Frequencies ---
|
||||
self._freq = np.append(self._freq, param_us_dicts[config][channel]['f0'])
|
||||
|
|
@ -115,31 +80,19 @@ class AcousticDataLoaderUBSediFlow:
|
|||
self._gain_tx = np.append(self._gain_tx, param_us_dicts[config][channel]['a1'])
|
||||
|
||||
# --- Depth for each frequencies ---
|
||||
print("r_dcell : ", param_us_dicts[config][channel]['r_dcell'])
|
||||
print("n_cell : ", param_us_dicts[config][channel]['n_cell'])
|
||||
depth = [param_us_dicts[config][channel]['r_dcell'] * i
|
||||
for i in list(range(param_us_dicts[config][channel]['n_cell']))]
|
||||
print(f"depth : {depth}")
|
||||
print(f"lenght of depth : {len(depth)}")
|
||||
|
||||
if self._r.shape[1] == 0:
|
||||
self._r = np.array([depth])
|
||||
else:
|
||||
if len(depth) == self._r.shape[1]:
|
||||
print("Je suis là")
|
||||
print(f"depth lenght : {len(depth)}")
|
||||
print(f"r shape : {self._r.shape}")
|
||||
self._r = np.append(self._r, np.array([depth]), axis=0)
|
||||
print("C'est encore moi")
|
||||
elif len(depth) < self._r.shape[1]:
|
||||
print(f"depth lenght : {len(depth)}")
|
||||
self._r = self._r[:, :len(depth)]
|
||||
self._r = np.append(self._r, np.array([depth]), axis=0)
|
||||
print(f"r shape : {self._r.shape}")
|
||||
elif len(depth) > self._r.shape[1]:
|
||||
print(f"depth lenght : {len(depth)}")
|
||||
self._r = np.append(self._r, np.array([depth[:self._r.shape[1]]]), axis=0)
|
||||
print(f"r shape : {self._r.shape}")
|
||||
print(f"self._r : {self._r.shape}")
|
||||
|
||||
# --- BS Time for each frequencies ---
|
||||
time = [[(t - data_us_dicts[config][channel]['echo_avg_profile']['time'][0]).total_seconds()
|
||||
|
|
@ -147,69 +100,28 @@ class AcousticDataLoaderUBSediFlow:
|
|||
time_len = np.append(time_len, len(time[0]))
|
||||
|
||||
if len(time_len) == 1:
|
||||
print(f"1 time length : {len(time[0])}")
|
||||
self._time = np.array(time)
|
||||
print(f"self._time.shape {self._time.shape}")
|
||||
elif self._time.shape[1] == len(time[0]):
|
||||
print(f"2 time length : {len(time[0])}")
|
||||
self._time = np.append(self._time, time, axis=0)
|
||||
print(f"self._time.shape {self._time.shape}")
|
||||
elif self._time.shape[1] > len(time[0]):
|
||||
print(f"3 time length : {len(time[0])}")
|
||||
# print(f"self._time.shape {self._time.shape}")
|
||||
# print([int(np.min(time_len)) + int(i) - 1 for i in range(1, int(np.max(time_len))-int(np.min(time_len))+1)])
|
||||
self._time = np.delete(self._time,
|
||||
[int(np.min(time_len)) + int(i) - 1 for i in range(1, int(np.max(time_len))-int(np.min(time_len))+1)],
|
||||
axis=1)
|
||||
self._time = np.append(self._time, time, axis=0)
|
||||
print(f"self._time.shape {self._time.shape}")
|
||||
elif self._time.shape[1] < len(time[0]):
|
||||
print(f"4 time length : {len(time[0])}")
|
||||
time = time[:int(np.max(time_len)) - (int(np.max(time_len)) - int(np.min(time_len)))]
|
||||
self._time = np.append(self._time, time, axis=0)
|
||||
print(f"self._time.shape {self._time.shape}")
|
||||
|
||||
self._nb_profiles = np.append(self._nb_profiles, self._time.shape[1])
|
||||
self._nb_profiles_per_sec = np.append(self._nb_profiles_per_sec,
|
||||
param_us_dicts[config][channel]['n_avg'])
|
||||
|
||||
# --- SNR Time for each frequencies ---
|
||||
# time_snr = [[(t - data_us_dicts[config][channel]['snr_doppler_avg_profile']['time'][0]).total_seconds()
|
||||
# for t in data_us_dicts[config][channel]['snr_doppler_avg_profile']['time']]]
|
||||
# time_snr_len = np.append(time_snr_len, len(time_snr[0]))
|
||||
#
|
||||
# if len(time_snr_len) == 1:
|
||||
# # print(f"1 time length : {len(time[0])}")
|
||||
# self._time_snr = np.array(time_snr)
|
||||
# # print(f"self._time.shape {self._time.shape}")
|
||||
# elif self._time_snr.shape[1] == len(time_snr[0]):
|
||||
# # print(f"2 time length : {len(time[0])}")
|
||||
# self._time_snr = np.append(self._time_snr, time_snr, axis=0)
|
||||
# # print(f"self._time.shape {self._time.shape}")
|
||||
# elif self._time_snr.shape[1] > len(time_snr[0]):
|
||||
# # print(f"3 time length : {len(time[0])}")
|
||||
# # print(f"self._time.shape {self._time.shape}")
|
||||
# # print([int(np.min(time_len)) + int(i) - 1 for i in range(1, int(np.max(time_len))-int(np.min(time_len))+1)])
|
||||
# self._time_snr = np.delete(self._time_snr,
|
||||
# [int(np.min(time_snr_len)) + int(i) - 1 for i in
|
||||
# range(1, int(np.max(time_snr_len)) - int(np.min(time_snr_len)) + 1)],
|
||||
# axis=1)
|
||||
# self._time_snr = np.append(self._time_snr, time_snr, axis=0)
|
||||
# # print(f"self._time.shape {self._time.shape}")
|
||||
# elif self._time_snr.shape[1] < len(time_snr[0]):
|
||||
# # print(f"4 time length : {len(time[0])}")
|
||||
# time_snr = time_snr[:int(np.max(time_snr_len)) - (int(np.max(time_snr_len)) - int(np.min(time_snr_len)))]
|
||||
# self._time_snr = np.append(self._time_snr, time_snr, axis=0)
|
||||
# # print(f"self._time.shape {self._time.shape}")
|
||||
|
||||
# --- US Backscatter raw signal ---
|
||||
BS_data = np.array([[]])
|
||||
|
||||
if config == 1:
|
||||
|
||||
BS_data = np.array([data_us_dicts[config][channel]['echo_avg_profile']['data'][0]])
|
||||
print(f"cas 1 : BS_raw_data shape = {self._BS_raw_data.shape}")
|
||||
print(f"cas 1 : BS_data shape = {BS_data.shape}")
|
||||
|
||||
for i in range(self._time.shape[1]):
|
||||
BS_data = np.append(BS_data,
|
||||
|
|
@ -218,27 +130,21 @@ class AcousticDataLoaderUBSediFlow:
|
|||
axis=0)
|
||||
|
||||
self._BS_raw_data = np.array([BS_data[:self._time.shape[1], :].transpose()])
|
||||
# print(f"a) BS_data shape = {BS_data.shape}")
|
||||
# print(f"a) BS_raw_data shape = {BS_raw_data.shape}")
|
||||
|
||||
else:
|
||||
|
||||
BS_data = np.array([data_us_dicts[config][channel]['echo_avg_profile']['data'][0]])
|
||||
print(f"{config}) BS_data shape = {BS_data.shape}")
|
||||
|
||||
for j in range(self._time.shape[1]):
|
||||
BS_data = np.append(BS_data,
|
||||
np.array(
|
||||
[data_us_dicts[config][channel]['echo_avg_profile']['data'][j]]),
|
||||
axis=0)
|
||||
BS_data = np.array([BS_data.transpose()])
|
||||
print(f"xxxx BS_data shape = {BS_data.shape}")
|
||||
# print(f"b) BS_raw_data shape = {BS_raw_data.shape}")
|
||||
|
||||
# 1- time shape > BS data shape
|
||||
# <=> data recorded with the frequency are longer than data recorded with the other lower frequencies
|
||||
if (BS_data.shape[2] > self._BS_raw_data.shape[2]):
|
||||
print(f"cas 2 : BS_raw_data shape = {self._BS_raw_data.shape}")
|
||||
print(f"cas 2 : BS_data shape = {BS_data.shape}")
|
||||
|
||||
if (BS_data.shape[1] > self._BS_raw_data.shape[1]):
|
||||
# print(f"BS_data shape[0] = {BS_data.shape[0]}")
|
||||
|
|
@ -260,8 +166,6 @@ class AcousticDataLoaderUBSediFlow:
|
|||
# 2- time shape < BS data shape
|
||||
# <=> data recorded with the frequency are shorter than data recorded with the other lower frequencies
|
||||
elif BS_data.shape[2] < self._BS_raw_data.shape[2]:
|
||||
print(f"cas 3 : BS_raw_data shape = {self._BS_raw_data.shape}")
|
||||
print(f"cas 3 : BS_data shape = {BS_data.shape}")
|
||||
|
||||
if (BS_data.shape[1] > self._BS_raw_data.shape[1]):
|
||||
self._BS_raw_data = np.append(self._BS_raw_data[:, :, BS_data.shape[2]],
|
||||
|
|
@ -277,16 +181,11 @@ class AcousticDataLoaderUBSediFlow:
|
|||
self._BS_raw_data = np.append(self._BS_raw_data[:, :, BS_data.shape[0]],
|
||||
BS_data,
|
||||
axis=0)
|
||||
# print(f"d) BS_data shape = {BS_data.shape}")
|
||||
# print(f"d) BS_raw_data shape = {BS_raw_data.shape}")
|
||||
|
||||
# 3- time shape = BS data shape
|
||||
# <=> data recorded with the frequency have the same duration than data recorded with the other lower frequency
|
||||
else:
|
||||
|
||||
print(f"cas 4 : BS_raw_data shape = {self._BS_raw_data.shape}")
|
||||
print(f"cas 4 : BS_data shape = {BS_data.shape}")
|
||||
|
||||
if (BS_data.shape[1] > self._BS_raw_data.shape[1]):
|
||||
|
||||
self._BS_raw_data = np.append(self._BS_raw_data,
|
||||
|
|
@ -301,115 +200,6 @@ class AcousticDataLoaderUBSediFlow:
|
|||
|
||||
self._BS_raw_data = np.append(self._BS_raw_data,
|
||||
BS_data, axis=0)
|
||||
# print(f"e) BS_data shape = {BS_data.shape}")
|
||||
|
||||
print("Final BS_raw_data shape = ", self._BS_raw_data.shape)
|
||||
|
||||
print("********************************************")
|
||||
|
||||
# # --- US Backscatter raw signal + SNR data ---
|
||||
# BS_data = np.array([[]])
|
||||
#
|
||||
# if config == 1:
|
||||
# BS_data = np.array([data_us_dicts[config][channel]['echo_avg_profile']['data'][0]])
|
||||
# # print("BS_data shape ", BS_data.shape)
|
||||
# # print("******************************")
|
||||
# # date_list = [np.abs(datetime.datetime(2021, 5, 19, 14, 10, 00).timestamp()
|
||||
# # - date.timestamp()) for date in data_us_dicts[config][channel]['echo_avg_profile']['time']]
|
||||
# # print(date_list)
|
||||
# # print(np.where(date_list == np.min(date_list)))
|
||||
# # print((data_us_dicts[config][channel]['echo_avg_profile']['time'][np.where(date_list == np.min(date_list))[0][0]] -
|
||||
# # data_us_dicts[config][channel]['echo_avg_profile']['time'][0]).total_seconds())
|
||||
# # # == datetime.datetime(2021, 5, 19, 14, 10, 2, 644000))
|
||||
# # print("******************************")
|
||||
#
|
||||
# for i in range(self._time.shape[1]):
|
||||
# BS_data = np.append(BS_data,
|
||||
# np.array([data_us_dicts[config][channel]['echo_avg_profile']['data'][i]]),
|
||||
# axis=0)
|
||||
# print("0. BS_data shape ", BS_data.shape)
|
||||
#
|
||||
# self._BS_raw_data = np.array([BS_data[:self._time.shape[1], :].transpose()])
|
||||
#
|
||||
# print("0. BS_raw_data shape ", self._BS_raw_data.shape)
|
||||
#
|
||||
# # fig, ax = plt.subplots(nrows=1, ncols=1, layout="constrained")
|
||||
# # pcm = ax.pcolormesh(list(range(self._BS_raw_data.shape[2])), list(range(self._BS_raw_data.shape[1])),
|
||||
# # np.log(self._BS_raw_data[0, :, :]),
|
||||
# # cmap='Blues')
|
||||
# # fig.colorbar(pcm, ax=ax, shrink=1, location='right')
|
||||
# # plt.show()
|
||||
#
|
||||
# else:
|
||||
#
|
||||
# BS_data = np.array([data_us_dicts[config][channel]['echo_avg_profile']['data'][0]])
|
||||
# # print("BS_data shape ", BS_data.shape)
|
||||
# for i in range(self._time.shape[1]):
|
||||
# BS_data = np.append(BS_data,
|
||||
# np.array(
|
||||
# [data_us_dicts[config][channel]['echo_avg_profile']['data'][i]]),
|
||||
# axis=0)
|
||||
# print("1. BS_data shape ", BS_data.shape)
|
||||
#
|
||||
# #-----------------------------------------------------------------------------------------------------------------------
|
||||
# # Ici il faut écrire les conditions sur les tailles selon r et selon time
|
||||
# # donc sur BS_data.shape[0] (time) et BS_data.shape[1] (depth)
|
||||
# #-----------------------------------------------------------------------------------------------------------------------
|
||||
#
|
||||
# # 1- time shape > BS data shape
|
||||
# # <=> data recorded with the frequency are longer than data recorded with the other lower frequencies
|
||||
# if (BS_data.shape[0] > self._BS_raw_data.shape[2]):
|
||||
# self._BS_raw_data = np.append(self._BS_raw_data,
|
||||
# np.array([BS_data[:self._BS_raw_data.shape[2], :].transpose()]),
|
||||
# axis=0)
|
||||
#
|
||||
# # 2- time shape < BS data shape
|
||||
# # <=> data recorded with the frequency are shorter than data recorded with the other lower frequencies
|
||||
# elif BS_data.shape[0] < self._BS_raw_data.shape[2]:
|
||||
# self._BS_raw_data = np.append(self._BS_raw_data[config-1, :, BS_data.shape[0]],
|
||||
# np.array([BS_data.transpose()]),
|
||||
# axis=0)
|
||||
#
|
||||
# # 3- time shape = BS data shape
|
||||
# # <=> data recorded with the frequency have the same duration than data recorded with the other lower frequency
|
||||
# else:
|
||||
# self._BS_raw_data = np.append(self._BS_raw_data, np.array([BS_data.transpose()]), axis=0)
|
||||
#
|
||||
#
|
||||
# print("1. BS_raw_data shape ", self._BS_raw_data.shape)
|
||||
#
|
||||
# # if f == 0:
|
||||
# # print(np.array(data_us_dicts[config][channel]['echo_avg_profile']['data'][0]).shape)
|
||||
# # self._BS_raw_data[f, :, :] = np.array([data_us_dicts[config][channel]['echo_avg_profile']['data'][0]])
|
||||
# # # self._BS_raw_data = np.array([np.reshape(data_us_dicts[config][channel]['echo_avg_profile']['data'],
|
||||
# # # (self._time.shape[1], self._r.shape[1])).transpose()])
|
||||
# # print("self._BS_raw_data.shape ", self._BS_raw_data.shape)
|
||||
# # self._SNR_data = np.array(
|
||||
# # [np.reshape(np.abs(data_us_dicts[config][channel]['snr_doppler_avg_profile']['data']),
|
||||
# # (self._time.shape[1], self._r.shape[1])).transpose()])
|
||||
# # else:
|
||||
# # # self._BS_raw_data = np.append(self._BS_raw_data,
|
||||
# # # np.array(data_us_dicts[config][channel]['echo_avg_profile']['data']),
|
||||
# # # (self._r.shape[1], self._time.shape[1]))]),
|
||||
# # # axis=0)
|
||||
# # # self._BS_raw_data = np.append(self._BS_raw_data,
|
||||
# # # np.array([np.reshape(np.array(
|
||||
# # # data_us_dicts[config][channel]['echo_avg_profile']['data']),
|
||||
# # # (self._time.shape[1], self._r.shape[1])).transpose()]),
|
||||
# # # axis=0)
|
||||
# #
|
||||
# # self._SNR_data = np.append(self._SNR_data,
|
||||
# # np.array([np.reshape(np.array(
|
||||
# # np.abs(data_us_dicts[config][channel]['snr_doppler_avg_profile']['data'])),
|
||||
# # (self._time.shape[1], self._r.shape[1])).transpose()]),
|
||||
# # axis=0)
|
||||
# # # print(self._BS_raw_data.shape)
|
||||
#
|
||||
# # --- US Backscatter raw signal ---
|
||||
#
|
||||
#
|
||||
# # print(len(self._BS_raw_data))
|
||||
# # print(self._BS_raw_data)
|
||||
|
||||
if self._time.shape[1] > self._BS_raw_data.shape[2]:
|
||||
self._time = self._time[:, :self._BS_raw_data.shape[2]]
|
||||
|
|
@ -420,275 +210,39 @@ class AcousticDataLoaderUBSediFlow:
|
|||
self._BS_raw_data = self._BS_raw_data
|
||||
|
||||
self._time = self._time[:, :self._BS_raw_data.shape[2]]
|
||||
print("self._time.shape ", self._time.shape)
|
||||
# print(f"time : {self._time}")
|
||||
# print("****************************")
|
||||
# for i in range(len(self._time[0, :])-1):
|
||||
# print(self._time[0, i+1] - self._time[0, i])
|
||||
# print("****************************")
|
||||
|
||||
print("self._r.shape ", self._r.shape)
|
||||
|
||||
self._freq_text = np.array([str(f) + " MHz" for f in [np.round(f*1e-6, 2) for f in self._freq]])
|
||||
print("self._freq_text ", self._freq_text)
|
||||
print("self._freq_text ", self._freq)
|
||||
|
||||
# self._BS_raw_data = np.array(np.reshape(self._BS_raw_data, (len(self._freq), self._r.shape[1], self._time.shape[1])))
|
||||
print("self._BS_raw_data.shape ", self._BS_raw_data.shape)
|
||||
|
||||
# print("self._SNR_data.shape ", self._SNR_data.shape)
|
||||
# print(self._SNR_data)
|
||||
|
||||
# print("device_name ", device_name, "\n")
|
||||
|
||||
# print("time_begin ", time_begin, "\n")
|
||||
|
||||
# print("time_end ", time_end, "\n")
|
||||
|
||||
# print(f"param_dicts keys {param_us_dicts.keys()} \n")
|
||||
# print(param_us_dicts, "\n")
|
||||
|
||||
# for i in range(len(list(param_us_dicts.keys()))):
|
||||
# print(f"param_us_dicts {i} : {list(param_us_dicts.items())[i]} \n")
|
||||
|
||||
# # print("settings_dict ", settings_dict, "\n")
|
||||
# print(f"keys in data_us_dicts {data_us_dicts[1][1].keys()} \n")
|
||||
# # les clés du dictionnaire data_us_dicts :
|
||||
# # dict_keys(['echo_avg_profile', 'saturation_avg_profile', 'velocity_avg_profile', 'snr_doppler_avg_profile',
|
||||
# # 'velocity_std_profile', 'a1_param', 'a0_param', 'noise_g_high', 'noise_g_low'])
|
||||
|
||||
# print(f"data_us_dicts keys in echo avg profile {data_us_dicts[1][1]['echo_avg_profile'].keys()} \n")
|
||||
# print(f"number of profiles {len(data_us_dicts[1][1]['echo_avg_profile']['data'])} \n")
|
||||
# print(f"number of cells {data_us_dicts[1][1]['echo_avg_profile']['data'][0].shape} \n")
|
||||
|
||||
# self._data_BS = RawAquascatData(self.path_BS_raw_data)
|
||||
|
||||
# self._nb_profiles = self._data_BS.NumProfiles
|
||||
# self._nb_profiles_per_sec = self._data_BS.ProfileRate
|
||||
# self._nb_cells = self._data_BS.NumCells
|
||||
# self._cell_size = self._data_BS.cellSize
|
||||
# self._pulse_length = self._data_BS.TxPulseLength
|
||||
# self._nb_pings_per_sec = self._data_BS.PingRate
|
||||
# self._nb_pings_averaged_per_profile = self._data_BS.Average
|
||||
# self._kt = self._data_BS.Kt
|
||||
# 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([])
|
||||
|
||||
# print(type(self._gain_tx))
|
||||
|
||||
# print(["BS - " + f for f in self._freq_text])
|
||||
# print(self._time.shape[0]*self._r.shape[0]*4)
|
||||
|
||||
# print(self._time[np.where(np.floor(self._time) == 175)])
|
||||
# print(np.where((self._time) == 155)[0][0])
|
||||
|
||||
# --- Plot Backscatter US data ---
|
||||
|
||||
# fig, ax = plt.subplots(nrows=1, ncols=1, layout="constrained")
|
||||
# pcm = ax.pcolormesh(self._time[0, :], -self._r[0, :], np.log(self._BS_raw_data[0, :, :]),
|
||||
# cmap='plasma')#, shading='gouraud')
|
||||
# # pcm = ax.pcolormesh(list(range(self._BS_raw_data.shape[2])), list(range(self._BS_raw_data.shape[1])),
|
||||
# # np.log(self._BS_raw_data[0, :, :]),
|
||||
# # cmap='Blues') # , shading='gouraud')
|
||||
# # norm=LogNorm(vmin=np.min(self._BS_raw_data[f, :, :]), vmax=np.max(self._BS_raw_data[f, :, :])), 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')
|
||||
# fig.colorbar(pcm, ax=ax, shrink=1, location='right')
|
||||
# plt.show()
|
||||
|
||||
# fig, ax = plt.subplots(nrows=len(self._freq), ncols=1, layout="constrained")
|
||||
# for f, freq in enumerate(self._freq):
|
||||
# print(f"{f} : {freq} \n")
|
||||
# # pcm = ax[f].imshow(np.log(self._BS_raw_data[f, :, :self._time.shape[1]]),
|
||||
# # cmap='Blues')
|
||||
# # pcm = ax[f].pcolormesh(list(range(self._BS_raw_data.shape[2])), list(range(self._BS_raw_data.shape[1])),
|
||||
# # np.log(self._BS_raw_data[f, :, :]),
|
||||
# # cmap='Blues', shading='gouraud')
|
||||
# pcm = ax[f].pcolormesh(self._time[f, 50:247], -self._r[f, :], np.log(self._BS_raw_data[f, :, 50:247]),
|
||||
# cmap='Blues')#, shading='gouraud')
|
||||
# # norm=LogNorm(vmin=np.min(self._BS_raw_data[f, :, :]), vmax=np.max(self._BS_raw_data[f, :, :])), 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')
|
||||
# fig.colorbar(pcm, ax=ax[:], shrink=1, location='right')
|
||||
# # plt.show()
|
||||
#
|
||||
# # --- Smooth value with savgol_filter ---
|
||||
# BS_smooth = deepcopy(self._BS_raw_data[0, :, :])
|
||||
# for k in range(self._time[0, :].shape[0]):
|
||||
# BS_smooth[:, k] = savgol_filter(BS_smooth[:, k], 10, 2)
|
||||
#
|
||||
# fig1, ax1 = plt.subplots(nrows=1, ncols=1, layout="constrained")
|
||||
# pcm1 = ax1.pcolormesh(self._time[0, :], -self._r[0, :], np.log(BS_smooth[:, :]), cmap='Blues')
|
||||
# fig1.colorbar(pcm1, ax=ax1, shrink=1, location='right')
|
||||
|
||||
# print("find value in depth", np.where(np.abs(self._r - 3.3) == np.min(np.abs(self._r - 3.3))))
|
||||
#
|
||||
# fig, ax = plt.subplots(nrows=1, ncols=1, layout="constrained")
|
||||
# ax.plot(self._r[0, :], self._BS_raw_data[0, :, 766])
|
||||
# plt.show()
|
||||
|
||||
# # --- Plot vertical profile for bottom detection ---
|
||||
# n = 60
|
||||
# t0 = 200
|
||||
# t1 = np.where(np.abs(self._time[0, :] - t0) == np.nanmin(np.abs(self._time[0, :] - t0)))[0][0]
|
||||
# # print(np.abs(self._time[0, :] - 200))
|
||||
# # print(f"x0 = {x0}")
|
||||
# r1 = 98
|
||||
# r2 = 150
|
||||
# fig2, ax2 = plt.subplots(nrows=1, ncols=n, layout="constrained")
|
||||
# for i in range(n):
|
||||
# ax2[i].plot(self._BS_raw_data[0, r1:r2, t1+i], -self._r[0, r1:r2], 'b')
|
||||
# ax2[i].plot(BS_smooth[r1:r2, t1+i], -self._r[0, r1:r2], 'r')
|
||||
# ax2[i].set_xticks([])
|
||||
# if i != 0:
|
||||
# ax2[i].set_yticks([])
|
||||
# plt.show()
|
||||
|
||||
# --- Plot SNR data ---
|
||||
# fig_snr, ax_snr = plt.subplots(nrows=len(self._freq), ncols=1)
|
||||
#
|
||||
# x, y = np.meshgrid(self._time[0, :], self._r[0, :])
|
||||
#
|
||||
# for f, freq in enumerate(self._freq):
|
||||
#
|
||||
# val_min = np.nanmin(abs(self._SNR_data[f, :, :]))
|
||||
# print(f"val_min = {val_min}")
|
||||
# val_max = np.nanmax(self._SNR_data[f, :, :])
|
||||
# print(f"val_max = {val_max}")
|
||||
# if int(val_min) == 0:
|
||||
# val_min = 1e-5
|
||||
# if int(val_max) < 1000:
|
||||
# levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6])
|
||||
# bounds = [00.1, 1, 2, 10, 100, 1000, 1e6, 1e6 * 1.2]
|
||||
# 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)
|
||||
#
|
||||
# print(f"levels = {levels}")
|
||||
# print(f"norm = {norm.boundaries}")
|
||||
#
|
||||
# cf = ax_snr[f].contourf(x, y, self._SNR_data[f, :, :])#, levels, cmap='gist_rainbow', norm=norm)
|
||||
#
|
||||
# ax_snr[f].text(1, .70, self._freq_text[f],
|
||||
# fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5,
|
||||
# horizontalalignment='right', verticalalignment='bottom',
|
||||
# transform=ax_snr[f].transAxes)
|
||||
#
|
||||
# fig_snr.supxlabel('Time (sec)', fontsize=10)
|
||||
# fig_snr.supylabel('Depth (m)', fontsize=10)
|
||||
# cbar = fig_snr.colorbar(cf, ax=ax_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$'])
|
||||
# plt.show()
|
||||
|
||||
# fig, ax = plt.subplots(nrows=1, ncols=1)
|
||||
# ax.plot(list(range(self._time.shape[1])), self._time[0, :])
|
||||
# # ax.set_ylim(2, 20)
|
||||
# plt.show()
|
||||
|
||||
# print(self.reshape_BS_raw_cross_section())
|
||||
|
||||
# self.reshape_BS_raw_cross_section()
|
||||
# self.reshape_r()
|
||||
# self.reshape_t()
|
||||
# self.compute_r_2D()
|
||||
|
||||
# Lecture du fichier excel
|
||||
|
||||
# path = ("/home/bmoudjed/Documents/3 SSC acoustic meas project/Graphical interface project/Data/APAVER_2021/"
|
||||
# "transect_ubsediflow/01-raw_20210519_115128/Raw_data_csv/config_1/"
|
||||
# "echo_avg_profile_1_1_20210519_115128.csv")
|
||||
#
|
||||
# df = pd.read_csv(path, sep="\t")
|
||||
#
|
||||
# arr = []
|
||||
# for column in df.columns:
|
||||
# arr.append(df[column].to_numpy())
|
||||
# # arr = np.append(arr, np.array([df[column].to_numpy()]), axis=0)
|
||||
# arr = arr[1:]
|
||||
# print(len(arr))
|
||||
#
|
||||
# matrix = np.array([arr[0]])
|
||||
# print(matrix.shape)
|
||||
# for i in range(len(arr)-1):
|
||||
# matrix = np.append(matrix, np.array([arr[i]]), axis=0)
|
||||
# print(matrix.shape)
|
||||
|
||||
# fig, ax = plt.subplots(nrows=1, ncols=1, layout="constrained")
|
||||
# pcm = ax.pcolormesh(list(range(matrix.shape[1])), list(range(matrix.shape[0])), np.log(matrix),
|
||||
# cmap='Blues')#, shading='gouraud')
|
||||
# # norm=LogNorm(vmin=np.min(self._BS_raw_data[f, :, :]), vmax=np.max(self._BS_raw_data[f, :, :])), 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')
|
||||
# fig.colorbar(pcm, ax=ax, shrink=1, location='right')
|
||||
# plt.show()
|
||||
|
||||
def reshape_BS_raw_data(self):
|
||||
BS_raw_cross_section = np.reshape(self._BS_raw_data,
|
||||
(self._r.shape[1]*self._time.shape[1], len(self._freq)),
|
||||
order="F")
|
||||
# print(BS_raw_cross_section.shape)
|
||||
return BS_raw_cross_section
|
||||
|
||||
# def reshape_SNR_data(self):
|
||||
# SNR_data = np.reshape(self._SNR_data,
|
||||
# (self._r.shape[1]*self._time.shape[1], len(self._freq)),
|
||||
# order="F")
|
||||
# # print(BS_raw_cross_section.shape)
|
||||
# return SNR_data
|
||||
|
||||
def reshape_r(self):
|
||||
r = np.zeros((self._r.shape[1]*self._time.shape[1], len(self._freq)))
|
||||
for i, _ in enumerate(self._freq):
|
||||
r[:, i] = np.repeat(self._r[i, :], self._time.shape[1])
|
||||
# print(r.shape)
|
||||
return r
|
||||
|
||||
def compute_r_2D(self):
|
||||
r2D = np.zeros((self._freq.shape[0], self._r.shape[1], self._time.shape[1]))
|
||||
for f, _ in enumerate(self._freq):
|
||||
r2D[f, :, :] = np.repeat(np.transpose(self._r[0, :])[:, np.newaxis], self._time.shape[1], axis=1)
|
||||
print("r2D.shape ", r2D.shape)
|
||||
return r2D
|
||||
|
||||
# def compute_r_2D(self):
|
||||
# r2D = np.repeat(self._r, self._time.size, axis=1)
|
||||
# return r2D
|
||||
|
||||
def reshape_t(self):
|
||||
t = np.zeros((self._r.shape[1]*self._time.shape[1], len(self._freq)))
|
||||
for i, _ in enumerate(self._freq):
|
||||
t[:, i] = np.repeat(self._time[i, :], self._r.shape[1])
|
||||
# print(t.shape)
|
||||
return t
|
||||
|
||||
def reshape_t_snr(self):
|
||||
t = np.zeros((self._r.shape[1]*self._time_snr.shape[1], len(self._freq)))
|
||||
for i, _ in enumerate(self._freq):
|
||||
t[:, i] = np.repeat(self._time_snr[i, :], self._r.shape[1])
|
||||
# print(t.shape)
|
||||
return t
|
||||
|
||||
def detect_bottom(self):
|
||||
rmin = 2.5
|
||||
rmax = 3.5
|
||||
|
||||
|
||||
|
||||
# def concatenate_data(self):
|
||||
|
||||
# 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__":
|
||||
# AcousticDataLoaderUBSediFlow(path_BS_raw_data0 + filename0)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ from PyQt5.QtWidgets import (QWidget, QVBoxLayout, QDialog, QTabWidget, QGridLay
|
|||
QFileDialog, QMessageBox, QLabel)
|
||||
from PyQt5.QtCore import Qt
|
||||
|
||||
|
||||
class CalibrationConstantKt(QDialog):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
|
|
@ -113,11 +112,3 @@ class CalibrationConstantKt(QDialog):
|
|||
eval("self.gridLayout_tab_" + str(t_index) + ".addWidget(self.label_kt_" + str(x) + "_ABS_" + str(t_index) +
|
||||
", " + str(x+1) + ", 1, 1, 1, Qt.AlignCenter)")
|
||||
|
||||
|
||||
# if __name__ == "__main__":
|
||||
# app = QApplication(sys.argv)
|
||||
# cal = CalibrationConstantKt()
|
||||
# cal.show()
|
||||
# # sys.exit(app.exec_())
|
||||
# app.exec()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
from Model.GrainSizeTools import demodul_granulo, mix_gaussian_model
|
||||
|
||||
class GranuloLoader:
|
||||
|
||||
|
|
@ -16,8 +14,7 @@ class GranuloLoader:
|
|||
self._y = self._data.iloc[:, 1].tolist() # distance from left bank (m)
|
||||
self._z = self._data.iloc[:, 2].tolist() # depth (m)
|
||||
|
||||
self._r_grain = 1e-6 * np.array(self._data.columns.values)[5:].astype(float) / 2
|
||||
# self._r_grain = 1e-6 * np.array(self._data.columns.values)[5:].astype(float) / 2 # grain radius (m)
|
||||
self._r_grain = 1e-6 * np.array(self._data.columns.values)[5:].astype(float) / 2 # grain radius (m)
|
||||
|
||||
self._Ctot = self._data.iloc[:, 3].tolist() # Total concentration (g/L)
|
||||
self._D50 = self._data.iloc[:, 4].tolist() # median diameter (um)
|
||||
|
|
@ -25,147 +22,3 @@ class GranuloLoader:
|
|||
|
||||
self._frac_vol_cumul = np.cumsum(self._frac_vol, axis=1) # Cumulated volume fraction (%)
|
||||
|
||||
# print(type(self._frac_vol_cumul), self._frac_vol_cumul.shape, self._frac_vol_cumul)
|
||||
|
||||
# # --- Load sand sediments data file ---
|
||||
# self.path_sand = path_sand
|
||||
# self._data_sand = pd.read_excel(self.path_sand, engine="odf", header=0)
|
||||
#
|
||||
# self._Ctot_sand = np.array(self._data_sand.iloc[:, 2]) # Total concentration (g/L)
|
||||
# self._D50_sand = np.array(self._data_sand.iloc[:, 3]) # median diameter (um)
|
||||
# self._frac_vol_sand = np.array(self._data_sand.iloc[:, 4:]) # Volume fraction (%)
|
||||
#
|
||||
# self._frac_vol_sand_cumul = np.cumsum(self._frac_vol_sand, axis=1) # Cumulated volume fraction (%)
|
||||
#
|
||||
# # --- Compute % of fine and % of sand sediment in total concentration ---
|
||||
#
|
||||
# self._Ctot_fine_per_cent = 100 * self._Ctot_fine / (self._Ctot_fine + self._Ctot_sand)
|
||||
# self._Ctot_sand_per_cent = 100 * self._Ctot_sand / (self._Ctot_fine + self._Ctot_sand)
|
||||
|
||||
# ==============================================================================================================
|
||||
# ==============================================================================================================
|
||||
|
||||
# N_sample = 0
|
||||
# #
|
||||
# fig, ax = plt.subplots(1, 2)
|
||||
# ax[0].plot(self._r_grain, self._frac_vol[N_sample, :], color="k", marker='.')
|
||||
# ax[0].set_xscale('log')
|
||||
# ax[0].set_xlabel('Radius ($\mu m$)')
|
||||
# ax[0].set_ylabel('Class size volume fraction')
|
||||
#
|
||||
# ax[1].plot([self._r_grain[i+1]-self._r_grain[i] for i in range(self._r_grain.shape[0]-1)], list(range(self._r_grain.shape[0]-1)), color="k", marker="x")
|
||||
# ax[1].set_xlabel('Ecart inter-class')
|
||||
# ax[1].set_ylabel('n° échantillon')
|
||||
#
|
||||
# plt.show()
|
||||
#
|
||||
# print(f"self._r_grain.shape : {self._r_grain.shape}")
|
||||
# print(f"self._r_grain : {self._r_grain}")
|
||||
# print(f"self._frac_vol_cumul.shape : {self._frac_vol_cumul[N_sample, :].shape}")
|
||||
# print(f"self._frac_vol_cumul[N_sample, :] : {self._frac_vol_cumul[N_sample, :]}")
|
||||
# print(np.where(self._frac_vol_cumul[N_sample, :] > 0))
|
||||
# #
|
||||
# min_demodul = 1e-6
|
||||
# max_demodul = 500e-6
|
||||
# sample_demodul = demodul_granulo(self._r_grain[:],
|
||||
# self._frac_vol_cumul[N_sample, :],
|
||||
# min_demodul, max_demodul)
|
||||
#
|
||||
# print(f"sample_demodul : {sample_demodul.demodul_data_list}")
|
||||
|
||||
# N_modes = 3
|
||||
# sample_demodul.print_mode_data(N_modes)
|
||||
# sample_demodul.plot_interpolation()
|
||||
# sample_demodul.plot_modes(N_modes)
|
||||
#
|
||||
# print(f"mu_list : {sample_demodul.demodul_data_list[3 - 1].mu_list}")
|
||||
# print(f"sigma_list : {sample_demodul.demodul_data_list[3 - 1].sigma_list}")
|
||||
# print(f"w_list : {sample_demodul.demodul_data_list[3 - 1].w_list}")
|
||||
#
|
||||
# resampled_log_array = np.log(np.logspace(-10, -2, 3000))
|
||||
# proba_vol_demodul = mix_gaussian_model(resampled_log_array,
|
||||
# sample_demodul.demodul_data_list[2].mu_list,
|
||||
# sample_demodul.demodul_data_list[2].sigma_list,
|
||||
# sample_demodul.demodul_data_list[2].w_list)
|
||||
#
|
||||
#
|
||||
#
|
||||
# proba_vol_demodul = proba_vol_demodul / np.sum(proba_vol_demodul)
|
||||
# ss = np.sum(proba_vol_demodul / np.exp(resampled_log_array) ** 3)
|
||||
# proba_num = proba_vol_demodul / np.exp(resampled_log_array) ** 3 / ss
|
||||
#
|
||||
# print(f"proba_num : {proba_num}")
|
||||
# freq = 5e6
|
||||
#
|
||||
# a2f2pdf = 0
|
||||
# a3pdf = 0
|
||||
# for i in range(len(resampled_log_array)):
|
||||
# a = np.exp(resampled_log_array)[i]
|
||||
# a2f2pdf += a**2 * form_factor_function_MoateThorne2012(a, freq)**2 * proba_num[i]
|
||||
# a3pdf += a**3 * proba_num[i]
|
||||
#
|
||||
# print(f"a2f2pdf = {a2f2pdf}")
|
||||
# print(f"a3pdf = {a3pdf}")
|
||||
#
|
||||
# ks = (a2f2pdf / a3pdf)
|
||||
#
|
||||
# print(f"ks = {ks}")
|
||||
#
|
||||
#
|
||||
# def form_factor_function_MoateThorne2012(a_s, freq, C=1500):
|
||||
# """This function computes the form factor based on the equation of
|
||||
# Moate and Thorne (2012)"""
|
||||
# # computing the wave number
|
||||
# k = 2 * np.pi * freq / C
|
||||
# x = k * a_s
|
||||
# f = (x ** 2 * (1 - 0.25 * np.exp(-((x - 1.5) / 0.35) ** 2)) * (
|
||||
# 1 + 0.6 * np.exp(-((x - 2.9) / 1.15) ** 2))) / (
|
||||
# 42 + 28 * x ** 2)
|
||||
# return f
|
||||
|
||||
|
||||
# if __name__ == "__main__":
|
||||
# GranuloLoader("/home/bmoudjed/Documents/2 Data/Confluence_Rhône_Isere_2018/Granulo_data/fine_sample_file.ods")
|
||||
# GranuloLoader("/home/bmoudjed/Documents/3 SSC acoustic meas project/Graphical interface project/Data/Granulo_data/"
|
||||
# "sand_sample_file.ods")
|
||||
# GranuloLoader("/home/bmoudjed/Documents/3 SSC acoustic meas project/Graphical interface project/Data/"
|
||||
# "pt_acoused_cnr_7nov2023/echantil/fine_new_file_acoused_101RDS 3.ods")
|
||||
# GranuloLoader("/home/bmoudjed/Documents/3 SSC acoustic meas project/Graphical interface project/Data/"
|
||||
# "pt_acoused_cnr_7nov2023/echantil/sand_new_file_acoused_101RDS 3.ods")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# # form_factor = form_factor_function_MoateThorne2012(GranuloLoader.)
|
||||
#
|
||||
# def ks(a_s, rho_s, freq, pdf):
|
||||
# # --- Calcul de la fonction de form ---
|
||||
# form_factor = form_factor_function_MoateThorne2012(a_s, freq)
|
||||
# print(f"form_factor shape = {len(form_factor)}")
|
||||
# # print(f"form_factor = {form_factor}")
|
||||
#
|
||||
# # --- Gaussian mixture ---
|
||||
# # sample_demodul = demodul_granulo(a_s.astype(float), pdf, 0.17e-6, 200e-6)
|
||||
# # sample_demodul.plot_interpolation()
|
||||
#
|
||||
# # ss = np.sum(pdf / a_s ** 3)
|
||||
# # proba_num = (pdf / a_s ** 3) / ss
|
||||
#
|
||||
# # --- Compute k_s by dividing two integrals ---
|
||||
# a2f2pdf = 0
|
||||
# a3pdf = 0
|
||||
# for i in range(len(pdf)):
|
||||
# a2f2pdf += a_s[i] ** 2 * form_factor[i] * proba_num[i]
|
||||
# a3pdf += a_s[i] ** 3 * proba_num[i]
|
||||
#
|
||||
# ks = np.sqrt(a2f2pdf / (rho_s * a3pdf))
|
||||
#
|
||||
# # ks = np.array([0.04452077, 0.11415143, 0.35533713, 2.47960051])
|
||||
# # ks = ks0[ind]
|
||||
# return ks
|
||||
|
|
@ -43,7 +43,7 @@ def raw_extract(_raw_file):
|
|||
while 1:
|
||||
flag, size, data = fileraw.read_chunk()
|
||||
|
||||
# Pour raw UDT005 (ie. UB-Lab P, UB-SediFlow, UB-Lab 3C) on peut
|
||||
# Pour raw UDT005 (ie. UB-Lab P, UB-SediFlow, UB-Lab 3C) on peut
|
||||
# rencontrer 4 flags: const, settings json, configs (HW), profils
|
||||
if flag == CONST_TAG:
|
||||
try:
|
||||
|
|
@ -55,7 +55,6 @@ def raw_extract(_raw_file):
|
|||
.replace("True", "true")
|
||||
.replace("False", "false")
|
||||
)
|
||||
print("const: %s" % const_dict)
|
||||
|
||||
ubt_data = ubt_raw_data( const_dict )
|
||||
|
||||
|
|
@ -70,12 +69,9 @@ def raw_extract(_raw_file):
|
|||
.replace("True", "true")
|
||||
.replace("False", "false")
|
||||
)
|
||||
print("settings: %s" % settings_dict)
|
||||
|
||||
ubt_data.set_config(settings_dict)
|
||||
|
||||
print("ubt_data.set_config(settings_dict) : ", ubt_data.set_config(settings_dict))
|
||||
|
||||
if flag == CONFIG_TAG:
|
||||
# what is needed from here and which is not in param_us_dict is only blind_ca0 and blind_ca1
|
||||
# note: this is not useful on APF06, but could be used for double check
|
||||
|
|
@ -100,7 +96,7 @@ def raw_extract(_raw_file):
|
|||
|
||||
#print("%d profiles read" % profile_id)
|
||||
# last timestamp of udt file for time_end definition of run:
|
||||
# based on the last profile processed
|
||||
# based on the last profile processed
|
||||
time_end = timestamp
|
||||
|
||||
return (
|
||||
|
|
@ -111,4 +107,4 @@ def raw_extract(_raw_file):
|
|||
ubt_data.data_us_dicts,
|
||||
ubt_data.data_dicts,
|
||||
settings_dict,
|
||||
)
|
||||
)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -43,8 +43,6 @@ from subprocess import check_call, run
|
|||
|
||||
import time
|
||||
|
||||
from View.acoustic_data_tab import AcousticDataTab
|
||||
|
||||
|
||||
class Ui_MainWindow(object):
|
||||
def setupUi(self, MainWindow):
|
||||
|
|
@ -55,10 +53,13 @@ class Ui_MainWindow(object):
|
|||
self.mainwindow.setDocumentMode(False)
|
||||
self.mainwindow.setDockNestingEnabled(False)
|
||||
self.mainwindow.setUnifiedTitleAndToolBarOnMac(False)
|
||||
|
||||
self.centralwidget = QtWidgets.QWidget(self.mainwindow)
|
||||
self.centralwidget.setObjectName("centralwidget")
|
||||
|
||||
self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
|
||||
self.tabWidget = QtWidgets.QTabWidget(self.centralwidget)
|
||||
self.tabWidget.setAutoFillBackground(False)
|
||||
self.tabWidget.setLocale(QtCore.QLocale(QtCore.QLocale.French, QtCore.QLocale.France))
|
||||
|
|
@ -66,115 +67,125 @@ class Ui_MainWindow(object):
|
|||
self.tabWidget.setTabsClosable(False)
|
||||
self.tabWidget.setTabBarAutoHide(False)
|
||||
self.tabWidget.setObjectName("tabWidget")
|
||||
|
||||
self.tab1 = QtWidgets.QWidget()
|
||||
self.tab1.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
||||
self.tab1.setObjectName("tab1")
|
||||
self.tabWidget.addTab(self.tab1, "")
|
||||
|
||||
self.tab2 = QtWidgets.QWidget()
|
||||
self.tab2.setObjectName("tab2")
|
||||
self.tabWidget.addTab(self.tab2, "")
|
||||
|
||||
self.tab3 = QtWidgets.QWidget()
|
||||
self.tab3.setObjectName("tab3")
|
||||
self.tabWidget.addTab(self.tab3, "")
|
||||
|
||||
self.tab4 = QtWidgets.QWidget()
|
||||
self.tab4.setObjectName("tab4")
|
||||
self.tabWidget.addTab(self.tab4, "")
|
||||
|
||||
self.tab5 = QtWidgets.QWidget()
|
||||
self.tab5.setObjectName("tab5")
|
||||
self.tabWidget.addTab(self.tab5, "")
|
||||
|
||||
self.tab6 = QtWidgets.QWidget()
|
||||
self.tab6.setObjectName("tab6")
|
||||
self.tabWidget.addTab(self.tab6, "")
|
||||
# self.tab7 = QtWidgets.QWidget()
|
||||
# self.tab7.setObjectName("tab7")
|
||||
# self.tabWidget.addTab(self.tab7, "")
|
||||
|
||||
self.verticalLayout.addWidget(self.tabWidget)
|
||||
self.mainwindow.setCentralWidget(self.centralwidget)
|
||||
|
||||
self.menubar = QtWidgets.QMenuBar(self.mainwindow)
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 898, 22))
|
||||
self.menubar.setObjectName("menubar")
|
||||
|
||||
self.menuFile = QtWidgets.QMenu(self.menubar)
|
||||
self.menuFile.setLocale(QtCore.QLocale(QtCore.QLocale.French, QtCore.QLocale.France))
|
||||
self.menuFile.setObjectName("menuFile")
|
||||
|
||||
self.menuSettings = QtWidgets.QMenu(self.menuFile)
|
||||
self.menuSettings.setObjectName("menuSettings")
|
||||
|
||||
self.menuLanguage = QtWidgets.QMenu(self.menuSettings)
|
||||
self.menuLanguage.setObjectName("menuLanguage")
|
||||
|
||||
self.menuExport = QtWidgets.QMenu(self.menuFile)
|
||||
self.menuExport.setObjectName("menuExport")
|
||||
|
||||
self.menuTools = QtWidgets.QMenu(self.menubar)
|
||||
self.menuTools.setLocale(QtCore.QLocale(QtCore.QLocale.French, QtCore.QLocale.France))
|
||||
self.menuTools.setObjectName("menuTools")
|
||||
|
||||
self.menuHelp = QtWidgets.QMenu(self.menubar)
|
||||
self.menuHelp.setObjectName("menuHelp")
|
||||
|
||||
self.mainwindow.setMenuBar(self.menubar)
|
||||
|
||||
self.statusbar = QtWidgets.QStatusBar(self.mainwindow)
|
||||
self.statusbar.setObjectName("statusbar")
|
||||
self.mainwindow.setStatusBar(self.statusbar)
|
||||
|
||||
self.toolBar = QtWidgets.QToolBar(self.mainwindow)
|
||||
self.toolBar.setObjectName("toolBar")
|
||||
self.mainwindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
|
||||
# self.actionNew = QtWidgets.QAction(self.mainwindow)
|
||||
# icon = QtGui.QIcon()
|
||||
# icon.addPixmap(QtGui.QPixmap("icons/new.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
# self.actionNew.setIcon(icon)
|
||||
# self.actionNew.setObjectName("actionNew")
|
||||
|
||||
self.actionOpen = QtWidgets.QAction(self.mainwindow)
|
||||
icon1 = QtGui.QIcon()
|
||||
icon1.addPixmap(QtGui.QPixmap("icons/icon_folder.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.actionOpen.setIcon(icon1)
|
||||
self.actionOpen.setObjectName("actionOpen")
|
||||
|
||||
self.actionSave = QtWidgets.QAction(self.mainwindow)
|
||||
icon2 = QtGui.QIcon()
|
||||
icon2.addPixmap(QtGui.QPixmap("icons/save.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.actionSave.setIcon(icon2)
|
||||
self.actionSave.setObjectName("actionSave")
|
||||
# self.actionCopy = QtWidgets.QAction(self.mainwindow)
|
||||
# icon3 = QtGui.QIcon()
|
||||
# icon3.addPixmap(QtGui.QPixmap("icons/copy.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
# self.actionCopy.setIcon(icon3)
|
||||
# self.actionCopy.setObjectName("actionCopy")
|
||||
# self.actionCut = QtWidgets.QAction(self.mainwindow)
|
||||
# icon4 = QtGui.QIcon()
|
||||
# icon4.addPixmap(QtGui.QPixmap("icons/cut.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
# self.actionCut.setIcon(icon4)
|
||||
# self.actionCut.setObjectName("actionCut")
|
||||
# self.actionPaste = QtWidgets.QAction(self.mainwindow)
|
||||
# icon5 = QtGui.QIcon()
|
||||
# icon5.addPixmap(QtGui.QPixmap("icons/paste.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
# self.actionPaste.setIcon(icon5)
|
||||
# self.actionPaste.setObjectName("actionPaste")
|
||||
|
||||
self.actionEnglish = QtWidgets.QAction(self.mainwindow)
|
||||
icon6 = QtGui.QIcon()
|
||||
icon6.addPixmap(QtGui.QPixmap("icons/en.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.actionEnglish.setIcon(icon6)
|
||||
self.actionEnglish.setObjectName("actionEnglish")
|
||||
|
||||
self.actionFrench = QtWidgets.QAction(self.mainwindow)
|
||||
icon7 = QtGui.QIcon()
|
||||
icon7.addPixmap(QtGui.QPixmap("icons/fr.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.actionFrench.setIcon(icon7)
|
||||
self.actionFrench.setObjectName("actionFrench")
|
||||
|
||||
self.action_ABSCalibrationConstant = QtWidgets.QAction(self.mainwindow)
|
||||
self.action_ABSCalibrationConstant.setText("ABS constant calibration kt")
|
||||
|
||||
self.actionTable_of_Backscatter_values = QtWidgets.QAction(self.mainwindow)
|
||||
self.actionTable_of_Backscatter_values.setObjectName("actionTable_of_Backscatter_values")
|
||||
|
||||
self.actionSave_As = QtWidgets.QAction(self.mainwindow)
|
||||
self.actionSave_As.setObjectName("actionSave_As")
|
||||
|
||||
self.actionAbout = QtWidgets.QAction(self.mainwindow)
|
||||
self.actionAbout.setObjectName("actionAbout")
|
||||
|
||||
self.actionUserManual = QtWidgets.QAction(self.mainwindow)
|
||||
self.actionUserManual.setText("User Manual")
|
||||
|
||||
self.action_AcousticInversionTheory = QtWidgets.QAction(self.mainwindow)
|
||||
self.action_AcousticInversionTheory.setText("Acoustic inversion theory")
|
||||
|
||||
self.action_AQUAscatUserManual = QtWidgets.QAction(self.mainwindow)
|
||||
self.action_AQUAscatUserManual.setText("Tutorial AQUAscat software")
|
||||
|
||||
self.actionDB_Browser_for_SQLite = QtWidgets.QAction(self.mainwindow)
|
||||
self.actionDB_Browser_for_SQLite.setObjectName("actionDB_Browser_for_SQLite")
|
||||
|
||||
self.menuLanguage.addAction(self.actionEnglish)
|
||||
self.menuLanguage.addAction(self.actionFrench)
|
||||
|
||||
self.menuSettings.addAction(self.menuLanguage.menuAction())
|
||||
self.menuSettings.addAction(self.action_ABSCalibrationConstant)
|
||||
|
||||
self.menuExport.addAction(self.actionTable_of_Backscatter_values)
|
||||
|
||||
self.menuFile.addAction(self.actionOpen)
|
||||
self.menuFile.addAction(self.actionSave)
|
||||
self.menuFile.addAction(self.actionSave_As)
|
||||
|
|
@ -182,21 +193,21 @@ class Ui_MainWindow(object):
|
|||
self.menuFile.addAction(self.menuSettings.menuAction())
|
||||
self.menuFile.addSeparator()
|
||||
self.menuFile.addAction(self.menuExport.menuAction())
|
||||
|
||||
self.menuTools.addAction(self.actionDB_Browser_for_SQLite)
|
||||
|
||||
self.menuHelp.addAction(self.actionAbout)
|
||||
self.menuHelp.addAction(self.actionUserManual)
|
||||
self.menuHelp.addAction(self.action_AcousticInversionTheory)
|
||||
self.menuHelp.addAction(self.action_AQUAscatUserManual)
|
||||
|
||||
self.menubar.addAction(self.menuFile.menuAction())
|
||||
self.menubar.addAction(self.menuTools.menuAction())
|
||||
self.menubar.addAction(self.menuHelp.menuAction())
|
||||
# self.toolBar.addAction(self.actionNew)
|
||||
|
||||
self.toolBar.addAction(self.actionOpen)
|
||||
self.toolBar.addAction(self.actionSave)
|
||||
self.toolBar.addSeparator()
|
||||
# self.toolBar.addAction(self.actionCopy)
|
||||
# self.toolBar.addAction(self.actionCut)
|
||||
# self.toolBar.addAction(self.actionPaste)
|
||||
self.toolBar.addSeparator()
|
||||
self.toolBar.addAction(self.actionEnglish)
|
||||
self.toolBar.addAction(self.actionFrench)
|
||||
|
|
@ -257,12 +268,7 @@ class Ui_MainWindow(object):
|
|||
UpdateTableForSave()
|
||||
|
||||
def open(self):
|
||||
pass
|
||||
# ReadTableForOpen()
|
||||
|
||||
# acoustic_data_tab = AcousticDataTab()
|
||||
#
|
||||
# acoustic_data_tab.fileListWidget.addItems(stg.acoustic_data)
|
||||
ReadTableForOpen()
|
||||
|
||||
def load_calibration_constant_values(self):
|
||||
cc_kt = CalibrationConstantKt()
|
||||
|
|
@ -330,13 +336,6 @@ class Ui_MainWindow(object):
|
|||
exec("DataFrame_acoustic_" + str(i) + "= pd.DataFrame(None)")
|
||||
exec("DataFrame_acoustic_" + str(i) + "= pd.DataFrame(data=table_data.transpose(), columns=header_list)")
|
||||
|
||||
# exec("DataFrame_acoustic_" + str(i) + ".to_csv(" +
|
||||
# "excel_writer=" +
|
||||
# '/home/bmoudjed/Documents/3 SSC acoustic meas project/Graphical interface project/BS_raw_data_table.xlsx' + "," +
|
||||
# "sheet_name=stg.filename_BS_raw_data[i]," +
|
||||
# "header=DataFrame_acoustic.columns," +
|
||||
# "engine=" + "xlsxwriter" + ")")
|
||||
|
||||
exec("DataFrame_acoustic_" + str(i) + ".to_csv(" +
|
||||
"path_or_buf=" +
|
||||
"'" + name + "/" + "Table_" +
|
||||
|
|
@ -357,7 +356,6 @@ class Ui_MainWindow(object):
|
|||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab4), _translate("MainWindow", "Sediment Calibration"))
|
||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab5), _translate("MainWindow", "Acoustic inversion"))
|
||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab6), _translate("MainWindow", "Note"))
|
||||
# self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab7), _translate("MainWindow", "User manual"))
|
||||
self.menuFile.setTitle(_translate("MainWindow", "File"))
|
||||
self.menuSettings.setTitle(_translate("MainWindow", "Settings"))
|
||||
self.menuLanguage.setTitle(_translate("MainWindow", "Language"))
|
||||
|
|
@ -365,12 +363,8 @@ class Ui_MainWindow(object):
|
|||
self.menuTools.setTitle(_translate("MainWindow", "Tools"))
|
||||
self.menuHelp.setTitle(_translate("MainWindow", "Help"))
|
||||
self.toolBar.setWindowTitle(_translate("MainWindow", "toolBar"))
|
||||
# self.actionNew.setText(_translate("MainWindow", "New"))
|
||||
self.actionOpen.setText(_translate("MainWindow", "Open ..."))
|
||||
self.actionSave.setText(_translate("MainWindow", "Save"))
|
||||
# self.actionCopy.setText(_translate("MainWindow", "Copy"))
|
||||
# self.actionCut.setText(_translate("MainWindow", "Cut"))
|
||||
# self.actionPaste.setText(_translate("MainWindow", "Paste"))
|
||||
self.actionEnglish.setText(_translate("MainWindow", "English"))
|
||||
self.actionFrench.setText(_translate("MainWindow", "French"))
|
||||
self.actionTable_of_Backscatter_values.setText(_translate("MainWindow", "Table of Backscatter values"))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import sys
|
||||
|
||||
from PyQt5.QtGui import QIcon, QPixmap
|
||||
from PyQt5.QtWidgets import (QWidget, QLabel, QHBoxLayout, QVBoxLayout, QApplication, QMainWindow, QGridLayout,
|
||||
|
|
@ -72,74 +71,6 @@ class PlotNoiseWindow(QDialog):
|
|||
"-stg.depth_noise[" + str(i) + "][" + str(freq_ind) + ", :]," +
|
||||
"stg.BS_noise_raw_data[" + str(i) + "][" + str(freq_ind) + ", :, :]," +
|
||||
"cmap='hsv')")
|
||||
# , norm = LogNorm(vmin=val_min, vmax=val_max)
|
||||
|
||||
# if stg.time_cross_section[i].shape != (0,):
|
||||
#
|
||||
# if depth_cross_section[i].shape != (0,):
|
||||
# if val_min == val_max:
|
||||
# exec("pcm = self.ax" + str(i) + "[" + str(freq_ind) + "]" + ".pcolormesh(" +
|
||||
# "stg.time_cross_section[" + str(i) + "][" + str(freq_ind) + ", :]," +
|
||||
# "-stg.depth_cross_section[" + str(i) + "][" + str(freq_ind) + ", :]," +
|
||||
# "stg.BS_noise_raw_data[" + str(i) + "][" + str(freq_ind) + ", :, :]," +
|
||||
# "cmap='viridis')" )
|
||||
# else:
|
||||
# val_min = 0
|
||||
# val_max = 1e-5
|
||||
# exec("pcm = self.ax" + str(i) + "[" + str(freq_ind) + "]" + ".pcolormesh(" +
|
||||
# "stg.time_cross_section[" + str(i) + "][" + str(freq_ind) + ", :]," +
|
||||
# "-stg.depth_cross_section[" + str(i) + "][" + str(freq_ind) + ", :]," +
|
||||
# "stg.BS_noise_raw_data[" + str(i) + "][" + str(freq_ind) + ", :, :]," +
|
||||
# "cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))")
|
||||
# else:
|
||||
# if val_min == val_max:
|
||||
# exec("pcm = self.ax" + str(i) + "[" + str(freq_ind) + "]" + ".pcolormesh(" +
|
||||
# "stg.time_cross_section[" + str(i) + "][" + str(freq_ind) + ", :]," +
|
||||
# "-stg.depth[" + str(i) + "][" + str(freq_ind) + ", :]," +
|
||||
# "stg.BS_noise_raw_data[" + str(i) + "][" + str(freq_ind) + ", :, :]," +
|
||||
# "cmap='viridis')" )
|
||||
# else:
|
||||
# val_min = 0
|
||||
# val_max = 1e-5
|
||||
# exec("pcm = self.ax" + str(i) + "[" + str(freq_ind) + "]" + ".pcolormesh(" +
|
||||
# "stg.time_cross_section[" + str(i) + "][" + str(freq_ind) + ", :]," +
|
||||
# "-stg.depth[" + str(i) + "][" + str(freq_ind) + ", :]," +
|
||||
# "stg.BS_noise_averaged_data[" + str(i) + "][" + str(freq_ind) + ", :, :]," +
|
||||
# "cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))")
|
||||
#
|
||||
# else:
|
||||
#
|
||||
# if depth_cross_section[i].shape != (0,):
|
||||
# if val_min == val_max:
|
||||
# exec("pcm = self.ax" + str(i) + "[" + str(freq_ind) + "]" + ".pcolormesh(" +
|
||||
# "stg.time[" + str(i) + "][" + str(freq_ind) + ", :]," +
|
||||
# "-stg.depth_cross_section[" + str(i) + "][" + str(freq_ind) + ", :]," +
|
||||
# "stg.BS_noise_averaged_data[" + str(i) + "][" + str(freq_ind) + ", :, :]," +
|
||||
# "cmap='viridis')" )
|
||||
# else:
|
||||
# val_min = 0
|
||||
# val_max = 1e-5
|
||||
# exec("pcm = self.ax" + str(i) + "[" + str(freq_ind) + "]" + ".pcolormesh(" +
|
||||
# "stg.time[" + str(i) + "][" + str(freq_ind) + ", :]," +
|
||||
# "-stg.depth_cross_section[" + str(i) + "][" + str(freq_ind) + ", :]," +
|
||||
# "stg.BS_noise_averaged_data[" + str(i) + "][" + str(freq_ind) + ", :, :]," +
|
||||
# "cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))")
|
||||
# else:
|
||||
# if val_min == val_max:
|
||||
# exec("pcm = self.ax" + str(i) + "[" + str(freq_ind) + "]" + ".pcolormesh(" +
|
||||
# "stg.time[" + str(i) + "][" + str(freq_ind) + ", :]," +
|
||||
# "-stg.depth[" + str(i) + "][" + str(freq_ind) + ", :]," +
|
||||
# "stg.BS_noise_averaged_data[" + str(i) + "][" + str(freq_ind) + ", :, :]," +
|
||||
# "cmap='viridis')" )
|
||||
# else:
|
||||
# val_min = 0
|
||||
# val_max = 1e-5
|
||||
# exec("pcm = self.ax" + str(i) + "[" + str(freq_ind) + "]" + ".pcolormesh(" +
|
||||
# "stg.time[" + str(i) + "][" + str(freq_ind) + ", :]," +
|
||||
# "-stg.depth[" + str(i) + "][" + str(freq_ind) + ", :]," +
|
||||
# "stg.BS_noise_averaged_data[" + str(i) + "][" + str(freq_ind) + ", :, :]," +
|
||||
# "cmap='viridis')")
|
||||
# # , norm = LogNorm(vmin=val_min, vmax=val_max)
|
||||
|
||||
eval("self.ax" + str(i) + "[" + str(freq_ind) + "]" + ".text(1, .70, stg.freq_text[" + str(i) +
|
||||
"][" + str(freq_ind) + "]," +
|
||||
|
|
@ -160,8 +91,6 @@ class PlotNoiseWindow(QDialog):
|
|||
|
||||
pass
|
||||
|
||||
# self.axis_noise.tick_params(axis='both', which='minor', labelsize=10)
|
||||
|
||||
exec("self.canvas" + str(i) + "= FigureCanvas(self.fig" + str(i) + ")")
|
||||
exec("self.toolbar" + str(i) + "= NavigationToolBar(self.canvas" + str(i) + ", self)")
|
||||
|
||||
|
|
@ -171,10 +100,3 @@ class PlotNoiseWindow(QDialog):
|
|||
exec("self.verticalLayout_tab" + str(i) + ".addWidget(self.toolbar" + str(i) + ")")
|
||||
exec("self.verticalLayout_tab" + str(i) + ".addWidget(self.scroll" + str(i) + ")")
|
||||
|
||||
|
||||
# self.tab1 = QWidget()
|
||||
# self.tab.addTab(self.tab1, "Tab 1")
|
||||
|
||||
|
||||
|
||||
# ----------------------------------------------------------
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,13 +1,33 @@
|
|||
import sys
|
||||
# ============================================================================== #
|
||||
# acoustic_data_tab.py - AcouSed #
|
||||
# Copyright (C) 2024 INRAE #
|
||||
# #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
# the Free Software Foundation, either version 3 of the License, or #
|
||||
# (at your option) any later version. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, #
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||
# GNU General Public License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License #
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
|
||||
|
||||
# by Brahim MOUDJED #
|
||||
# ============================================================================== #
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import pandas as pd
|
||||
from PyQt5.QtWidgets import (QWidget, QMainWindow, QApplication, QVBoxLayout, QHBoxLayout, QGroupBox, QComboBox,
|
||||
QGridLayout, QLabel, QPushButton, QSpinBox, QDoubleSpinBox, QAbstractSpinBox, QSpacerItem,
|
||||
QSizePolicy, QSlider, QLineEdit, QDial, QFileDialog, QMessageBox, QFrame)
|
||||
from PyQt5.QtWidgets import (QWidget, QVBoxLayout, QHBoxLayout, QGroupBox, QComboBox,
|
||||
QGridLayout, QLabel, QPushButton, QSlider, QLineEdit, QFileDialog, QMessageBox, QFrame)
|
||||
|
||||
from PyQt5.QtCore import QCoreApplication, Qt, QPropertyAnimation, QSize
|
||||
from PyQt5.QtGui import QStandardItemModel, QIcon, QPixmap, QFont
|
||||
from PyQt5.QtCore import Qt, QPropertyAnimation, QSize
|
||||
from PyQt5.QtGui import QIcon, QPixmap, QFont
|
||||
|
||||
import settings as stg
|
||||
|
||||
|
|
@ -24,14 +44,6 @@ 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, alpha_s
|
||||
|
||||
|
||||
# from settings import depth_cross_section, BS_raw_data_pre_process_average, BS_raw_data_pre_process_SNR, BS_raw_data, \
|
||||
# path_calibration_file
|
||||
|
||||
|
||||
# from virtual_env.bin.odfimg import directory
|
||||
|
||||
|
||||
class SedimentCalibrationTab(QWidget):
|
||||
|
|
@ -323,9 +335,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.label_ks.setText("ks")
|
||||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_ks, 4, 0, 1, 1, Qt.AlignCenter)
|
||||
|
||||
# self.spinbox_ks_freq1 = QDoubleSpinBox()
|
||||
# self.spinbox_ks_freq1.setDecimals(8)
|
||||
# self.spinbox_ks_freq1.setSuffix(" m/kg^0.5")
|
||||
self.lineEdit_ks_freq1 = QLineEdit()
|
||||
self.lineEdit_ks_freq1.setMaximumWidth(100)
|
||||
self.lineEdit_ks_freq1.setText("0.00")
|
||||
|
|
@ -336,9 +345,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_ks_freq1_unit, 4, 2, 1, 1,
|
||||
Qt.AlignLeft)
|
||||
|
||||
# self.spinbox_ks_freq2 = QDoubleSpinBox()
|
||||
# self.spinbox_ks_freq2.setDecimals(8)
|
||||
# self.spinbox_ks_freq2.setSuffix(" m/kg^0.5")
|
||||
self.lineEdit_ks_freq2 = QLineEdit()
|
||||
self.lineEdit_ks_freq2.setMaximumWidth(100)
|
||||
self.lineEdit_ks_freq2.setText("0.00")
|
||||
|
|
@ -353,9 +359,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.label_sv.setText("sv")
|
||||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_sv, 5, 0, 1, 1, Qt.AlignCenter)
|
||||
|
||||
# self.spinbox_sv_freq1 = QDoubleSpinBox()
|
||||
# self.spinbox_sv_freq1.setDecimals(8)
|
||||
# self.spinbox_sv_freq1.setSuffix(" /m")
|
||||
self.lineEdit_sv_freq1 = QLineEdit()
|
||||
self.lineEdit_sv_freq1.setMaximumWidth(100)
|
||||
self.lineEdit_sv_freq1.setText("0.00")
|
||||
|
|
@ -365,9 +368,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.label_sv_freq1_unit.setText("m<sup>-1</sup>")
|
||||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_sv_freq1_unit, 5, 2, 1, 1)
|
||||
|
||||
# self.spinbox_sv_freq2 = QDoubleSpinBox()
|
||||
# self.spinbox_sv_freq2.setDecimals(8)
|
||||
# self.spinbox_sv_freq2.setSuffix(" /m")
|
||||
self.lineEdit_sv_freq2 = QLineEdit()
|
||||
self.lineEdit_sv_freq2.setMaximumWidth(100)
|
||||
self.lineEdit_sv_freq2.setText("0.00")
|
||||
|
|
@ -381,8 +381,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.label_X.setText("X")
|
||||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_X, 6, 0, 1, 1, Qt.AlignCenter)
|
||||
|
||||
# self.spinbox_X = QDoubleSpinBox()
|
||||
# self.spinbox_X.setDecimals(2)
|
||||
self.lineEdit_X = QLineEdit()
|
||||
self.lineEdit_X.setMaximumWidth(100)
|
||||
self.lineEdit_X.setText("0.00")
|
||||
|
|
@ -392,9 +390,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.label_alphas.setText("\u03B1s")
|
||||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_alphas, 7, 0, 1, 1, Qt.AlignCenter)
|
||||
|
||||
# self.spinbox_alphas_freq1 = QDoubleSpinBox()
|
||||
# self.spinbox_alphas_freq1.setDecimals(4)
|
||||
# self.spinbox_alphas_freq1.setSuffix(" /m")
|
||||
self.lineEdit_alphas_freq1 = QLineEdit()
|
||||
self.lineEdit_alphas_freq1.setMaximumWidth(100)
|
||||
self.lineEdit_alphas_freq1.setText("0.00")
|
||||
|
|
@ -404,9 +399,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.label_alphas_freq1_unit.setText("m<sup>-1</sup>")
|
||||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_alphas_freq1_unit, 7, 2, 1, 1, Qt.AlignLeft)
|
||||
|
||||
# self.spinbox_alphas_freq2 = QDoubleSpinBox()
|
||||
# self.spinbox_alphas_freq2.setDecimals(4)
|
||||
# self.spinbox_alphas_freq2.setSuffix(" /m")
|
||||
self.lineEdit_alphas_freq2 = QLineEdit()
|
||||
self.lineEdit_alphas_freq2.setMaximumWidth(100)
|
||||
self.lineEdit_alphas_freq2.setText("0.00")
|
||||
|
|
@ -420,9 +412,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.label_zeta.setText("\u03B6")
|
||||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_zeta, 8, 0, 1, 1, Qt.AlignCenter)
|
||||
|
||||
# self.spinbox_zeta_freq1 = QDoubleSpinBox()
|
||||
# self.spinbox_zeta_freq1.setDecimals(4)
|
||||
# self.spinbox_zeta_freq1.setSuffix(" /m")
|
||||
self.lineEdit_zeta_freq1 = QLineEdit()
|
||||
self.lineEdit_zeta_freq1.setMaximumWidth(100)
|
||||
self.lineEdit_zeta_freq1.setText("0.00")
|
||||
|
|
@ -433,9 +422,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.label_zeta_freq1_unit, 8, 2, 1, 1,
|
||||
Qt.AlignLeft)
|
||||
|
||||
# self.spinbox_zeta_freq2 = QDoubleSpinBox()
|
||||
# self.spinbox_zeta_freq2.setDecimals(4)
|
||||
# self.spinbox_zeta_freq2.setSuffix(" /m")
|
||||
self.lineEdit_zeta_freq2 = QLineEdit()
|
||||
self.lineEdit_zeta_freq2.setMaximumWidth(100)
|
||||
self.lineEdit_zeta_freq2.setText("0.00")
|
||||
|
|
@ -450,22 +436,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.pushbutton_save_calibration.setText("Save calibration")
|
||||
self.gridLayout_groupbox_sediment_calibration_parameter.addWidget(self.pushbutton_save_calibration,9, 5, 1, 1)
|
||||
|
||||
# self.groupbox_calibration_compute_size_change()
|
||||
|
||||
# self.animaiton_groupbox_compute = QPropertyAnimation(self.groupbox_sediment_calibration_compute, b"size")
|
||||
# self.animaiton_groupbox_compute.setStartValue(QSize(self.groupbox_sediment_calibration_compute.width(), 25))
|
||||
#
|
||||
# self.animaiton_groupbox_compute.start()
|
||||
|
||||
# setStartValue(QSize(self.groupbox_sediment_calibration_compute.width(),
|
||||
# self.groupbox_sediment_calibration_compute.height()))
|
||||
#
|
||||
# self.animaiton_groupbox_compute.setEndValue(
|
||||
# QSize(self.groupbox_sediment_calibration_compute.width(),
|
||||
# self.groupbox_sediment_calibration_compute.sizeHint().height()))
|
||||
# else:
|
||||
# self.animaiton_groupbox_compute.setEndValue(QSize(self.groupbox_sediment_calibration_compute.width(), 25))
|
||||
|
||||
# ++++++++++++++++++++
|
||||
# +++ Groupbox FCB +++
|
||||
|
||||
|
|
@ -814,7 +784,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
|
||||
elif stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
|
||||
print("totototototototoott")
|
||||
val_min = np.nanmin(
|
||||
stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex(),
|
||||
:, :])
|
||||
|
|
@ -1066,8 +1035,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
|
||||
|
||||
# --- Plot samples ---
|
||||
print("stg.fine_sample_profile ", stg.fine_sample_profile)
|
||||
print("stg.sand_sample_target ", stg.sand_sample_target)
|
||||
|
||||
if (stg.fine_sample_profile) or (stg.sand_sample_target):
|
||||
|
||||
|
|
@ -1150,8 +1117,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.combobox_freq2.currentIndex(), :],
|
||||
color='red', linestyle="solid", linewidth=2))
|
||||
|
||||
# self.axis_BS.set_xticks([])
|
||||
# self.axis_BS.set_yticks([])
|
||||
self.axis_BS.set_xlabel("Time (sec)")
|
||||
self.axis_BS.set_ylabel("Depth (m)")
|
||||
self.fig_BS.canvas.draw_idle()
|
||||
|
|
@ -1159,13 +1124,11 @@ class SedimentCalibrationTab(QWidget):
|
|||
def sample_choice_for_calibration(self):
|
||||
# --- List selected fine samples ---
|
||||
stg.fine_sample_profile = [(f, int(f[1:]) - 1) for f in self.combobox_fine_sample_choice.currentData()]
|
||||
print(f"stg.fine_sample_profile : {stg.fine_sample_profile}")
|
||||
|
||||
# --- List selected sand samples ---
|
||||
# stg.sand_sample_target = [(s, int(s[1:]) - 1) for s in self.combobox_sand_sample_choice.currentData()]
|
||||
stg.sand_sample_target = [(self.combobox_sand_sample_choice.currentText(),
|
||||
self.combobox_sand_sample_choice.currentIndex())]
|
||||
print(f"stg.sand_sample_target : {stg.sand_sample_target}")
|
||||
|
||||
# --- Find index in time (along acoustic recording) of sand sample target ---
|
||||
if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
|
|
@ -1232,7 +1195,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
)
|
||||
|
||||
stg.sand_sample_target_indice = [(d1, t1), (d2, t2)]
|
||||
print("stg.sand_sample_target_indice ", stg.sand_sample_target_indice)
|
||||
|
||||
def summary_samples_choices(self):
|
||||
|
||||
|
|
@ -1260,17 +1222,9 @@ class SedimentCalibrationTab(QWidget):
|
|||
|
||||
for p in range(len(fine_data)):
|
||||
for q in range(len(fine_data[0])):
|
||||
# exec("fine_label[" + str(p) + "]_" + "stg.fine_sample_profile[" + str(p) + "][0]" + " = QLabel()")
|
||||
# eval("fine_label[" + str(p) + "]_" + "stg.fine_sample_profile[" + str(p) + "][0]" + ".setText(" + "fine_data[" + str(p) + "][" + str(q) + "])")
|
||||
# eval("self.gridLayout_groupbox_interpolate_info.addWidget(" + "fine_label[" + str(p) + "]_" + "stg.fine_sample_profile[" + str(p) + "], " + str(1+p) + ", " + str(q) + ", 1, 1)")
|
||||
print(f"self.gridLayout_groupbox_interpolate_info.addWidget(QLabel(fine_data[{p}][{q}]), {2 + p}, {q}, 1, 1, Qt.AlignCenter)")
|
||||
eval(f"self.gridLayout_groupbox_interpolate_info.addWidget(QLabel(fine_data[{p}][{q}]), {2 + p}, {q}, 1, 1, Qt.AlignCenter)")
|
||||
|
||||
# self.double_horizontal_line = QFrame()
|
||||
# self.double_horizontal_line.setFrameShape(QFrame.HLine)
|
||||
# self.double_horizontal_line.setFrameShadow(QFrame.Sunken)
|
||||
# self.double_horizontal_line.setLineWidth(1)
|
||||
# self.double_horizontal_line.setMidLineWidth(3)
|
||||
self.gridLayout_groupbox_interpolate_info.addWidget(self.double_horizontal_line, 2 + len(fine_data), 0, 1, 4, Qt.AlignCenter)
|
||||
|
||||
sand_head = ["Sample", "Depth (m)", "time", "Csand (g/L)"]
|
||||
|
|
@ -1363,8 +1317,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
)
|
||||
)
|
||||
|
||||
# print(f"range_lin_interp : {range_lin_interp}")
|
||||
# print(f"M_profile_fine : {M_profile_fine}")
|
||||
else:
|
||||
|
||||
if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
|
|
@ -1405,118 +1357,12 @@ class SedimentCalibrationTab(QWidget):
|
|||
]
|
||||
))
|
||||
|
||||
print(f"1 M_profile_fine : {stg.M_profile_fine}")
|
||||
stg.range_lin_interp = stg.range_lin_interp
|
||||
stg.M_profile_fine = stg.M_profile_fine
|
||||
stg.M_profile_fine = stg.M_profile_fine[:stg.range_lin_interp.shape[0]]
|
||||
print(f"2 M_profile_fine : {stg.M_profile_fine}")
|
||||
|
||||
self.plot_profile_of_concentration_fine()
|
||||
|
||||
# def range_cells_function(self):
|
||||
# """ Computing the real cell size, that depends on the temperature """
|
||||
#
|
||||
# # defaut Aquascat cell size
|
||||
# aquascat_cell_size = stg.r[0, 1] - stg.r[0, 0]
|
||||
# # Pulse duration
|
||||
# tau = aquascat_cell_size * 2 / 1500 # figure 2.9 1500 vitesse du son entrée pour le paramètrage des mesures aquascat
|
||||
# # Sound speed
|
||||
# cel = self.inv_hc.water_velocity(self.spinbox_temperature_water_attenuation.value())
|
||||
# # Real cell size
|
||||
# real_cell_size = cel * tau / 2 # voir fig 2.9
|
||||
#
|
||||
# # Converting to real cell profile
|
||||
# real_r = stg.r / aquascat_cell_size * real_cell_size # (/ aquascat_cell_size) pour ramener BS.r entre 0 et 1
|
||||
# # (* real_cell_size) pour remettre les échelles spatiales sur la taille réelle des cellules
|
||||
#
|
||||
# # R with right shape (numpy array)
|
||||
# R_real = real_r # np.repeat(real_r, len(stg.freq), axis=1)
|
||||
#
|
||||
# return R_real
|
||||
|
||||
|
||||
# def compute_FCB(self):
|
||||
#
|
||||
# print(f"self.range_cells_function() : {self.range_cells_function()}")
|
||||
# print(f"self.range_cells_function() shape : {self.range_cells_function().shape}")
|
||||
# R_real = np.repeat(self.range_cells_function()[:, :, np.newaxis], stg.t.shape[1], axis=2)
|
||||
# print(f"R_real shape : {R_real.shape}")
|
||||
# if (stg.BS_stream_bed_pre_process_average.size == 0) and (stg.BS_stream_bed_pre_process_SNR.size == 0):
|
||||
# stg.FCB = (np.log(stg.BS_stream_bed) + np.log(R_real) +
|
||||
# 2 * stg.water_attenuation * R_real)
|
||||
# elif stg.BS_stream_bed_pre_process_SNR.size == 0:
|
||||
# stg.FCB = (np.log(stg.BS_stream_bed_pre_process_average) + np.log(R_real) +
|
||||
# 2 * stg.water_attenuation * R_real)
|
||||
# else:
|
||||
# stg.FCB = (np.log(stg.BS_stream_bed_pre_process_SNR) + np.log(R_real) +
|
||||
# 2 * stg.water_attenuation * R_real)
|
||||
# self.plot_FCB()
|
||||
|
||||
# def fit_FCB_profile_with_linear_regression_and_compute_alphaS(self):
|
||||
#
|
||||
# if stg.FCB.size == 0:
|
||||
# msgBox = QMessageBox()
|
||||
# msgBox.setWindowTitle("Linear regression error")
|
||||
# msgBox.setIcon(QMessageBox.Warning)
|
||||
# msgBox.setText("Please compute FCB before")
|
||||
# msgBox.setStandardButtons(QMessageBox.Ok)
|
||||
# msgBox.exec()
|
||||
# else:
|
||||
# try:
|
||||
# y0 = stg.FCB[self.combobox_frequency_compute_alphaS.currentIndex(), :, self.slider.value()]
|
||||
# y = y0[np.where(np.isnan(y0) == False)]
|
||||
#
|
||||
# x0 = stg.r[0, :].reshape(-1)
|
||||
# x = x0[np.where(np.isnan(y0) == False)]
|
||||
#
|
||||
# value1 = np.where(np.round(np.abs(x - self.spinbox_alphaS_computation_from.value()), 2)
|
||||
# == np.min(np.round(np.abs(x - self.spinbox_alphaS_computation_from.value()), 2)))
|
||||
# value2 = np.where(np.round(np.abs(x - self.spinbox_alphaS_computation_to.value()), 2)
|
||||
# == np.min(np.round(np.abs(x - self.spinbox_alphaS_computation_to.value()), 2)))
|
||||
#
|
||||
# # print(np.round(np.abs(x - self.spinbox_alphaS_computation_from.value()), 2))
|
||||
# # # print("value1 ", value1[0][0])
|
||||
# # print(np.round(np.abs(x - self.spinbox_alphaS_computation_to.value()), 2))
|
||||
# # print("value2 ", value2[0][0])
|
||||
#
|
||||
# # print("y limited ", y[value1[0][0]:value2[0][0]])
|
||||
#
|
||||
# lin_reg_compute = stats.linregress(x[value1[0][0]:value2[0][0]], y[value1[0][0]:value2[0][0]])
|
||||
# except ValueError:
|
||||
# msgBox = QMessageBox()
|
||||
# msgBox.setWindowTitle("Linear regression error")
|
||||
# msgBox.setIcon(QMessageBox.Warning)
|
||||
# msgBox.setText("Please check boundaries to fit a linear line")
|
||||
# msgBox.setStandardButtons(QMessageBox.Ok)
|
||||
# msgBox.exec()
|
||||
# else:
|
||||
# stg.lin_reg = (lin_reg_compute.slope, lin_reg_compute.intercept)
|
||||
# # print(f"y = {stg.lin_reg[0]}x + {stg.lin_reg[1]}")
|
||||
#
|
||||
# self.label_alphaS.clear()
|
||||
# self.label_alphaS.setText(f"\u03B1s = {-0.5*stg.lin_reg[0]:.4f} dB/m")
|
||||
#
|
||||
# # for i, value_freq in enumerate(stg.freq):
|
||||
# # for k, value_t in enumerate(stg.t):
|
||||
# # # print(f"indice i: {i}, indice k: {k}")
|
||||
# # # print(f"values of FCB: {stg.FCB[:, i, k]}")
|
||||
# # y = stg.FCB[:, i, k]
|
||||
# # # print("y : ", y)
|
||||
# # # print(f"values of FCB where FCB is not Nan {y[np.where(np.isnan(y) == False)]}")
|
||||
# # # print(f"values of r where FCB is not Nan {x[np.where(np.isnan(y) == False)]}")
|
||||
# # lin_reg_compute = stats.linregress(x[np.where(np.isnan(y) == False)], y[np.where(np.isnan(y) == False)])
|
||||
# # lin_reg_tuple = (lin_reg_compute.slope, lin_reg_compute.intercept)
|
||||
# # stg.lin_reg.append(lin_reg_tuple)
|
||||
#
|
||||
# # print(f"y = {lin_reg.slope}x + {lin_reg.intercept}")
|
||||
#
|
||||
# # plt.figure()
|
||||
# # plt.plot(stg.r, stg.FCB[:, 0, 825], 'k-', stg.r, lin_reg.slope*stg.r + lin_reg.intercept, "b--")
|
||||
# # plt.show()
|
||||
#
|
||||
# # print("lin_reg length ", len(stg.lin_reg))
|
||||
# # print("lin_reg ", stg.lin_reg)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# --------------- Functions for sediment calibration ---------------
|
||||
# ------------------------------------------------------------------
|
||||
|
|
@ -1551,7 +1397,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.groupbox_sediment_calibration_import.setChecked(False)
|
||||
|
||||
def groupbox_calibration_compute_size_change(self):
|
||||
print("self.groupbox_sediment_calibration_compute.isChecked() ", self.groupbox_sediment_calibration_compute.isChecked())
|
||||
|
||||
duration = 500
|
||||
self.animaiton_groupbox_compute = QPropertyAnimation(self.groupbox_sediment_calibration_compute, b"size")
|
||||
|
|
@ -1561,12 +1406,10 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.groupbox_sediment_calibration_compute.height()))
|
||||
|
||||
if self.groupbox_sediment_calibration_compute.isChecked():
|
||||
print("Checked")
|
||||
self.animaiton_groupbox_compute.setEndValue(
|
||||
QSize(self.groupbox_sediment_calibration_compute.width(),
|
||||
self.groupbox_sediment_calibration_compute.sizeHint().height()))
|
||||
else:
|
||||
print("Non Checked")
|
||||
self.animaiton_groupbox_compute.setEndValue(QSize(self.groupbox_sediment_calibration_compute.width(), 25))
|
||||
|
||||
self.animaiton_groupbox_compute.start()
|
||||
|
|
@ -1631,9 +1474,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
|
||||
# --- Read calibration file ---
|
||||
data = pd.read_csv(stg.path_calibration_file + "/" + stg.filename_calibration_file, header=0, index_col=0)
|
||||
print(data.head())
|
||||
print(data.iloc[0][0])
|
||||
print(type(data.iloc[0][0]))
|
||||
|
||||
# --- Fill spinboxes of calibration parameter ---
|
||||
self.label_temperature.clear()
|
||||
|
|
@ -1641,10 +1481,7 @@ class SedimentCalibrationTab(QWidget):
|
|||
|
||||
self.label_freq1.clear()
|
||||
self.label_freq1.setText(data.columns[0])
|
||||
print(stg.freq_text)
|
||||
print(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()])
|
||||
print(data.columns[0])
|
||||
print("index freq1 ", np.where(np.asarray(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]) == data.columns[0]))
|
||||
|
||||
index_freq1 = np.where(np.asarray(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]) ==
|
||||
data.columns[0])[0][0]
|
||||
stg.frequencies_for_calibration.clear()
|
||||
|
|
@ -1654,11 +1491,9 @@ class SedimentCalibrationTab(QWidget):
|
|||
|
||||
self.label_freq2.clear()
|
||||
self.label_freq2.setText(data.columns[1])
|
||||
print("index freq2 ",
|
||||
np.where(np.asarray(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]) == data.columns[1]))
|
||||
|
||||
index_freq2 = np.where(np.asarray(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]) ==
|
||||
data.columns[1])[0][0]
|
||||
# stg.frequencies_for_calibration.clear()
|
||||
stg.frequencies_for_calibration.append((stg.freq[self.combobox_acoustic_data_choice.currentIndex()][
|
||||
index_freq2],
|
||||
index_freq2))
|
||||
|
|
@ -1667,77 +1502,52 @@ class SedimentCalibrationTab(QWidget):
|
|||
stg.frequency_for_inversion = (stg.freq[self.combobox_acoustic_data_choice.currentIndex()][index_freq2],
|
||||
index_freq2)
|
||||
|
||||
# self.spinbox_ks_freq1.clear()
|
||||
# self.spinbox_ks_freq1.setValue()
|
||||
self.lineEdit_ks_freq1.clear()
|
||||
self.lineEdit_ks_freq1.setText(str("%.5f" % float(data.iloc[0][0])))
|
||||
|
||||
# self.spinbox_ks_freq2.clear()
|
||||
# self.spinbox_ks_freq2.setValue(float(data.iloc[0][1]))
|
||||
self.lineEdit_ks_freq2.clear()
|
||||
self.lineEdit_ks_freq2.setText(str("%.5f" % float(data.iloc[0][1])))
|
||||
|
||||
stg.ks.clear()
|
||||
# stg.ks = [self.spinbox_ks_freq1.value(), self.spinbox_ks_freq2.value()]
|
||||
stg.ks = [float(self.lineEdit_ks_freq1.text()), float(self.lineEdit_ks_freq2.text())]
|
||||
|
||||
# self.spinbox_sv_freq1.clear()
|
||||
# self.spinbox_sv_freq1.setValue(float(data.iloc[1][0]))
|
||||
self.lineEdit_sv_freq1.clear()
|
||||
self.lineEdit_sv_freq1.setText(str("%.5f" % float(data.iloc[1][0])))
|
||||
|
||||
# self.spinbox_sv_freq2.clear()
|
||||
# self.spinbox_sv_freq2.setValue(float(data.iloc[1][1]))
|
||||
self.lineEdit_sv_freq2.clear()
|
||||
self.lineEdit_sv_freq2.setText(str("%.5f" % float(data.iloc[1][1])))
|
||||
|
||||
stg.sv.clear()
|
||||
# stg.sv = [self.spinbox_sv_freq1.value(), self.spinbox_sv_freq2.value()]
|
||||
stg.sv = [float(self.lineEdit_sv_freq1.text()), float(self.lineEdit_sv_freq2.text())]
|
||||
|
||||
# self.spinbox_X.clear()
|
||||
# self.spinbox_X.setValue(float(data.iloc[2][0]))
|
||||
self.lineEdit_X.clear()
|
||||
self.lineEdit_X.setText(str("%.2f" % float(data.iloc[2][0])))
|
||||
|
||||
stg.X_exponent.clear()
|
||||
# stg.X_exponent.append(self.spinbox_X.value())
|
||||
stg.X_exponent.append(float(self.lineEdit_X.text()))
|
||||
|
||||
# self.spinbox_alphas_freq1.clear()
|
||||
# self.spinbox_alphas_freq1.setValue(float(data.iloc[3][0]))
|
||||
self.lineEdit_alphas_freq1.clear()
|
||||
self.lineEdit_alphas_freq1.setText(str("%.5f" % float(data.iloc[3][0])))
|
||||
|
||||
# self.spinbox_alphas_freq2.clear()
|
||||
# self.spinbox_alphas_freq2.setValue(float(data.iloc[3][1]))
|
||||
self.lineEdit_alphas_freq2.clear()
|
||||
self.lineEdit_alphas_freq2.setText(str("%.5f" % float(data.iloc[3][1])))
|
||||
|
||||
stg.alpha_s.clear()
|
||||
# stg.alpha_s = [self.spinbox_alphas_freq1.value(), self.spinbox_alphas_freq2.value()]
|
||||
stg.alpha_s = [float(self.lineEdit_alphas_freq1.text()), float(self.lineEdit_alphas_freq2.text())]
|
||||
|
||||
# self.spinbox_zeta_freq1.clear()
|
||||
# self.spinbox_zeta_freq1.setValue(float(data.iloc[4][0]))
|
||||
self.lineEdit_zeta_freq1.clear()
|
||||
self.lineEdit_zeta_freq1.setText(str("%.5f" % float(data.iloc[4][0])))
|
||||
|
||||
# self.spinbox_zeta_freq2.clear()
|
||||
# self.spinbox_zeta_freq2.setValue(float(data.iloc[4][1]))
|
||||
self.lineEdit_zeta_freq2.clear()
|
||||
self.lineEdit_zeta_freq2.setText(str("%.5f" % float(data.iloc[4][1])))
|
||||
|
||||
stg.zeta.clear()
|
||||
# stg.zeta = [self.spinbox_zeta_freq1.value(), self.spinbox_zeta_freq2.value()]
|
||||
stg.zeta = [float(self.lineEdit_zeta_freq1.text()), float(self.lineEdit_zeta_freq2.text())]
|
||||
|
||||
# self.compute_depth_2D()
|
||||
self.compute_kt2D_kt3D()
|
||||
self.compute_J_cross_section()
|
||||
|
||||
def compute_depth_2D(self):
|
||||
print("self.combobox_acoustic_data_choice.count() ", self.combobox_acoustic_data_choice.count())
|
||||
if self.combobox_acoustic_data_choice.count() > 0:
|
||||
|
||||
for k in range(self.combobox_acoustic_data_choice.count()):
|
||||
|
|
@ -1805,9 +1615,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
stg.time[k].shape[1],
|
||||
axis=1))
|
||||
|
||||
print("stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()].shape ",
|
||||
stg.depth_2D[self.combobox_acoustic_data_choice.currentIndex()].shape)
|
||||
|
||||
def function_pushbutton_compute_calibration(self):
|
||||
|
||||
self.label_temperature.clear()
|
||||
|
|
@ -1846,13 +1653,9 @@ class SedimentCalibrationTab(QWidget):
|
|||
print(f"ks for frequency of {stg.freq[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex()]} : {ks_freq1} m/kg^0.5 \n")
|
||||
print(f"ks for frequency of {stg.freq[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex()]} : {ks_freq2} m/kg^0.5")
|
||||
|
||||
# self.spinbox_ks_freq1.clear()
|
||||
# self.spinbox_ks_freq1.setValue(ks_freq1)
|
||||
self.lineEdit_ks_freq1.clear()
|
||||
self.lineEdit_ks_freq1.setText(str("%.5f" % ks_freq1))
|
||||
|
||||
# self.spinbox_ks_freq2.clear()
|
||||
# self.spinbox_ks_freq2.setValue(ks_freq2)
|
||||
self.lineEdit_ks_freq2.clear()
|
||||
self.lineEdit_ks_freq2.setText(str("%.5f" % ks_freq2))
|
||||
|
||||
|
|
@ -1867,13 +1670,9 @@ class SedimentCalibrationTab(QWidget):
|
|||
print(f"sv for frequency of {stg.freq[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq1.currentIndex()]} : {sv_freq1:.8f} /m \n")
|
||||
print(f"sv for frequency of {stg.freq[self.combobox_acoustic_data_choice.currentIndex()][self.combobox_freq2.currentIndex()]} : {sv_freq2:.8f} /m")
|
||||
|
||||
# self.spinbox_sv_freq1.clear()
|
||||
# self.spinbox_sv_freq1.setValue(sv_freq1)
|
||||
self.lineEdit_sv_freq1.clear()
|
||||
self.lineEdit_sv_freq1.setText(str("%.5f" % sv_freq1))
|
||||
|
||||
# self.spinbox_sv_freq2.clear()
|
||||
# self.spinbox_sv_freq2.setValue(sv_freq2)
|
||||
self.lineEdit_sv_freq2.clear()
|
||||
self.lineEdit_sv_freq2.setText(str("%.5f" % sv_freq2))
|
||||
|
||||
|
|
@ -1889,8 +1688,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
|
||||
print(f"Exponent X = {X_exponent:.2f}\n")
|
||||
|
||||
# self.spinbox_X.clear()
|
||||
# self.spinbox_X.setValue(X_exponent)
|
||||
self.lineEdit_X.setText(str("%.2f" % X_exponent))
|
||||
|
||||
def compute_kt2D_kt3D(self):
|
||||
|
|
@ -1957,25 +1754,16 @@ class SedimentCalibrationTab(QWidget):
|
|||
stg.kt2D[i] = np.repeat(np.array([stg.kt_read]).transpose(), stg.time[i].shape[1], axis=1)
|
||||
stg.kt3D[i] = np.repeat(stg.kt2D[i][:, np.newaxis, :], stg.depth[i].shape[1], axis=1)
|
||||
|
||||
print('kt2D ', stg.kt2D)
|
||||
print('kt3D ', stg.kt3D)
|
||||
|
||||
def compute_J_cross_section(self):
|
||||
|
||||
for i in range(self.combobox_acoustic_data_choice.count()):
|
||||
|
||||
print('kt2D shape ', stg.kt2D[i].shape)
|
||||
print('kt3D shape ', stg.kt3D[i].shape)
|
||||
|
||||
J_cross_section_freq1 = np.array([])
|
||||
J_cross_section_freq2 = np.array([])
|
||||
|
||||
# --- Compute J ---
|
||||
if stg.BS_stream_bed_pre_process_average[i].shape != (0,):
|
||||
print("000000000000000000000000000000000")
|
||||
print(stg.BS_stream_bed_pre_process_average[i][stg.frequencies_for_calibration[0][1], :, :].shape,
|
||||
stg.depth_2D[i][stg.frequencies_for_calibration[0][1], :, :].shape,
|
||||
stg.kt3D[i][stg.frequencies_for_calibration[0][1], :, :].shape)
|
||||
|
||||
J_cross_section_freq1 = self.inv_hc.j_cross_section(
|
||||
BS=stg.BS_stream_bed_pre_process_average[i][
|
||||
stg.frequencies_for_calibration[0][1], :, :],
|
||||
|
|
@ -2110,9 +1898,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
stg.J_cross_section[i][0] = J_cross_section_freq1
|
||||
stg.J_cross_section[i][1] = J_cross_section_freq2
|
||||
|
||||
print(f"J_cross_section {str(i)} freq1 shape ", J_cross_section_freq1.shape, J_cross_section[i][0].shape)
|
||||
print(f"J_cross_section {str(i)} freq2 shape ", J_cross_section_freq2.shape, J_cross_section[i][1].shape)
|
||||
|
||||
def compute_alpha_s(self):
|
||||
|
||||
# --- Compute alpha_s ---
|
||||
|
|
@ -2161,13 +1946,9 @@ class SedimentCalibrationTab(QWidget):
|
|||
print(f"\u03B1s for frequency of freq1 : {alpha_s_freq1:.2f} /m \n")
|
||||
print(f"\u03B1s for frequency of freq2 : {alpha_s_freq2:.2f} /m")
|
||||
|
||||
# self.spinbox_alphas_freq1.clear()
|
||||
# self.spinbox_alphas_freq1.setValue(alpha_s_freq1)
|
||||
self.lineEdit_alphas_freq1.clear()
|
||||
self.lineEdit_alphas_freq1.setText(str("%.5f" % alpha_s_freq1))
|
||||
|
||||
# self.spinbox_alphas_freq2.clear()
|
||||
# self.spinbox_alphas_freq2.setValue(alpha_s_freq2)
|
||||
self.lineEdit_alphas_freq2.clear()
|
||||
self.lineEdit_alphas_freq2.setText(str("%.5f" % alpha_s_freq2))
|
||||
|
||||
|
|
@ -2229,13 +2010,9 @@ class SedimentCalibrationTab(QWidget):
|
|||
print(f"\u03B6 for frequency of freq1 : {zeta_freq1:.3f} /m \n")
|
||||
print(f"\u03B6 for frequency of freq2 : {zeta_freq2:.3f} /m")
|
||||
|
||||
# self.spinbox_zeta_freq1.clear()
|
||||
# self.spinbox_zeta_freq1.setValue(zeta_freq1)
|
||||
self.lineEdit_zeta_freq1.clear()
|
||||
self.lineEdit_zeta_freq1.setText(str("%.5f" % zeta_freq1))
|
||||
|
||||
# self.spinbox_zeta_freq2.clear()
|
||||
# self.spinbox_zeta_freq2.setValue(zeta_freq2)
|
||||
self.lineEdit_zeta_freq2.clear()
|
||||
self.lineEdit_zeta_freq2.setText(str("%.5f" % zeta_freq2))
|
||||
|
||||
|
|
@ -2248,8 +2025,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
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)
|
||||
|
||||
print("dir_save_cal ", dir_save_cal)
|
||||
|
||||
if dir_save_cal:
|
||||
|
||||
stg.path_calibration_file = path.dirname(dir_save_cal)
|
||||
|
|
@ -2289,12 +2064,10 @@ class SedimentCalibrationTab(QWidget):
|
|||
aquascat_cell_size = []
|
||||
tau = []
|
||||
real_cell_size = []
|
||||
# stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()] = (
|
||||
# np.zeros(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape))
|
||||
|
||||
stg.depth_real = np.zeros(stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape)
|
||||
|
||||
for f in range(stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0]):
|
||||
print("f = ", f)
|
||||
# defaut Aquascat cell size
|
||||
aquascat_cell_size.append(
|
||||
stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, 1] -
|
||||
|
|
@ -2303,27 +2076,19 @@ class SedimentCalibrationTab(QWidget):
|
|||
# Pulse duration
|
||||
tau.append(aquascat_cell_size[f] * 2 / 1500) # figure 2.9 1500 vitesse du son entrée pour le paramètrage des mesures aquascat
|
||||
|
||||
print(stg.water_velocity)
|
||||
print(tau)
|
||||
# Real cell size
|
||||
real_cell_size.append(stg.water_velocity * tau[f] / 2) # voir fig 2.9
|
||||
|
||||
# Converting to real cell profile
|
||||
# stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()][f, :] = \
|
||||
# (stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :] /
|
||||
# aquascat_cell_size[f] * real_cell_size[f]) # (/ aquascat_cell_size) pour ramener BS.r entre 0 et 1
|
||||
stg.depth_real[f, :] = (stg.depth_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :]
|
||||
/ aquascat_cell_size[f] * real_cell_size[f])
|
||||
print("stg.depth_real ", stg.depth_real)
|
||||
# (* real_cell_size) pour remettre les échelles spatiales sur la taille réelle des cellules
|
||||
|
||||
else:
|
||||
|
||||
aquascat_cell_size = []
|
||||
tau = []
|
||||
real_cell_size = []
|
||||
# stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()] = (
|
||||
# np.zeros(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape))
|
||||
|
||||
stg.depth_real = (np.zeros(stg.depth[self.combobox_acoustic_data_choice.currentIndex()].shape))
|
||||
|
||||
for f in range(stg.freq[self.combobox_acoustic_data_choice.currentIndex()].shape[0]):
|
||||
|
|
@ -2340,57 +2105,23 @@ class SedimentCalibrationTab(QWidget):
|
|||
real_cell_size.append(stg.water_velocity * tau[f] / 2) # voir fig 2.9
|
||||
|
||||
# Converting to real cell profile
|
||||
# stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()][f, :] = \
|
||||
# (stg.depth[self.combobox_acoustic_data_choice.currentIndex()][f, :] /
|
||||
# aquascat_cell_size[f] * real_cell_size[f]) # (/ aquascat_cell_size) pour ramener BS.r entre 0 et 1
|
||||
# # (* real_cell_size) pour remettre les échelles spatiales sur la taille réelle des cellules
|
||||
|
||||
stg.depth_real[f, :] = (stg.depth[self.combobox_acoustic_data_choice.currentIndex()][f, :] /
|
||||
aquascat_cell_size[f] * real_cell_size[f])
|
||||
|
||||
print("R_real 2D ", stg.depth_real.shape)
|
||||
|
||||
if stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
|
||||
# stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()] = (
|
||||
# np.repeat(stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()][:, :, np.newaxis],
|
||||
# stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1], axis=2))
|
||||
stg.depth_real = \
|
||||
(np.repeat(stg.depth_real[:, :, np.newaxis],
|
||||
stg.time_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape[1], axis=2))
|
||||
|
||||
print("R_real 3D ", stg.depth_real.shape)
|
||||
|
||||
else:
|
||||
|
||||
# stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()] = (
|
||||
# np.repeat(stg.depth_real[self.combobox_acoustic_data_choice.currentIndex()][:, :, np.newaxis],
|
||||
# stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1], axis=2))
|
||||
stg.depth_real = (
|
||||
np.repeat(stg.depth_real[:, :, np.newaxis],
|
||||
stg.time[self.combobox_acoustic_data_choice.currentIndex()].shape[1], axis=2))
|
||||
|
||||
print("R_real 3D ", stg.depth_real.shape)
|
||||
|
||||
def compute_FCB(self):
|
||||
# if stg.BS_stream_bed.size == 0:
|
||||
# msgBox = QMessageBox()
|
||||
# msgBox.setWindowTitle("FCB Error")
|
||||
# msgBox.setIcon(QMessageBox.Warning)
|
||||
# msgBox.setText("Load Backscatter data from acoustic data tab and compute water attenuation")
|
||||
# msgBox.setStandardButtons(QMessageBox.Ok)
|
||||
# msgBox.exec()
|
||||
# else:
|
||||
|
||||
# R_real = np.repeat(self.range_cells_function()[:, :, np.newaxis], stg.t.shape[1], axis=2)
|
||||
# if (stg.BS_stream_bed_pre_process_average.size == 0) and (stg.BS_stream_bed_pre_process_SNR.size == 0):
|
||||
# stg.FCB = (np.log(stg.BS_stream_bed) + np.log(R_real) +
|
||||
# 2 * stg.water_attenuation * R_real)
|
||||
# elif stg.BS_stream_bed_pre_process_SNR.size == 0:
|
||||
# stg.FCB = (np.log(stg.BS_stream_bed_pre_process_average) + np.log(R_real) +
|
||||
# 2 * stg.water_attenuation * R_real)
|
||||
# else:
|
||||
# stg.FCB = (np.log(stg.BS_stream_bed_pre_process_SNR) + np.log(R_real) +
|
||||
# 2 * stg.water_attenuation * R_real)
|
||||
|
||||
self.combobox_frequency_FCB.clear()
|
||||
self.combobox_frequency_FCB.addItems(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()])
|
||||
|
|
@ -2417,13 +2148,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
|
||||
elif stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
|
||||
print("zzzzzzzzzzzzzzzzzzzzz")
|
||||
print(np.log(stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()]).shape)
|
||||
print(np.log(stg.depth_real).shape)
|
||||
print(stg.water_attenuation)
|
||||
print(stg.depth_real.shape)
|
||||
print("zzzzzzzzzzzzzzzzzzzzz")
|
||||
|
||||
stg.FCB = \
|
||||
(np.log(stg.BS_stream_bed[self.combobox_acoustic_data_choice.currentIndex()]) +
|
||||
np.log(stg.depth_real) +
|
||||
|
|
@ -2451,13 +2175,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
|
||||
elif stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape != (0,):
|
||||
|
||||
print("ttttttttttttttttttttttttt")
|
||||
print(stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()].shape)
|
||||
print(stg.depth_real.shape)
|
||||
print(stg.water_attenuation[self.combobox_acoustic_data_choice.currentIndex()])
|
||||
print(stg.depth_real.shape)
|
||||
print("ttttttttttttttttttttttttt")
|
||||
|
||||
stg.FCB = \
|
||||
(np.log(stg.BS_cross_section[self.combobox_acoustic_data_choice.currentIndex()]) +
|
||||
np.log(stg.depth_real) +
|
||||
|
|
@ -2492,10 +2209,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.combobox_frequency_FCB.currentIndex()] *
|
||||
stg.depth_real)
|
||||
|
||||
print("FCB shape", stg.FCB.shape)
|
||||
print("FCB ", stg.FCB)
|
||||
|
||||
|
||||
self.plot_FCB()
|
||||
|
||||
def plot_FCB(self):
|
||||
|
|
@ -2547,10 +2260,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
horizontalalignment='right', verticalalignment='bottom',
|
||||
transform=self.axis_FCB.transAxes)
|
||||
|
||||
# if len(stg.lin_reg) != 0:
|
||||
# self.axis_FCB_profile[self.combobox_frequency_compute_alphaS.currentIndex()]. \
|
||||
# plot(stg.r[f, :], stg.lin_reg[0]*stg.r[f, :] + stg.lin_reg[1], linestyle="dashed", linewidth=1, color="b")
|
||||
|
||||
self.fig_FCB.supxlabel("Depth (m)")
|
||||
self.fig_FCB.supylabel("FCB")
|
||||
self.fig_FCB.canvas.draw_idle()
|
||||
|
|
@ -2660,15 +2369,11 @@ class SedimentCalibrationTab(QWidget):
|
|||
np.min(np.round(np.abs(x - float(self.lineEdit_FCB_from.text().replace(',','.'))), 2)))[0][0]
|
||||
value2 = np.where(np.round(np.abs(x - float(self.lineEdit_FCB_to.text().replace(',', '.'))), 2) ==
|
||||
np.min(np.round(np.abs(x - float(self.lineEdit_FCB_to.text().replace(',', '.'))), 2)))[0][0]
|
||||
print("value1 ", value1)
|
||||
print("value2 ", value2)
|
||||
|
||||
lin_reg_compute = linregress(x[value1:value2], y[value1:value2])
|
||||
print("lin_reg_compute ", lin_reg_compute)
|
||||
|
||||
stg.lin_reg.clear()
|
||||
stg.lin_reg = [lin_reg_compute.slope, lin_reg_compute.intercept]
|
||||
print("stg.lin_reg ", stg.lin_reg)
|
||||
|
||||
# --- Plot result of linear regression ---
|
||||
self.axis_FCB.plot(
|
||||
|
|
@ -2692,11 +2397,8 @@ class SedimentCalibrationTab(QWidget):
|
|||
np.min(np.round(np.abs(x - float(self.lineEdit_FCB_from.text().replace(',','.'))), 2)))[0][0]
|
||||
value2 = np.where(np.round(np.abs(x - float(self.lineEdit_FCB_to.text().replace(',', '.'))), 2) ==
|
||||
np.min(np.round(np.abs(x - float(self.lineEdit_FCB_to.text().replace(',', '.'))), 2)))[0][0]
|
||||
print("value1 ", value1)
|
||||
print("value2 ", value2)
|
||||
|
||||
lin_reg_compute = linregress(x[value1:value2], y[value1:value2])
|
||||
print("lin_reg_compute ", lin_reg_compute)
|
||||
|
||||
stg.lin_reg.clear()
|
||||
stg.lin_reg = [lin_reg_compute.slope, lin_reg_compute.intercept]
|
||||
|
|
@ -2717,69 +2419,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
self.label_alphaS_FCB.clear()
|
||||
self.label_alphaS_FCB.setText(f"α<sub>s</sub> = {-0.5*stg.lin_reg[0]:.4f} dB/m")
|
||||
|
||||
# if stg.FCB.size == 0:
|
||||
# msgBox = QMessageBox()
|
||||
# msgBox.setWindowTitle("Linear regression error")
|
||||
# msgBox.setIcon(QMessageBox.Warning)
|
||||
# msgBox.setText("Please compute FCB before")
|
||||
# msgBox.setStandardButtons(QMessageBox.Ok)
|
||||
# msgBox.exec()
|
||||
# else:
|
||||
# try:
|
||||
# y0 = stg.FCB[self.combobox_frequency_compute_alphaS.currentIndex(), :, self.slider.value()]
|
||||
# y = y0[np.where(np.isnan(y0) == False)]
|
||||
#
|
||||
# x0 = stg.r[0, :].reshape(-1)
|
||||
# x = x0[np.where(np.isnan(y0) == False)]
|
||||
#
|
||||
# value1 = np.where(np.round(np.abs(x - self.spinbox_alphaS_computation_from.value()), 2)
|
||||
# == np.min(np.round(np.abs(x - self.spinbox_alphaS_computation_from.value()), 2)))
|
||||
# value2 = np.where(np.round(np.abs(x - self.spinbox_alphaS_computation_to.value()), 2)
|
||||
# == np.min(np.round(np.abs(x - self.spinbox_alphaS_computation_to.value()), 2)))
|
||||
#
|
||||
# # print(np.round(np.abs(x - self.spinbox_alphaS_computation_from.value()), 2))
|
||||
# # # print("value1 ", value1[0][0])
|
||||
# # print(np.round(np.abs(x - self.spinbox_alphaS_computation_to.value()), 2))
|
||||
# # print("value2 ", value2[0][0])
|
||||
#
|
||||
# # print("y limited ", y[value1[0][0]:value2[0][0]])
|
||||
#
|
||||
# lin_reg_compute = stats.linregress(x[value1[0][0]:value2[0][0]], y[value1[0][0]:value2[0][0]])
|
||||
# except ValueError:
|
||||
# msgBox = QMessageBox()
|
||||
# msgBox.setWindowTitle("Linear regression error")
|
||||
# msgBox.setIcon(QMessageBox.Warning)
|
||||
# msgBox.setText("Please check boundaries to fit a linear line")
|
||||
# msgBox.setStandardButtons(QMessageBox.Ok)
|
||||
# msgBox.exec()
|
||||
# else:
|
||||
# stg.lin_reg = (lin_reg_compute.slope, lin_reg_compute.intercept)
|
||||
# # print(f"y = {stg.lin_reg[0]}x + {stg.lin_reg[1]}")
|
||||
#
|
||||
# self.label_alphaS.clear()
|
||||
# self.label_alphaS.setText(f"\u03B1s = {-0.5*stg.lin_reg[0]:.4f} dB/m")
|
||||
#
|
||||
# # for i, value_freq in enumerate(stg.freq):
|
||||
# # for k, value_t in enumerate(stg.t):
|
||||
# # # print(f"indice i: {i}, indice k: {k}")
|
||||
# # # print(f"values of FCB: {stg.FCB[:, i, k]}")
|
||||
# # y = stg.FCB[:, i, k]
|
||||
# # # print("y : ", y)
|
||||
# # # print(f"values of FCB where FCB is not Nan {y[np.where(np.isnan(y) == False)]}")
|
||||
# # # print(f"values of r where FCB is not Nan {x[np.where(np.isnan(y) == False)]}")
|
||||
# # lin_reg_compute = stats.linregress(x[np.where(np.isnan(y) == False)], y[np.where(np.isnan(y) == False)])
|
||||
# # lin_reg_tuple = (lin_reg_compute.slope, lin_reg_compute.intercept)
|
||||
# # stg.lin_reg.append(lin_reg_tuple)
|
||||
#
|
||||
# # print(f"y = {lin_reg.slope}x + {lin_reg.intercept}")
|
||||
#
|
||||
# # plt.figure()
|
||||
# # plt.plot(stg.r, stg.FCB[:, 0, 825], 'k-', stg.r, lin_reg.slope*stg.r + lin_reg.intercept, "b--")
|
||||
# # plt.show()
|
||||
#
|
||||
# # print("lin_reg length ", len(stg.lin_reg))
|
||||
# # print("lin_reg ", stg.lin_reg)
|
||||
|
||||
def slider_profile_number_to_begin_FCB(self):
|
||||
self.slider_FCB.setValue(int(self.slider_FCB.minimum()))
|
||||
self.update_lineEdit_by_moving_slider_FCB()
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,41 @@
|
|||
astropy==6.1.7
|
||||
astropy-iers-data==0.2025.3.3.0.34.45
|
||||
contourpy==1.0.7
|
||||
cycler==0.11.0
|
||||
defusedxml==0.7.1
|
||||
et-xmlfile==1.1.0
|
||||
fonttools==4.38.0
|
||||
importlib-resources==5.12.0
|
||||
joblib==1.2.0
|
||||
kiwisolver==1.4.4
|
||||
llvmlite==0.39.1
|
||||
matplotlib==3.6.3
|
||||
numba==0.56.4
|
||||
numpy==1.23.5
|
||||
odfpy==1.4.1
|
||||
openpyxl==3.0.10
|
||||
packaging==23.0
|
||||
pandas==1.5.3
|
||||
Pillow==9.4.0
|
||||
profilehooks==1.12.0
|
||||
pyerfa==2.0.1.5
|
||||
pyparsing==3.0.9
|
||||
pyqt-checkbox-table-widget==0.0.14
|
||||
pyqt-file-list-widget==0.0.1
|
||||
pyqt-files-already-exists-dialog==0.0.1
|
||||
pyqt-tooltip-list-widget==0.0.1
|
||||
PyQt5==5.15.9
|
||||
PyQt5-Qt5==5.15.2
|
||||
PyQt5-sip==12.11.0
|
||||
python-dateutil==2.8.2
|
||||
pytz==2022.7.1
|
||||
PyYAML==6.0.2
|
||||
scikit-learn==1.2.1
|
||||
scipy==1.10.0
|
||||
simplePyQt5==0.0.1
|
||||
six==1.16.0
|
||||
threadpoolctl==3.1.0
|
||||
utm==0.7.0
|
||||
xlrd==2.0.1
|
||||
xmltodict==0.13.0
|
||||
zipp==3.15.0
|
||||
Loading…
Reference in New Issue