Corrected a mistake in a comment of the constructor of the 'AcousticDataLoaderUBSediFlow' class. There was also a problem with the order of the BS data displayed in the 'Table of values' table of the 'Acoustic data' tab. The problem has been fixed by rewriting completely the 'reshape_BS_raw_data' method.

dev-bjvincent-fix-UBSediFlow
Bjarne Vincent 2025-10-21 11:22:16 +02:00
parent 127dcde098
commit 5e6f2e0d69
1 changed files with 43 additions and 5 deletions

View File

@ -206,8 +206,8 @@ class AcousticDataLoaderUBSediFlow:
self._nb_profiles[k] += 1
# Finally, form the 2D arrays for each frequency and store them in 3D NumPy arrays:
# Finally, store the 2D arrays for each frequency in 3D NumPy arrays:
self._BS_raw_data[k,:,:] = bs_list[k]
self._time[k,:] = time_list[k]
self._r[k,:] = r_list[k]
@ -215,10 +215,48 @@ class AcousticDataLoaderUBSediFlow:
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")
'''
Form and return a table from the raw BS (backscatter) data loaded into AcouSed. That table
is the one to be displayed in the "Table of values" section of the "Acoustic data" tab.
The table is a L*K NumPy array, where 'K' stands for the number of frequencies in the
loaded dataset, and L = R*T with 'R' the number of vertical coordinates and 'T' the number
of time stamps.
Finally, the BS array is flattened (i.e., converted to a 1D array) for each frequency so that
the index spanning the vertical coordinates runs the fastest i.e.
Line 0 : BS data at (t, r) = (t_0, r_0)
Line 1 : BS data at (t, r) = (t_0, r_1)
Line 2 : BS data at (t, r) = (t_0, r_2)
...
Line R : BS data at (t, r) = (t_0, r_R)
Line R+1: BS data at (t, r) = (t_1, r_0)
Line R+2: BS data at (t, r) = (t_1, r_1)
...
'''
# Create and initialise the returned 2D array. Note:
# R = self._r.shape[1] = self._BS_raw_data.shape[1]
# T = self._time.shape[1] = self._BS_raw_data.shape[2]
# K = len(self._freq)
BS_raw_cross_section = np.zeros( ( self._r.shape[1] * self._time.shape[1], len(self._freq) ) )
# Fill the k-th column of 'BS_raw_cross_section' with the BS data recorded with the k-th frequency:
for k in range( len(self._freq) ):
BS_raw_cross_section[:, k] = np.reshape( self._BS_raw_data[k,:,:],
self._BS_raw_data.shape[1] * self._BS_raw_data.shape[2],
order = "F" )
return BS_raw_cross_section
def reshape_r(self):
r = np.zeros((self._r.shape[1]*self._time.shape[1], len(self._freq)))