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.
parent
426c68c880
commit
0e4899da9c
|
|
@ -20,11 +20,20 @@ class AcousticDataLoader():
|
||||||
|
|
||||||
self._data_BS = RawAquascatData(self.path_BS_raw_data)
|
self._data_BS = RawAquascatData(self.path_BS_raw_data)
|
||||||
|
|
||||||
self._BS_raw_data = self._data_BS.V
|
self._BS_raw_data = np.swapaxes(self._data_BS.V, 0, 1)
|
||||||
self._r = self._data_BS.r
|
print(f"BS raw data shape = {self._BS_raw_data.shape}")
|
||||||
|
|
||||||
self._freq = self._data_BS.Freq
|
self._freq = self._data_BS.Freq
|
||||||
|
print(f"freq shape = {self._freq.shape}")
|
||||||
self._freq_text = self._data_BS.freqText
|
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._date = self._data_BS.date.date()
|
||||||
self._hour = self._data_BS.date.time()
|
self._hour = self._data_BS.date.time()
|
||||||
|
|
@ -65,19 +74,25 @@ class AcousticDataLoader():
|
||||||
# plt.show()
|
# plt.show()
|
||||||
|
|
||||||
# print(self.reshape_BS_raw_cross_section()[0, 0])
|
# print(self.reshape_BS_raw_cross_section()[0, 0])
|
||||||
|
# self.reshape_BS_raw_cross_section()
|
||||||
# self.reshape_r()
|
# self.reshape_r()
|
||||||
# self.reshape_t()
|
# self.reshape_t()
|
||||||
|
|
||||||
def reshape_BS_raw_cross_section(self):
|
def reshape_BS_raw_cross_section(self):
|
||||||
BS_raw_cross_section = np.reshape(self._BS_raw_data,
|
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")
|
order="F")
|
||||||
|
print(BS_raw_cross_section.shape)
|
||||||
return BS_raw_cross_section
|
return BS_raw_cross_section
|
||||||
|
|
||||||
def reshape_r(self):
|
def reshape_r(self):
|
||||||
r = np.reshape(np.repeat(self._r, self._time.shape[0], axis=1),
|
# r = np.reshape(np.repeat(self._r[0, :], self._time.shape[0], axis=1),
|
||||||
self._r.shape[0]*self._time.shape[0],
|
# self._r.shape[0]*self._time.shape[0],
|
||||||
order="F")
|
# 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
|
return r
|
||||||
|
|
||||||
def compute_r_2D(self):
|
def compute_r_2D(self):
|
||||||
|
|
@ -85,7 +100,11 @@ class AcousticDataLoader():
|
||||||
return r2D
|
return r2D
|
||||||
|
|
||||||
def reshape_t(self):
|
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
|
return t
|
||||||
|
|
||||||
# def concatenate_data(self):
|
# def concatenate_data(self):
|
||||||
|
|
|
||||||
|
|
@ -846,29 +846,29 @@ class AcousticDataTab(QWidget):
|
||||||
|
|
||||||
|
|
||||||
def fill_table(self):
|
def fill_table(self):
|
||||||
if self.combobox_ABS_system_choice.currentIndex() == 1:
|
# if self.combobox_ABS_system_choice.currentIndex() == 2:
|
||||||
if ((self.lineEdit_acoustic_file.text()) and (self.lineEdit_noise_file.text())):
|
# if ((self.lineEdit_acoustic_file.text()) and (self.lineEdit_noise_file.text())):
|
||||||
stg.DataFrame_acoustic = pd.DataFrame(
|
# stg.DataFrame_acoustic = pd.DataFrame(
|
||||||
np.concatenate((stg.time_reshape, stg.BS_raw_data_reshape, stg.snr_reshape), axis=1),
|
# np.concatenate((stg.time_reshape, stg.BS_raw_data_reshape, stg.snr_reshape), axis=1),
|
||||||
columns=list(map(str, ["Time"] + ["BS - " + f for f in stg.freq_text] +
|
# columns=list(map(str, ["Time"] + ["BS - " + f for f in stg.freq_text] +
|
||||||
["SNR - " + f for f in stg.freq_text])))
|
# ["SNR - " + f for f in stg.freq_text])))
|
||||||
self.tableModel = TableModel(stg.DataFrame_acoustic)
|
# self.tableModel = TableModel(stg.DataFrame_acoustic)
|
||||||
self.tableView.setModel(self.tableModel)
|
# self.tableView.setModel(self.tableModel)
|
||||||
elif self.lineEdit_acoustic_file.text():
|
# elif self.lineEdit_acoustic_file.text():
|
||||||
stg.DataFrame_acoustic = pd.DataFrame(
|
# stg.DataFrame_acoustic = pd.DataFrame(
|
||||||
np.concatenate((stg.time_reshape, stg.BS_raw_data_reshape), axis=1),
|
# np.concatenate((stg.time_reshape, stg.BS_raw_data_reshape), axis=1),
|
||||||
columns=list(map(str, ["Time"] + ["BS - " + f for f in stg.freq_text])))
|
# columns=list(map(str, ["Time"] + ["BS - " + f for f in stg.freq_text])))
|
||||||
self.tableModel = TableModel(stg.DataFrame_acoustic)
|
# self.tableModel = TableModel(stg.DataFrame_acoustic)
|
||||||
self.tableView.setModel(self.tableModel)
|
# self.tableView.setModel(self.tableModel)
|
||||||
else:
|
# else:
|
||||||
msgBox = QMessageBox()
|
# msgBox = QMessageBox()
|
||||||
msgBox.setWindowTitle("Fill table Error")
|
# msgBox.setWindowTitle("Fill table Error")
|
||||||
msgBox.setIcon(QMessageBox.Warning)
|
# msgBox.setIcon(QMessageBox.Warning)
|
||||||
msgBox.setText("Download files before fill table")
|
# msgBox.setText("Download files before fill table")
|
||||||
msgBox.setStandardButtons(QMessageBox.Ok)
|
# msgBox.setStandardButtons(QMessageBox.Ok)
|
||||||
msgBox.exec()
|
# msgBox.exec()
|
||||||
|
|
||||||
elif self.combobox_ABS_system_choice.currentIndex() == 2:
|
# elif self.combobox_ABS_system_choice.currentIndex() == 1:
|
||||||
if ((self.lineEdit_acoustic_file.text()) and (self.lineEdit_noise_file.text())):
|
if ((self.lineEdit_acoustic_file.text()) and (self.lineEdit_noise_file.text())):
|
||||||
stg.DataFrame_acoustic = pd.DataFrame(
|
stg.DataFrame_acoustic = pd.DataFrame(
|
||||||
np.concatenate((stg.time_reshape, stg.BS_raw_data_reshape, stg.time_snr_reshape, stg.snr_reshape), axis=1),
|
np.concatenate((stg.time_reshape, stg.BS_raw_data_reshape, stg.time_snr_reshape, stg.snr_reshape), axis=1),
|
||||||
|
|
@ -978,7 +978,7 @@ class AcousticDataTab(QWidget):
|
||||||
print(f"tmax {stg.tmax}")
|
print(f"tmax {stg.tmax}")
|
||||||
|
|
||||||
pcm = self.axis_BS[f].pcolormesh(
|
pcm = self.axis_BS[f].pcolormesh(
|
||||||
stg.time[f, int(stg.tmin[f]):int(stg.tmax[f])], stg.r[f, :],
|
stg.time[f, int(stg.tmin[f]):int(stg.tmax[f])], -stg.r[f, :],
|
||||||
stg.BS_raw_data[f, :, int(stg.tmin[f]):int(stg.tmax[f])],
|
stg.BS_raw_data[f, :, int(stg.tmin[f]):int(stg.tmax[f])],
|
||||||
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
|
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
|
||||||
|
|
||||||
|
|
@ -1054,7 +1054,7 @@ class AcousticDataTab(QWidget):
|
||||||
|
|
||||||
# print("stg.t[f, :].shape ", stg.t[f])
|
# print("stg.t[f, :].shape ", stg.t[f])
|
||||||
# print("stg.r[f, :].shape ", stg.r[f, :])
|
# print("stg.r[f, :].shape ", stg.r[f, :])
|
||||||
pcm = self.axis_BS[f].pcolormesh(stg.t[f, :], stg.r[f, :], stg.BS_data[f, :, :],
|
pcm = self.axis_BS[f].pcolormesh(stg.t[f, :], -stg.r[f, :], stg.BS_data[f, :, :],
|
||||||
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
|
cmap='viridis', norm=LogNorm(vmin=val_min, vmax=val_max))
|
||||||
|
|
||||||
self.axis_BS[f].text(1, .70, stg.freq_text[f],
|
self.axis_BS[f].text(1, .70, stg.freq_text[f],
|
||||||
|
|
@ -1180,7 +1180,7 @@ class AcousticDataTab(QWidget):
|
||||||
# print(f"levels = {levels}")
|
# print(f"levels = {levels}")
|
||||||
# print(f"norm = {norm.boundaries}")
|
# print(f"norm = {norm.boundaries}")
|
||||||
|
|
||||||
cf = self.axis_SNR[f].contourf(x[f, :, :], y[f, :, :], stg.snr[f, :, :])#, levels, cmap='gist_rainbow', norm=norm)
|
cf = self.axis_SNR[f].contourf(x[f, :, :], -y[f, :, :], stg.snr[f, :, :])#, levels, cmap='gist_rainbow', norm=norm)
|
||||||
|
|
||||||
self.axis_SNR[f].text(1, .70, stg.freq_text[f],
|
self.axis_SNR[f].text(1, .70, stg.freq_text[f],
|
||||||
fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5,
|
fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5,
|
||||||
|
|
@ -1314,7 +1314,7 @@ class AcousticDataTab(QWidget):
|
||||||
# print(f"norm = {norm.boundaries}")
|
# print(f"norm = {norm.boundaries}")
|
||||||
|
|
||||||
cf = self.axis_SNR[f].contourf(x[f, :, int(stg.tmin_snr[f]):int(stg.tmax_snr[f])],
|
cf = self.axis_SNR[f].contourf(x[f, :, int(stg.tmin_snr[f]):int(stg.tmax_snr[f])],
|
||||||
y[f, :, int(stg.tmin_snr[f]):int(stg.tmax_snr[f])],
|
-y[f, :, int(stg.tmin_snr[f]):int(stg.tmax_snr[f])],
|
||||||
stg.snr[f, :, int(stg.tmin_snr[f]):int(stg.tmax_snr[f])]) # , levels, cmap='gist_rainbow', norm=norm)
|
stg.snr[f, :, int(stg.tmin_snr[f]):int(stg.tmax_snr[f])]) # , levels, cmap='gist_rainbow', norm=norm)
|
||||||
|
|
||||||
self.axis_SNR[f].text(1, .70, stg.freq_text[f],
|
self.axis_SNR[f].text(1, .70, stg.freq_text[f],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue