Aquascat data are adapted to UBSediFlow data. The 3D array backscatter acoustic signal is reshaped into frequency shape * depth shape * time shape. Depth and time arrays are transformed into 2D arrays: each line corresponds to a frequency. As the Aquascat data have the same depth and time values for all frequencies, we simply repeat the same line.

This commit is contained in:
brahim committed 2023-10-13 11:05:37 +02:00
1 parent 426c68c880
commit 0e4899da9c
2 files changed
+75 -56

No files matched your search

+27 -8
View File
@@ -20,11 +20,20 @@ class AcousticDataLoader():
self._data_BS = RawAquascatData(self.path_BS_raw_data)
self._BS_raw_data = self._data_BS.V
self._r = self._data_BS.r
self._BS_raw_data = np.swapaxes(self._data_BS.V, 0, 1)
print(f"BS raw data shape = {self._BS_raw_data.shape}")
self._freq = self._data_BS.Freq
print(f"freq shape = {self._freq.shape}")
self._freq_text = self._data_BS.freqText
self._time = np.array([t / self._data_BS.PingRate for t in range(self._data_BS.NumProfiles)])
self._r = np.repeat(np.transpose(self._data_BS.r), self._freq.shape[0], axis=0)
print(f"r shape = {self._r.shape}")
self._time = np.repeat(
np.transpose(np.array([t / self._data_BS.PingRate for t in range(self._data_BS.NumProfiles)])[:, np.newaxis]),
self._freq.shape[0], axis=0)
print(f"time shape = {self._time.shape}")
self._date = self._data_BS.date.date()
self._hour = self._data_BS.date.time()
@@ -65,19 +74,25 @@ class AcousticDataLoader():
# plt.show()
# print(self.reshape_BS_raw_cross_section()[0, 0])
# self.reshape_BS_raw_cross_section()
# self.reshape_r()
# self.reshape_t()
def reshape_BS_raw_cross_section(self):
BS_raw_cross_section = np.reshape(self._BS_raw_data,
(self._r.shape[0]*len(self._time), self._freq.shape[0]),
(self._r.shape[1] * self._time.shape[1], self._freq.shape[0]),
order="F")
print(BS_raw_cross_section.shape)
return BS_raw_cross_section
def reshape_r(self):
r = np.reshape(np.repeat(self._r, self._time.shape[0], axis=1),
self._r.shape[0]*self._time.shape[0],
order="F")
# r = np.reshape(np.repeat(self._r[0, :], self._time.shape[0], axis=1),
# self._r.shape[0]*self._time.shape[0],
# order="F")
r = np.zeros((self._r.shape[1] * self._time.shape[1], self._freq.shape[0]))
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):
@@ -85,7 +100,11 @@ class AcousticDataLoader():
return r2D
def reshape_t(self):
t = np.reshape(np.repeat(self._time, self._r.shape[0]), (self._time.shape[0]*self._r.shape[0], 1))
# t = np.reshape(np.repeat(self._time, self._r.shape[0]), (self._time.shape[0]*self._r.shape[0], 1))
t = np.zeros((self._r.shape[1] * self._time.shape[1], self._freq.shape[0]))
for i, _ in enumerate(self._freq):
t[:, i] = np.repeat(self._time[i, :], self._r.shape[1])
print(t.shape)
return t
# def concatenate_data(self):