460 lines
24 KiB
Python
460 lines
24 KiB
Python
from Model.AquascatDataLoader import RawAquascatData
|
|
|
|
import numpy as np
|
|
import pandas as pd
|
|
import datetime
|
|
import matplotlib.pyplot as plt
|
|
from matplotlib.colors import LogNorm, BoundaryNorm
|
|
|
|
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/")
|
|
|
|
# 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 ---
|
|
|
|
# Extraction function:
|
|
|
|
device_name, time_begin, time_end, param_us_dicts, data_us_dicts, data_dicts, settings_dict \
|
|
= raw_extract(self.path_BS_raw_data)
|
|
|
|
# --- 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 = date_and_time.date()
|
|
print(f"date : {self._date}")
|
|
self._hour = date_and_time.time()
|
|
print(f"time : {self._hour}")
|
|
|
|
self._freq = np.array([[]])
|
|
self._r = np.array([[]])
|
|
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[1][1])
|
|
# print(data_us_dicts[config][channel]['echo_avg_profile'])
|
|
|
|
# --- Frequencies ---
|
|
self._freq = np.append(self._freq, param_us_dicts[config][channel]['f0'])
|
|
|
|
# --- Depth for each frequencies ---
|
|
depth = [param_us_dicts[config][channel]['r_cell1'] * i
|
|
for i in list(range(param_us_dicts[config][channel]['n_cell']))]
|
|
if self._r.shape[1] == 0:
|
|
self._r = np.array([depth])
|
|
else:
|
|
self._r = np.append(self._r, [depth], axis=0)
|
|
|
|
# --- BS Time for each frequencies ---
|
|
time = [[(t - data_us_dicts[config][channel]['echo_avg_profile']['time'][0]).total_seconds()
|
|
for t in data_us_dicts[config][channel]['echo_avg_profile']['time']]]
|
|
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}")
|
|
|
|
# --- 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 + 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)
|
|
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("BS_data shape ", BS_data.shape)
|
|
|
|
self._BS_raw_data = np.array([BS_data[:self._time.shape[1], :].transpose()])
|
|
|
|
print("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("BS_data shape ", BS_data.shape)
|
|
|
|
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)
|
|
|
|
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)
|
|
else:
|
|
self._BS_raw_data = np.append(self._BS_raw_data, np.array([BS_data.transpose()]), axis=0)
|
|
|
|
|
|
print("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]]
|
|
elif self._time.shape[1] < self._BS_raw_data.shape[2]:
|
|
self._BS_raw_data = self._BS_raw_data[:, :, :self._time.shape[1]]
|
|
else:
|
|
self._time = self._time
|
|
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("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='Blues')#, 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, :], self._r[f, :], np.log(self._BS_raw_data[f, :, :]),
|
|
# cmap='viridis', 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()
|
|
|
|
# --- 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()
|
|
|
|
# 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_cross_section(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.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 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)
|
|
|
|
|