Aquascat Data Loader is updated with the Loader of Guillaume Froment (with Dexmes data). Save as and Open actions are added and connected to create_table_for_save_as.py and read_table_for_open.py. Data are saved in sqlite database. Four tables are created : File (acoustic_data (integer) and acoustic file), Measure (acoustic_data, frequencies, kt, nb_profiles, nb_cells and other measurement information), Settings (temperature, tmin, tmax, depth_min, depth_max) and BS_data (backscatter data with time, depth (list of 2D arrays) and BS_raw_data (list of 3D arrays)). 3D arrays are saved with binary (np.tobytes()) in one cell of table BS_data (BLOB type). They are then loaded with np.frombuffer() function.

dev-brahim
brahim 2024-04-22 10:56:10 +02:00
parent 75eeac0310
commit e08d769f79
7 changed files with 1986 additions and 219 deletions

File diff suppressed because it is too large Load Diff

View File

@ -103,7 +103,11 @@ class AcousticDataLoader:
# 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])
for j in range(self._time.shape[1]):
r[j*self._r.shape[1]:(j+1)*self._r.shape[1], i] = self._r[i, :]
# r[:, i] = np.repeat(self._r[i, :], self._time.shape[1])
print(r.shape)
return r

View File

@ -0,0 +1,328 @@
import numpy as np
from PyQt5.QtWidgets import QFileDialog, QApplication
import sqlite3
import settings as stg
from os import chdir
import time
class CreateTableForSaveAs():
def __init__(self):
self.create_AcousticFile = """CREATE TABLE File(
ID INTEGER PRIMARY KEY AUTOINCREMENT,
acoustic_data INTEGER,
acoustic_file STRING)"""
self.create_Measure = """ CREATE TABLE Measure(
ID INTEGER PRIMARY KEY AUTOINCREMENT,
acoustic_data INTEGER,
frequency FLOAT,
kt FLOAT,
NbProfiles INTEGER,
NbProfilesPerSeconds FLOAT,
NbCells INTEGER,
CellSize FLOAT,
PulseLength FLOAT,
NbPingsPerSeconds FLOAT,
NbPingsAveragedPerProfile FLOAT,
GainRx FLOAT,
GainTx FLOAT)
"""
# for i in stg.acoustic_data:
# exec("self.create_BSRawData_" + str(i) + " = '''CREATE TABLE BSRawData_" + str(i) +
# "(ID INTEGER PRIMARY KEY AUTOINCREMENT, " +
# "acoustic_data INTEGER, " +
# " ".join(["time_" + str(int(f)) + " FLOAT," for f in stg.freq[i][:-1]]) +
# ["time_" + str(int(stg.freq[i][-1]))][0] + " FLOAT" + ")''' ")
# for i in stg.acoustic_data:
# exec("self.create_BSRawData_" + str(i) + " = '''CREATE TABLE BSRawData_" + str(i) +
# "(ID INTEGER PRIMARY KEY AUTOINCREMENT, " +
# "acoustic_data INTEGER, " +
# " ".join(["time_" + str(int(f)) + " FLOAT," for f in stg.freq[i]]) +
# " ".join(["depth_" + str(int(f)) + " FLOAT," for f in stg.freq[i]]) +
# " ".join(["BS_raw_data_" + str(int(f)) + " FLOAT," for f in stg.freq[i][:-1]]) +
# ["BS_raw_data_" + str(int(stg.freq[i][-1]))][0] + " FLOAT" + ")''' ")
self.create_BSRawData = '''CREATE TABLE BSRawData(
ID INTEGER PRIMARY KEY AUTOINCREMENT,
acoustic_data INTEGER,
time BLOB,
depth BLOB,
BS_raw_data BLOB)'''
self.create_Settings = '''CREATE TABLE Settings(
ID INTEGER PRIMARY KEY AUTOINCREMENT,
acoustic_data INTEGER,
temperature FLOAT,
time_min_ind INTEGER,
time_min_val FLOAT,
time_max_ind INTEGER,
time_max_val FLOAT,
depth_min_ind INTEGER,
depth_min_val FLOAT,
depth_max_ind INTEGER,
depth_max_val FLOAT)'''
self.open_file_dialog()
start = time.time()
self.create_table()
print(f"end : {time.time() - start} sec")
def open_file_dialog(self):
options = QFileDialog.Options()
name = QFileDialog.getSaveFileName(
caption="Save As", directory="", filter="AcouSed Files (*.acd)", options=options)
if name:
stg.dirname_save_as = "/".join(name[0].split("/")[:-1]) + "/"
stg.filename_save_as = name[0].split("/")[-1]
chdir(stg.dirname_save_as)
# file = open(stg.filename_save_as, 'w')
# file.write(self.create_Measure)
# file.close()
def create_table(self):
# Create a new database and open a database connection to allow sqlite3 to work with it.
cnx = sqlite3.connect(stg.filename_save_as + '.acd')
# Create database cursor to execute SQL statements and fetch results from SQL queries.
cur = cnx.cursor()
# --------------------------------------------------------------------------------------------------------------
# --- Table File ---
start_table_File = time.time()
cur.execute("DROP TABLE if exists File")
cur.execute(self.create_AcousticFile)
for i in stg.acoustic_data:
query0 = (f"INSERT into File(acoustic_data, acoustic_file)"
f"VALUES({stg.acoustic_data[i]}, {str(stg.filename_BS_raw_data[i]).split('.')[0]})")
cur.execute(query0)
cnx.commit()
print(f"table File : {time.time() - start_table_File} sec")
# --------------------------------------------------------------------------------------------------------------
# --- Table Measure ---
start_table_Measure = time.time()
# Drop Table if exists
cur.execute("DROP TABLE if exists Measure")
# Execute the CREATE TABLE statement
cur.execute(self.create_Measure)
# Fill the table Measure
for i in stg.acoustic_data:
for f, k, r, t in zip(stg.freq[i], stg.kt[i], stg.gain_rx[i], stg.gain_tx[i]):
query = (f"INSERT into Measure(acoustic_data, frequency, kt, NbProfiles, NbProfilesPerSeconds, "
f"NbCells, CellSize, PulseLength, NbPingsPerSeconds, "
f"NbPingsAveragedPerProfile, GainRx, GainTx) "
f"VALUES({i}, {f}, {k}, {stg.nb_profiles[i]}, {stg.nb_profiles_per_sec[i]}, "
f"{stg.nb_cells[i]}, {stg.cell_size[i]}, {stg.pulse_length[i]}, {stg.nb_pings_per_sec[i]}, "
f"{stg.nb_pings_averaged_per_profile[i]}, {r}, {t})")
cur.execute(query)
# Commit the transaction after executing INSERT.
cnx.commit()
print(f"table Measure : {time.time() - start_table_Measure} sec")
# --------------------------------------------------------------------------------------------------------------
# --- Table BSRawData_i ---
start_table_BSRawData = time.time()
cur.execute('DROP TABLE if exists BSRawData')
# # Drop Table BSRawData_i if exists
# for i in stg.acoustic_data:
# exec("cur.execute('DROP TABLE if exists BSRawData_" + str(i) + "')")
#
# # Execute the CREATE TABLE BSRawData_i statement
# for i in stg.acoustic_data:
# exec("cur.execute(self.create_BSRawData_" + str(i) + ")")
# Fill the table BSRawData_i
# # --- Fill table BSRawData_i with acoustic data integer ---
# for i in stg.acoustic_data:
# for j in range(stg.time_reshape[i].shape[0]):
# exec(f"query1 = ('''INSERT into BSRawData_" + str(i) + "(acoustic_data)" +
# f" VALUES({i}) ''') ")
#
# exec("cur.execute(query1)")
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# for i in stg.acoustic_data:
# , depth, BS_raw_data
cur.execute(self.create_BSRawData)
# homer = np.array([1, 2, 3, 4, 5])
# bart = np.array([6, 7, 8, 9, 10])
# lisa = np.array([11, 12, 13, 14, 15])
# marge = homer.tobytes()
# print("to string : ", homer.tostring())
# print("to bytes : ", homer.tobytes())
# query2 = f''' INSERT into BSRawData(acoustic_data, time) VALUES({0}, {marge}) '''
# cur.execute('''CREATE TABLE IF NOT EXISTS BSRawData(time BLOB)''')
for i in stg.acoustic_data:
# cur.execute(''' INSERT into BSRawData(acoustic_data, time, depth, BS_raw_data) VALUES(?, ?, ?, ?)''',
# (stg.acoustic_data[i], homer.tobytes(),
# bart.tobytes(), lisa.tobytes()))
cur.execute(''' INSERT into BSRawData(acoustic_data, time, depth, BS_raw_data, BS_cross_section)
VALUES(?, ?, ?, ?)''',
(stg.acoustic_data[i], stg.time[i].tobytes(),
stg.depth[i].tobytes(), stg.BS_raw_data[i].tobytes()))
# cur.execute(''' INSERT into BSRawData(time) VALUES(?)''', (marge,))
# query2 = f''' INSERT into BSRawData(acoustic_data, time) VALUES({0}, {stg.time[0][0, :].tobytes()}) ''' # , {stg.depth[i].tobytes()}, {stg.BS_raw_data[i].tobytes()}
# for j in range(stg.time_reshape[i].shape[0]):
#
# # print("query2 = ('''INSERT into BSRawData_" + str(i) + "(acoustic_data, " +
# # ", ".join(["time_" + str(int(f)) for f in stg.freq[i]]) + ", " +
# # ", ".join(["depth_" + str(int(f)) for f in stg.freq[i]]) + ")" +
# # f" VALUES" + str(eval("0, " +
# # ", ".join(["stg.time_reshape[" + str(i) + "][" + str(
# # j) + ", " + str(k) + "]" for k, _ in
# # enumerate(stg.freq[i])]) + ", " +
# # ", ".join(["stg.depth_reshape[" + str(i) + "][" + str(j) + ", " + str(k) + "]" for k, _ in enumerate(stg.freq[i])]))) + " ''' )")
#
# exec("query2 = ('''INSERT into BSRawData_" + str(i) + "(acoustic_data, " +
# ", ".join(["time_" + str(int(f)) for f in stg.freq[i]]) + ", " +
# ", ".join(["depth_" + str(int(f)) for f in stg.freq[i]]) + ", " +
# ", ".join(["BS_raw_data_" + str(int(f)) for f in stg.freq[i]]) + ")"
# f" VALUES" + str(eval(str(i) + ", " +
# ", ".join(["stg.time_reshape[" + str(i) + "][" + str(
# j) + ", " + str(k) + "]" for k, _ in
# enumerate(stg.freq[i])]) + ", " +
# ", ".join(["stg.depth_reshape[" + str(i) + "][" + str(
# j) + ", " + str(k) + "]" for k, _ in
# enumerate(stg.freq[i])]) + ", " +
# ", ".join(["stg.BS_raw_data_reshape[" + str(i) + "][" + str(
# j) + ", " + str(k) + "]" for k, _ in
# enumerate(stg.freq[i])]))) + " ''' )")
# cur.execute(query2)
# Commit the transaction after executing INSERT.
cnx.commit()
print(f"table BSRawData : {time.time() - start_table_BSRawData} sec")
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# # --- Fill table BSRawData_i with data stg.time_reshape ---
# for i in stg.acoustic_data:
# for j in range(stg.time_reshape[i].shape[0]):
#
# # print("query2 = ('''INSERT into BSRawData_" + str(i) + "(acoustic_data, " +
# # ", ".join(["time_" + str(int(f)) for f in stg.freq[i]]) + ")" +
# # f" VALUES" + str(eval("0, " + ", ".join(["stg.time_reshape[" + str(i) + "][" + str(j) + ", " + str(k) + "]" for k, _ in enumerate(stg.freq[i])]))) + " ''' )")
#
# exec("query2 = ('''INSERT into BSRawData_" + str(i) + "(acoustic_data, " +
# ", ".join(["time_" + str(int(f)) for f in stg.freq[i]]) + ")" +
# f" VALUES" + str(eval("0, " + ", ".join(["stg.time_reshape[" + str(i) + "][" + str(j) + ", " + str(k) + "]" for k, _ in enumerate(stg.freq[i])]))) + " ''' )")
#
# exec("cur.execute(query2)")
#
# # Commit the transaction after executing INSERT.
# cnx.commit()
#
# # --- Fill table BSRawData_i with data stg.depth_reshape ---
# for i in stg.acoustic_data:
# for f in stg.freq[i]:
# exec("query3 = ('''ALTER TABLE BSRawData_" + str(i) +
# " ADD " + ["depth_" + str(int(f)) + " FLOAT"][0] + " ''')")
#
# exec("cur.execute(query3)")
#
# # Commit the transaction after executing INSERT.
# cnx.commit()
#
# for i in stg.acoustic_data:
# for k, f in enumerate(stg.freq[i]):
# for j in range(stg.depth_reshape[i].shape[0]):
# exec("query4 = '''UPDATE BSRawData_" + str(i) +
# " SET " + ["depth_" + str(int(f))][0] + " = " +
# str(eval("stg.depth_reshape[" + str(i) + "][" + str(j) + ", " + str(k) + "]")) +
# " WHERE ID = " + str(j + 1) + " ''' ")
#
# exec("cur.execute(query4)")
# # --- Fill table BSRawData_i with data stg.BS_raw_data_reshape ---
# for i in stg.acoustic_data:
# for f in stg.freq[i]:
#
# exec("query5 = ('''ALTER TABLE BSRawData_" + str(i) +
# " ADD " + ["BS_raw_data_" + str(int(f)) + " FLOAT"][0] + " ''')")
#
# exec("cur.execute(query5)")
#
# # Commit the transaction after executing INSERT.
# cnx.commit()
#
# for i in stg.acoustic_data:
# for k, f in enumerate(stg.freq[i]):
# for j in range(stg.BS_raw_data_reshape[i].shape[0]):
#
# exec("query6 = '''UPDATE BSRawData_" + str(i) +
# " SET " + ["BS_raw_data_" + str(int(f))][0] + " = " +
# str(eval("stg.BS_raw_data_reshape[" + str(i) + "][" + str(j) + ", " + str(k) + "]")) +
# " WHERE ID = " + str(j+1) + " ''' ")
#
# exec("cur.execute(query6)")
#
# cnx.commit()
# --------------------------------------------------------------------------------------------------------------
# --- Table Settings ---
start_table_Settings = time.time()
cur.execute("DROP TABLE if exists Settings")
cur.execute(self.create_Settings)
print(stg.acoustic_data, stg.temperature, stg.rmin, stg.rmax, stg.tmin, stg.tmax)
for i in stg.acoustic_data:
query7 = (f'''INSERT into Settings(acoustic_data, temperature,
time_min_ind, time_min_val, time_max_ind, time_max_val,
depth_min_ind, depth_min_val, depth_max_ind, depth_max_val)
VALUES({stg.acoustic_data[i]},
{stg.temperature[i]},
{stg.tmin[i][0]},
{stg.tmin[i][1]},
{stg.tmax[i][0]},
{stg.tmax[i][1]},
{stg.rmin[i][0]},
{stg.rmin[i][1]},
{stg.rmax[i][0]},
{stg.rmax[i][1]})''')
cur.execute(query7)
cnx.commit()
print(f"table Settings : {time.time() - start_table_Settings} sec")
# Close database cursor
cur.close()
# Close database connection
cnx.close()

View File

@ -0,0 +1,157 @@
import numpy as np
from PyQt5.QtWidgets import QFileDialog, QApplication
import sqlite3
from os import path, chdir
import settings as stg
class ReadTableForOpen:
def __init__(self):
self.open_file_dialog()
chdir(stg.dirname_open)
self.sql_file_to_open = open(stg.filename_open)
self.read_table()
# self.reshape_variables()
def open_file_dialog(self):
name = QFileDialog.getOpenFileName(caption="Open Acoused file", directory="", filter="Acoused file (*.acd)")
if name:
stg.dirname_open = path.dirname(name[0])
stg.filename_open = path.basename(name[0])
def read_table(self):
# connexion to File db
cnx = sqlite3.connect(stg.filename_open)
# Create database cursor to execute SQL statements and fetch results from SQL queries.
cur = cnx.cursor()
query = '''SELECT acoustic_data, acoustic_file FROM File'''
data = cur.execute(query).fetchall()
stg.acoustic_data, stg.filename_BS_raw_data = [x[0] for x in data], [y[1] for y in data]
for i in stg.acoustic_data:
query1 = f'''SELECT frequency, kt, NbProfiles, NbProfilesPerSeconds, "
f"NbCells, CellSize, PulseLength, NbPingsPerSeconds, "
f"NbPingsAveragedPerProfile, GainRx, GainTx
FROM Measure WHERE (acoustic_data = {i})'''
data1 = cur.execute(query1).fetchall()
# print(data1)
# print([x[0] for x in data1])
stg.freq.append([x[0] for x in data1])
stg.kt.append([x[1] for x in data1])
stg.nb_profiles.append([x[2] for x in data1])
stg.nb_profiles_per_sec.append([x[3] for x in data1])
stg.nb_cells.append([x[4] for x in data1])
stg.cell_size.append([x[5] for x in data1])
stg.pulse_length.append([x[6] for x in data1])
stg.nb_pings_per_sec.append([x[7] for x in data1])
stg.nb_pings_averaged_per_profile.append([x[8] for x in data1])
stg.gain_rx.append([x[9] for x in data1])
stg.gain_tx.append([x[10] for x in data1])
# for f_ind, f_val in enumerate(stg.freq[i]):
#
# exec("query2 = '''SELECT time_" + str(int(f_val)) + ", depth_" + str(int(f_val)) + ", BS_raw_data_" + str(int(f_val)) +
# " FROM BSRawData_" + str(int(i)) + " WHERE (acoustic_data = " + str(i) + ") ''' ")
# exec("data2 = cur.execute(query2).fetchall()")
# # print(eval("data2"))
#
# if f_ind == 0:
# time_reshape_temp = np.array([[x[0] for x in eval("data2")]])
# # print("1 time_reshape_temp.shape ", time_reshape_temp.shape)
# depth_reshape_temp = np.array([[x[1] for x in eval("data2")]])
# BS_raw_data_reshape_temp = np.array([[x[2] for x in eval("data2")]])
# else:
# time_reshape_temp = np.insert(time_reshape_temp, f_ind, [x[0] for x in eval("data2")], axis=0)
# # print("2 time_reshape_temp.shape ", time_reshape_temp.shape)
# depth_reshape_temp = np.insert(depth_reshape_temp, f_ind, [x[1] for x in eval("data2")], axis=0)
# BS_raw_data_reshape_temp = np.insert(BS_raw_data_reshape_temp, f_ind, [x[1] for x in eval("data2")], axis=0)
#
# stg.time_reshape.append(time_reshape_temp.transpose())
# # print(len(stg.time_reshape))
# # print(stg.time_reshape[i].shape)
# stg.depth_reshape.append(depth_reshape_temp.transpose())
# stg.BS_raw_data_reshape.append(BS_raw_data_reshape_temp.transpose())
query2 = f'''SELECT acoustic_data, time, depth, BS_raw_data FROM BSRawData WHERE (acoustic_data = {i})'''
data2 = cur.execute(query2).fetchall()
print("len(data2) ", len(data2[0]))
# print("data2 : ", data2)
# data2_retreived = np.frombuffer(data2[0][1], dtype=np.float64)
# print("", data2_retreived)
stg.time.append(np.frombuffer(data2[0][1], dtype=np.float64).reshape((len(stg.freq[i]), -1)))
print(stg.time[0].shape)
print(stg.time)
stg.depth.append(np.frombuffer(data2[0][2], dtype=np.float64).reshape(len(stg.freq[i]), -1))
print(stg.depth[0].shape)
print(stg.depth)
stg.BS_raw_data.append(np.frombuffer(data2[0][3], dtype=np.float64))
# time_reshape_temp = np.insert(time_reshape_temp, time_reshape_temp.shape[0], [x[0] for x in eval("data2")], axis=0)
# stg.depth_reshape.append([x[2] for x in data2])
# stg.BS_raw_data_reshape.append([x[3] for x in data2])
# query = '''SELECT acoustic_file FROM File'''
# cur.execute(query)
# stg.acoustic_data = cur.fetchall()
# Close database cursor
cur.close()
# Close database connection
cnx.close()
def reshape_variables(self):
for i in stg.acoustic_data:
for f, _ in enumerate(stg.freq[i]):
if f == 0:
depth_temp = np.array([
stg.depth_reshape[i][np.where(stg.depth_reshape[i][:, f] == stg.depth_reshape[i][0, f])[0][0]:
np.where(stg.depth_reshape[i][:, f] == stg.depth_reshape[i][0, f])[0][1], f]
])
time_temp = np.array([
stg.time_reshape[i][
np.where(stg.depth_reshape[i][:, f] == stg.depth_reshape[i][0, f])[0], f]
])
else:
# print(np.where(stg.depth_reshape[i][:, f] == stg.depth_reshape[i][0, f]))
depth_temp = np.insert(depth_temp,
depth_temp.shape[0],
stg.depth_reshape[i][np.where(stg.depth_reshape[i][:, f] == stg.depth_reshape[i][0, f])[0][0]:
np.where(stg.depth_reshape[i][:, f] == stg.depth_reshape[i][0, f])[0][1], f],
axis=0)
time_temp = np.insert(time_temp,
time_temp.shape[0],
stg.time_reshape[i][
np.where(stg.depth_reshape[i][:, f] == stg.depth_reshape[i][0, f])[0], f],
axis=0)
stg.depth.append(depth_temp)
stg.time.append(time_temp)
stg.BS_raw_data.append(np.reshape(stg.BS_raw_data_reshape[i],
(len(stg.freq[i]), stg.depth[i].shape[1], stg.time[i].shape[1])))

View File

@ -337,13 +337,13 @@ class AcousticDataTab(QWidget):
# layout.addWidget(scroll)
self.label_temperature = QLabel("Temperature : ")
self.gridLayout_goupbox_info.addWidget(self.label_temperature, 0, 0, 1, 1)
# self.gridLayout_goupbox_info.addWidget(self.label_temperature, 0, 0, 1, 1)
# self.label_temperature.setAlignment(Qt.AlignLeft | Qt.AlignTop)
self.spinbox_temperature = QDoubleSpinBox()
self.gridLayout_goupbox_info.addWidget(self.spinbox_temperature, 0, 1, 1, 1)
self.label_degreCelsius = QLabel("°C")
self.gridLayout_goupbox_info.addWidget(self.label_degreCelsius, 0, 2, 1, 1)
self.spinbox_temperature.setSuffix("°C")
# self.gridLayout_goupbox_info.addWidget(self.spinbox_temperature, 0, 1, 1, 1)
# self.label_degreCelsius = QLabel("°C")
# self.gridLayout_goupbox_info.addWidget(self.label_degreCelsius, 0, 2, 1, 1)
# self.label_date_acoustic_file = QLabel()
# self.gridLayout_goupbox_info.addWidget(self.label_date_acoustic_file, 1, 0, 1, 2)
@ -1107,6 +1107,7 @@ class AcousticDataTab(QWidget):
self.label_date_acoustic_file.show()
self.label_hour_acoustic_file.show()
self.label_temperature.show()
self.label_profiles.show()
self.label_profiles_per_sec.show()
self.label_cells.show()
@ -1119,15 +1120,17 @@ class AcousticDataTab(QWidget):
self.label_rx.show()
self.label_tx.show()
self.gridLayout_goupbox_info.addWidget(self.label_date_acoustic_file, 1, 0, 1, 2)
self.gridLayout_goupbox_info.addWidget(self.label_hour_acoustic_file, 1, 1, 1, 1)
self.gridLayout_goupbox_info.addWidget(self.label_date_acoustic_file, 0, 0, 1, 2)
self.gridLayout_goupbox_info.addWidget(self.label_hour_acoustic_file, 0, 2, 1, 1)
self.gridLayout_goupbox_info.addWidget(self.label_temperature, 1, 0, 1, 1)
# self.gridLayout_goupbox_info.addWidget(self.spinbox_temperature, 1, 1, 1, 1)
self.gridLayout_goupbox_info.addWidget(self.label_profiles, 2, 0, 1, 1)
self.gridLayout_goupbox_info.addWidget(self.label_profiles_per_sec, 2, 1, 1, 1)
self.gridLayout_goupbox_info.addWidget(self.label_profiles_per_sec, 2, 2, 1, 1)
self.gridLayout_goupbox_info.addWidget(self.label_cells, 3, 0, 1, 1)
self.gridLayout_goupbox_info.addWidget(self.label_cell_size, 3, 1, 1, 1)
self.gridLayout_goupbox_info.addWidget(self.label_cell_size, 3, 2, 1, 1)
self.gridLayout_goupbox_info.addWidget(self.label_pulse_length, 4, 0, 1, 1)
self.gridLayout_goupbox_info.addWidget(self.label_pings_per_sec, 5, 0, 1, 1)
self.gridLayout_goupbox_info.addWidget(self.label_pings_per_profile, 5, 1, 1, 1)
self.gridLayout_goupbox_info.addWidget(self.label_pings_per_profile, 5, 2, 1, 1)
self.gridLayout_goupbox_info.addWidget(self.label_freq, 6, 0, 1, 2)
self.gridLayout_goupbox_info.addWidget(self.label_kt, 7, 0, 1, 2)
self.gridLayout_goupbox_info.addWidget(self.label_rx, 8, 0, 1, 2)
@ -1138,6 +1141,7 @@ class AcousticDataTab(QWidget):
self.label_date_acoustic_file.hide()
self.label_hour_acoustic_file.hide()
self.label_temperature.hide()
self.label_profiles.hide()
self.label_profiles_per_sec.hide()
self.label_cells.hide()
@ -1159,7 +1163,7 @@ class AcousticDataTab(QWidget):
self.gridLayout_goupbox_info.addWidget(self.label_freq, 0, 0, 1, 1)
def temperature_value(self):
stg.temperature = (self.spinbox_temperature.value())
stg.temperature[self.fileListWidget.currentRow()] = self.spinbox_temperature.value()
print(f"stg.temperature : {stg.temperature}")
def clicked_pushbutton_noise_level(self):
@ -1183,6 +1187,7 @@ class AcousticDataTab(QWidget):
"Aquascat file (*.aqa)")
dir_name = path.dirname(filename[0])
name = path.basename(filename[0])
print(f"dir name : {dir_name} & file name : {name}")
# print(dir_name, name)
elif self.combobox_ABS_system_choice.currentIndex() == 2:
filename = QFileDialog.getOpenFileName(self, "Open file", "", "UBSediFlow file (*.udt)")
@ -1203,9 +1208,11 @@ class AcousticDataTab(QWidget):
if self.fileListWidget.count() == 0:
stg.path_BS_raw_data = [dir_name]
stg.filename_BS_raw_data = [name]
print(f"0 dir name : {dir_name} & file name : {name}")
else:
stg.path_BS_raw_data.append(dir_name)
stg.filename_BS_raw_data.append(name)
print(f"1 dir name : {dir_name} & file name : {name}")
self.load_BS_acoustic_raw_data()
print("0 Lecture de la donnée BS")
except ValueError as e:
@ -1228,12 +1235,12 @@ class AcousticDataTab(QWidget):
print("1. Number of filenames in fileListWidget : ", self.fileListWidget.count())
# self.btnToggled()
self.fileListWidget.setToolTip(stg.path_BS_raw_data[-1])
self.label_date_acoustic_file.clear()
self.label_date_acoustic_file.setText(
_translate("CONSTANT_STRING", cs.DATE) + ": " + str(stg.date[self.fileListWidget.currentRow()]))
self.label_hour_acoustic_file.clear()
self.label_hour_acoustic_file.setText(
_translate("CONSTANT_STRING", cs.HOUR) + ": " + str(stg.hour[self.fileListWidget.currentRow()]))
# self.label_date_acoustic_file.clear()
# self.label_date_acoustic_file.setText(
# _translate("CONSTANT_STRING", cs.DATE) + ": " + str(stg.date[self.fileListWidget.currentRow()]))
# self.label_hour_acoustic_file.clear()
# self.label_hour_acoustic_file.setText(
# _translate("CONSTANT_STRING", cs.HOUR) + ": " + str(stg.hour[self.fileListWidget.currentRow()]))
self.fill_measurements_information_groupbox()
self.fill_table()
self.set_range_for_doubleRangeSlider_time()
@ -1246,6 +1253,10 @@ class AcousticDataTab(QWidget):
# self.combobox_frequency_profile.clear()
# self.combobox_frequency_profile.addItems([f for f in stg.freq_text[self.fileListWidget.currentRow()]])
stg.acoustic_data = list(range(self.fileListWidget.count()))
print("helloooooooo ", stg.acoustic_data)
# if self.sender().objectName() == "pushbutton_noise_file":
# print("--- 0. Je suis dans le push button noise file ---")
# try:
@ -1353,46 +1364,17 @@ class AcousticDataTab(QWidget):
self.slider.setMaximum(10)
def load_BS_acoustic_raw_data(self):
print("Je suis dans le load_BS_acoustic_raw_data")
if self.combobox_ABS_system_choice.currentIndex() == 1:
print("Je suis dans le load_BS_acoustic_raw_data - 1")
acoustic_data = AcousticDataLoader(stg.path_BS_raw_data[-1] + "/" + stg.filename_BS_raw_data[-1])
if self.fileListWidget.count() == 0:
stg.ABS_name = [self.combobox_ABS_system_choice.currentText()]
stg.BS_raw_data = [acoustic_data._BS_raw_data]
print("len(stg.BS_raw_data) ", len(stg.BS_raw_data))
print("stg.BS_raw_data[0].shape ", stg.BS_raw_data[0].shape)
stg.BS_raw_data_reshape = [acoustic_data.reshape_BS_raw_data()]
stg.depth = [acoustic_data._r]
stg.depth_2D = [acoustic_data.compute_r_2D()]
# stg.depth_reshape = [acoustic_data.reshape_r()]
stg.time = [acoustic_data._time]
stg.time_reshape = [acoustic_data.reshape_time()]
stg.freq = [acoustic_data._freq]
stg.freq_text = [acoustic_data._freq_text]
print("freq text ", stg.freq_text)
stg.date = [acoustic_data._date]
stg.hour = [acoustic_data._hour]
stg.nb_profiles = [acoustic_data._nb_profiles]
stg.nb_profiles_per_sec = [acoustic_data._nb_profiles_per_sec]
stg.nb_cells = [acoustic_data._nb_cells]
stg.cell_size = [acoustic_data._cell_size]
stg.pulse_length = [acoustic_data._cell_size]
stg.nb_pings_per_sec = [acoustic_data._nb_pings_per_sec]
stg.nb_pings_averaged_per_profile = [acoustic_data._nb_pings_averaged_per_profile]
stg.kt = [acoustic_data._kt]
stg.gain_rx = [acoustic_data._gain_rx]
stg.gain_tx = [acoustic_data._gain_tx]
else:
stg.ABS_name.append(self.combobox_ABS_system_choice.currentText())
stg.BS_raw_data.append(acoustic_data._BS_raw_data)
stg.BS_raw_data_reshape.append(acoustic_data.reshape_BS_raw_data())
stg.depth.append(acoustic_data._r)
stg.depth_2D.append(acoustic_data.compute_r_2D())
# stg.depth_reshape = [acoustic_data.reshape_r()]
stg.depth_reshape.append(acoustic_data.reshape_r())
stg.time.append(acoustic_data._time)
stg.time_reshape.append(acoustic_data.reshape_time())
stg.freq.append(acoustic_data._freq)
@ -1409,6 +1391,60 @@ class AcousticDataTab(QWidget):
stg.kt.append(acoustic_data._kt)
stg.gain_rx.append(acoustic_data._gain_rx)
stg.gain_tx.append(acoustic_data._gain_tx)
stg.temperature.append(self.spinbox_temperature.value())
# if self.fileListWidget.count() == 0:
#
# stg.ABS_name = [self.combobox_ABS_system_choice.currentText()]
# stg.BS_raw_data = [acoustic_data._BS_raw_data]
# # print("len(stg.BS_raw_data) ", len(stg.BS_raw_data))
# # print("stg.BS_raw_data[0].shape ", stg.BS_raw_data[0].shape)
# stg.BS_raw_data_reshape = [acoustic_data.reshape_BS_raw_data()]
# stg.depth = [acoustic_data._r]
# stg.depth_2D = [acoustic_data.compute_r_2D()]
# stg.depth_reshape = [acoustic_data.reshape_r()]
# stg.time = [acoustic_data._time]
# stg.time_reshape = [acoustic_data.reshape_time()]
# stg.freq = [acoustic_data._freq]
# stg.freq_text = [acoustic_data._freq_text]
# # print("freq text ", stg.freq_text)
# stg.date = [acoustic_data._date]
# stg.hour = [acoustic_data._hour]
# stg.nb_profiles = [acoustic_data._nb_profiles]
# stg.nb_profiles_per_sec = [acoustic_data._nb_profiles_per_sec]
# stg.nb_cells = [acoustic_data._nb_cells]
# stg.cell_size = [acoustic_data._cell_size]
# stg.pulse_length = [acoustic_data._cell_size]
# stg.nb_pings_per_sec = [acoustic_data._nb_pings_per_sec]
# stg.nb_pings_averaged_per_profile = [acoustic_data._nb_pings_averaged_per_profile]
# stg.kt = [acoustic_data._kt]
# stg.gain_rx = [acoustic_data._gain_rx]
# stg.gain_tx = [acoustic_data._gain_tx]
#
# else:
#
# stg.ABS_name.append(self.combobox_ABS_system_choice.currentText())
# stg.BS_raw_data.append(acoustic_data._BS_raw_data)
# stg.BS_raw_data_reshape.append(acoustic_data.reshape_BS_raw_data())
# stg.depth.append(acoustic_data._r)
# stg.depth_2D.append(acoustic_data.compute_r_2D())
# stg.depth_reshape.append(acoustic_data.reshape_r())
# stg.time.append(acoustic_data._time)
# stg.time_reshape.append(acoustic_data.reshape_time())
# stg.freq.append(acoustic_data._freq)
# stg.freq_text.append(acoustic_data._freq_text)
# stg.date.append(acoustic_data._date)
# stg.hour.append(acoustic_data._hour)
# stg.nb_profiles.append(acoustic_data._nb_profiles)
# stg.nb_profiles_per_sec.append(acoustic_data._nb_profiles_per_sec)
# stg.nb_cells.append(acoustic_data._nb_cells)
# stg.cell_size.append(acoustic_data._cell_size)
# stg.pulse_length.append(acoustic_data._cell_size)
# stg.nb_pings_per_sec.append(acoustic_data._nb_pings_per_sec)
# stg.nb_pings_averaged_per_profile.append(acoustic_data._nb_pings_averaged_per_profile)
# stg.kt.append(acoustic_data._kt)
# stg.gain_rx.append(acoustic_data._gain_rx)
# stg.gain_tx.append(acoustic_data._gain_tx)
elif self.combobox_ABS_system_choice.currentIndex() == 2:
@ -1481,31 +1517,74 @@ class AcousticDataTab(QWidget):
def fill_measurements_information_groupbox(self):
if self.combobox_ABS_system_choice.currentIndex() == 1:
self.label_profiles.setText(
_translate("CONSTANT_STRING", cs.NB_PROFILES) + ": " + str(stg.nb_profiles[self.fileListWidget.currentRow()]))
self.label_profiles_per_sec.setText(
_translate("CONSTANT_STRING", cs.NB_PROFILES_PER_SEC) + ": " +
str(stg.nb_profiles_per_sec[self.fileListWidget.currentRow()]) + " Hz")
# self.label_date_acoustic_file.setText(
# _translate("CONSTANT_STRING", cs.DATE) + ": " + str(stg.date[self.fileListWidget.currentRow()]))
# self.label_hour_acoustic_file.setText(
# _translate("CONSTANT_STRING", cs.HOUR) + ": " + str(stg.hour[self.fileListWidget.currentRow()]))
# self.label_profiles.setText(
# _translate("CONSTANT_STRING", cs.NB_PROFILES) + ": " + str(stg.nb_profiles[self.fileListWidget.currentRow()]))
# self.label_profiles_per_sec.setText(
# _translate("CONSTANT_STRING", cs.NB_PROFILES_PER_SEC) + ": " +
# str(stg.nb_profiles_per_sec[self.fileListWidget.currentRow()]) + " Hz")
# print("OL ", self.fileListWidget.currentRow())
self.label_freq.setText(
_translate("CONSTANT_STRING", cs.FREQUENCY) + ": " + ', '.join(stg.freq_text[self.fileListWidget.currentIndex().row()]))
self.label_cells.setText(
_translate("CONSTANT_STRING", cs.NB_CELLS) + ": " + str(stg.nb_cells[self.fileListWidget.currentRow()]))
self.label_cell_size.setText(
_translate("CONSTANT_STRING", cs.CELL_SIZE) + ": " + str(100*round(stg.cell_size[self.fileListWidget.currentRow()], 3)) + " cm")
self.label_pulse_length.setText(
_translate("CONSTANT_STRING", cs.PULSE_LENGHT) + ": " + str(round(stg.pulse_length[self.fileListWidget.currentRow()], 6)) + "sec")
self.label_pings_per_sec.setText(
_translate("CONSTANT_STRING", cs.NB_PINGS_PER_SEC) + ": " + str(stg.nb_pings_per_sec[self.fileListWidget.currentRow()]) + " Hz")
self.label_pings_per_profile.setText(
_translate("CONSTANT_STRING", cs.NB_PINGS_PER_PROFILE) + ": " +
str(stg.nb_pings_averaged_per_profile[self.fileListWidget.currentRow()]))
self.label_kt.setText(
_translate("CONSTANT_STRING", cs.KT) + ": " + ', '.join(map(str, stg.kt[self.fileListWidget.currentRow()])))
self.label_rx.setText(
_translate("CONSTANT_STRING", cs.GAIN_RX) + ": " + ', '.join(map(str, stg.gain_rx[self.fileListWidget.currentRow()])))
self.label_tx.setText(
_translate("CONSTANT_STRING", cs.GAIN_TX) + ": " + ', '.join(map(str, stg.gain_tx[self.fileListWidget.currentRow()])))
# self.label_freq.setText(
# _translate("CONSTANT_STRING", cs.FREQUENCY) + ": " + ', '.join(stg.freq_text[self.fileListWidget.currentIndex().row()]))
# self.label_cells.setText(
# _translate("CONSTANT_STRING", cs.NB_CELLS) + ": " + str(stg.nb_cells[self.fileListWidget.currentRow()]))
# self.label_cell_size.setText(
# _translate("CONSTANT_STRING", cs.CELL_SIZE) + ": " + str(100*round(stg.cell_size[self.fileListWidget.currentRow()], 3)) + " cm")
# self.label_pulse_length.setText(
# _translate("CONSTANT_STRING", cs.PULSE_LENGHT) + ": " + str(round(stg.pulse_length[self.fileListWidget.currentRow()], 6)) + "sec")
# self.label_pings_per_sec.setText(
# _translate("CONSTANT_STRING", cs.NB_PINGS_PER_SEC) + ": " + str(stg.nb_pings_per_sec[self.fileListWidget.currentRow()]) + " Hz")
# self.label_pings_per_profile.setText(
# _translate("CONSTANT_STRING", cs.NB_PINGS_PER_PROFILE) + ": " +
# str(stg.nb_pings_averaged_per_profile[self.fileListWidget.currentRow()]))
# self.label_kt.setText(
# _translate("CONSTANT_STRING", cs.KT) + ": " + ', '.join(map(str, stg.kt[self.fileListWidget.currentRow()])))
# self.label_rx.setText(
# _translate("CONSTANT_STRING", cs.GAIN_RX) + ": " + ', '.join(map(str, stg.gain_rx[self.fileListWidget.currentRow()])))
# self.label_tx.setText(
# _translate("CONSTANT_STRING", cs.GAIN_TX) + ": " + ', '.join(map(str, stg.gain_tx[self.fileListWidget.currentRow()])))
self.label_date_acoustic_file_value = QLabel(str(stg.date[self.fileListWidget.currentRow()]))
self.gridLayout_goupbox_info.addWidget(self.label_date_acoustic_file_value, 0, 1, 1, 1)
self.label_hour_acoustic_file_value = QLabel(str(stg.hour[self.fileListWidget.currentRow()]))
self.gridLayout_goupbox_info.addWidget(self.label_hour_acoustic_file_value, 0, 3, 1, 1)
self.label_profiles_value = QLabel(str(stg.nb_profiles[self.fileListWidget.currentRow()]))
self.gridLayout_goupbox_info.addWidget(self.label_profiles_value, 2, 1, 1, 1)
self.label_profiles_per_sec_value = QLabel(str(stg.nb_profiles_per_sec[self.fileListWidget.currentRow()]) + " Hz")
self.gridLayout_goupbox_info.addWidget(self.label_profiles_per_sec_value, 2, 3, 1, 1)
self.label_cells_value = QLabel(str(stg.nb_cells[self.fileListWidget.currentRow()]))
self.gridLayout_goupbox_info.addWidget(self.label_cells_value, 3, 1, 1, 1)
self.label_cell_size_value = QLabel(str(100*round(stg.cell_size[self.fileListWidget.currentRow()], 3)) + " cm")
self.gridLayout_goupbox_info.addWidget(self.label_cell_size_value, 3, 3, 1, 1)
self.label_pulse_length_value = QLabel(str(round(stg.pulse_length[self.fileListWidget.currentRow()], 6)) + " sec")
self.gridLayout_goupbox_info.addWidget(self.label_pulse_length_value, 4, 1, 1, 1)
self.label_pings_per_sec_value = QLabel(str(stg.nb_pings_per_sec[self.fileListWidget.currentRow()]) + " Hz")
self.gridLayout_goupbox_info.addWidget(self.label_pings_per_sec_value, 5, 1, 1, 1)
self.label_pings_per_profile_value = QLabel(str(stg.nb_pings_averaged_per_profile[self.fileListWidget.currentRow()]))
self.gridLayout_goupbox_info.addWidget(self.label_pings_per_profile_value, 5, 3, 1, 1)
# for find, fval in enumerate(stg.freq[self.fileListWidget.currentRow()]):
# print(f"find {find} fval {fval}")
# exec(f"self.spinbox_freq_" + str(int(fval)) + " = QDoubleSpinBox()")
# exec(f"self.spinbox_freq_" + str(int(fval)) + ".setSuffix('Hz')")
# exec(f"self.spinbox_freq_" + str(int(fval)) + ".setValue(" + str(fval) + ")")
# exec(f"self.gridLayout_goupbox_info.addWidget(self.spinbox_freq_" + str(int(fval)) + ", 6, " + str(find+1) + ", 1, 1)")
# self.gridLayout_goupbox_info.addWidget(stg.freq_text[self.fileListWidget.currentIndex().row()])
# self.gridLayout_goupbox_info.addWidget(', '.join(map(str, stg.kt[self.fileListWidget.currentRow()])))
# self.gridLayout_goupbox_info.addWidget(', '.join(map(str, stg.gain_rx[self.fileListWidget.currentRow()])))
# self.gridLayout_goupbox_info.addWidget(', '.join(map(str, stg.gain_tx[self.fileListWidget.currentRow()])))
self.spinbox_kt = QDoubleSpinBox()
elif self.combobox_ABS_system_choice.currentIndex() == 2:
@ -1519,13 +1598,17 @@ class AcousticDataTab(QWidget):
header_list = []
for freq_ind, freq_value in enumerate(stg.freq_text[0]):
header_list.append("Time - " + freq_value)
header_list.append("Depth - " + freq_value)
header_list.append("BS - " + freq_value)
if freq_ind == 0:
table_data = np.vstack((stg.time_reshape[0][:, freq_ind], stg.BS_raw_data_reshape[0][:, freq_ind]))
table_data = np.vstack((np.vstack((stg.time_reshape[0][:, freq_ind],
stg.depth_reshape[0][:, freq_ind])),
stg.BS_raw_data_reshape[0][:, freq_ind]))
else:
table_data = np.vstack((table_data,
np.vstack((stg.time_reshape[0][:, freq_ind],
np.vstack((np.vstack((stg.time_reshape[0][:, freq_ind],
stg.depth_reshape[0][:, freq_ind])),
stg.BS_raw_data_reshape[0][:, freq_ind]))
))
@ -1540,14 +1623,18 @@ class AcousticDataTab(QWidget):
header_list.clear()
for freq_ind, freq_value in enumerate(stg.freq_text[0]):
header_list.append("Time - " + freq_value)
header_list.append("Depth - " + freq_value)
header_list.append("BS - " + freq_value)
if freq_ind == 0:
table_data = np.vstack((stg.time_reshape[self.fileListWidget.currentRow()][:, freq_ind],
table_data = np.vstack((np.vstack((stg.time_reshape[self.fileListWidget.currentRow()][:, freq_ind],
stg.depth_reshape[self.fileListWidget.currentRow()][:, freq_ind])),
stg.BS_raw_data_reshape[self.fileListWidget.currentRow()][:, freq_ind]))
else:
table_data = np.vstack((table_data,
np.vstack((stg.time_reshape[self.fileListWidget.currentRow()][:, freq_ind],
np.vstack((np.vstack((stg.time_reshape[self.fileListWidget.currentRow()][:, freq_ind],
stg.depth_reshape[self.fileListWidget.currentRow()][:, freq_ind])),
stg.BS_raw_data_reshape[self.fileListWidget.currentRow()][:, freq_ind]))
))
@ -1998,7 +2085,7 @@ class AcousticDataTab(QWidget):
np.log(stg.BS_raw_data[self.fileListWidget.currentRow()][f, :, :]),
# np.log(stg.BS_raw_data[self.fileListWidget.currentRow()][f, :, int(stg.tmin[self.fileListWidget.currentRow()]):int(stg.tmax[self.fileListWidget.currentRow()])]),
cmap='Blues')
pcm.draw_idle()
self.axis_BS[f].text(1, .70, stg.freq_text[self.fileListWidget.currentRow()][f],
fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5,
horizontalalignment='right', verticalalignment='bottom',
@ -2212,6 +2299,8 @@ class AcousticDataTab(QWidget):
# --- Plot river bottom line ---
if (len(stg.depth_bottom) != 0) and (len(stg.depth_bottom) == self.fileListWidget.count()):
print("stg.depth_bottom ", stg.depth_bottom)
print("len(stg.depth_bottom) ", len(stg.depth_bottom))
self.axis_BS[f].plot(stg.t_cross_section[self.fileListWidget.currentRow()][self.combobox_frequency_bathymetry.currentIndex(), :],
-stg.depth_bottom[self.fileListWidget.currentRow()],
color='black', linewidth=1, linestyle="solid")
@ -2263,7 +2352,7 @@ class AcousticDataTab(QWidget):
# self.axis_profile.cla()
self.axis_profile.plot(stg.BS_cross_section[self.fileListWidget.currentRow()][
self.combobox_frequency_profile.currentIndex(), :, self.slider.value() - 1],
-stg.depth[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex(), :],
-stg.depth_cross_section[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex(), :],
linestyle='solid', color='k', linewidth=1)
self.axis_profile.text(.95, .05, stg.freq_text[self.fileListWidget.currentRow()][self.combobox_frequency_profile.currentIndex()],
fontsize=10, fontweight='bold', fontname="Ubuntu",

View File

@ -2,13 +2,16 @@
# Form implementation generated from reading ui file 'mainwindow.ui'
#
# Created by: PyQt5 UI code generator 5.15.6
# Created by: PyQt5 UI code generator 5.15.9
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets
from Model.create_table_for_save_as import CreateTableForSaveAs
from Model.read_table_for_open import ReadTableForOpen
from View.about_window import AboutWindow
class Ui_MainWindow(object):
@ -31,6 +34,7 @@ class Ui_MainWindow(object):
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()
@ -48,6 +52,9 @@ class Ui_MainWindow(object):
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)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
@ -60,9 +67,13 @@ class Ui_MainWindow(object):
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")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
@ -71,71 +82,69 @@ class Ui_MainWindow(object):
self.toolBar.setObjectName("toolBar")
MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
self.actionNew = QtWidgets.QAction(MainWindow)
# Rajouter par moi
path = "/home/bmoudjed/Documents/3 SSC acoustic meas project/Graphical interface project/" \
"graphical_interface_for_SSC_acoustic_meas/icons/"
# Re verifier tout les icones QPixmap
icon = QtGui.QIcon()
# icon.addPixmap(QtGui.QPixmap("../icons/new.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon.addPixmap(QtGui.QPixmap(path + "new.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
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(MainWindow)
icon1 = QtGui.QIcon()
# icon1.addPixmap(QtGui.QPixmap("../icons/icon_folder.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon1.addPixmap(QtGui.QPixmap(path + "icon_folder.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
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(MainWindow)
icon2 = QtGui.QIcon()
# icon2.addPixmap(QtGui.QPixmap("../icons/save.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon2.addPixmap(QtGui.QPixmap(path + "save.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
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(MainWindow)
icon3 = QtGui.QIcon()
# icon3.addPixmap(QtGui.QPixmap("../icons/copy.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon3.addPixmap(QtGui.QPixmap(path + "copy.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
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(MainWindow)
icon4 = QtGui.QIcon()
# icon4.addPixmap(QtGui.QPixmap("../icons/cut.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon4.addPixmap(QtGui.QPixmap(path + "cut.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
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(MainWindow)
icon5 = QtGui.QIcon()
# icon5.addPixmap(QtGui.QPixmap("../icons/paste.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon5.addPixmap(QtGui.QPixmap(path + "paste.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
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(MainWindow)
icon6 = QtGui.QIcon()
# icon6.addPixmap(QtGui.QPixmap("../icons/en.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon6.addPixmap(QtGui.QPixmap(path + "en.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
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(MainWindow)
icon7 = QtGui.QIcon()
# icon7.addPixmap(QtGui.QPixmap("../icons/fr.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon7.addPixmap(QtGui.QPixmap(path + "fr.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon7.addPixmap(QtGui.QPixmap("icons/fr.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.actionFrench.setIcon(icon7)
self.actionFrench.setObjectName("actionFrench")
self.actionTable_of_Backscatter_values = QtWidgets.QAction(MainWindow)
self.actionTable_of_Backscatter_values.setObjectName("actionTable_of_Backscatter_values")
self.actionSave_As = QtWidgets.QAction(MainWindow)
self.actionSave_As.setObjectName("actionSave_As")
self.actionAbout = QtWidgets.QAction(MainWindow)
self.actionAbout.setObjectName("actionAbout")
self.actionDB_Browser_for_SQLite = QtWidgets.QAction(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.menuFile.addAction(self.actionNew)
self.menuExport.addAction(self.actionTable_of_Backscatter_values)
self.menuFile.addAction(self.actionOpen)
self.menuFile.addAction(self.actionSave)
self.menuFile.addAction(self.actionSave_As)
self.menuFile.addSeparator()
self.menuFile.addAction(self.menuSettings.menuAction())
self.menuTools.addAction(self.actionCopy)
self.menuTools.addAction(self.actionCut)
self.menuTools.addAction(self.actionPaste)
self.menuFile.addSeparator()
self.menuFile.addAction(self.menuExport.menuAction())
self.menuTools.addAction(self.actionDB_Browser_for_SQLite)
self.menuHelp.addAction(self.actionAbout)
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)
@ -151,35 +160,82 @@ class Ui_MainWindow(object):
self.tabWidget.setCurrentIndex(0)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
# --- Connect Action Save As ---
self.actionSave_As.triggered.connect(self.save_as)
# --- Connect Action Open ---
self.actionOpen.triggered.connect(self.open)
# --- Connect Action DB_Browser_for_SQLite ---
self.actionDB_Browser_for_SQLite.triggered.connect(self.db_browser_for_sqlite)
# --- Connect Action About ---
self.actionAbout.triggered.connect(self.about_window)
def save_as(self):
CreateTableForSaveAs()
def open(self):
ReadTableForOpen()
def db_browser_for_sqlite(self):
import argparse
import sys
parser = argparse.ArgumentParser()
print(parser)
print(sys.argv[:])
parser.parse_args()
def about_window(self):
print("about")
AboutWindow()
# w.show()
# self.main_window = QtWidgets.QMainWindow()
# self.window = AboutWindow(mainWindow=self.main_window)
# self.main_window.show()
# import sys
# new_app = QtWidgets.QApplication(sys.argv)
# w = AboutWindow()
# w.show()
# sys.exit(new_app.exec_())
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab1), _translate("MainWindow", "Acoustic data"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab2), _translate("MainWindow", "Signal processing"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab2), _translate("MainWindow", "Signal preprocessing"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab3), _translate("MainWindow", "Sample data"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab4), _translate("MainWindow", "Acoustic inversion"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab5), _translate("MainWindow", "Note"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab6), _translate("MainWindow", "User manual"))
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"))
self.menuExport.setTitle(_translate("MainWindow", "Export"))
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.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"))
self.actionSave_As.setText(_translate("MainWindow", "Save As ..."))
self.actionAbout.setText(_translate("MainWindow", "About"))
self.actionDB_Browser_for_SQLite.setText(_translate("MainWindow", "DB Browser for SQLite"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())
# if __name__ == "__main__":
# import sys
# app = QtWidgets.QApplication(sys.argv)
# MainWindow = QtWidgets.QMainWindow()
# ui = Ui_MainWindow()
# ui.setupUi(MainWindow)
# MainWindow.show()
# sys.exit(app.exec_())

View File

@ -12,7 +12,7 @@ path_BS_raw_data = []
filename_BS_raw_data = []
BS_raw_data = [] # BS raw data : all measurement (go and back)
depth = []
r_2D = []
depth_2D = []
freq = []
freq_text = []
time = []
@ -43,7 +43,7 @@ time_snr = np.array([])
# --- reshape raw data for table of values in Acoustic Data tab ---
time_reshape = []
time_snr_reshape = np.array([])
r_reshape = []
depth_reshape = []
BS_raw_data_reshape = []
SNR_reshape = np.array([]) # snr is reshape to be included in table of values in acoustic data tab
DataFrame_acoustic = pd.DataFrame()
@ -130,7 +130,7 @@ Ctot_sand_per_cent = np.array([])
# --- Acoustic inversion method ---
temperature = 0
temperature = []
water_attenuation = np.array([])
water_velocity = 0
@ -156,6 +156,14 @@ alpha_s = 0
SSC_fine = np.array(())
SSC_sand = np.array([])
# --- Save study ---
acoustic_data = []
dirname_save_as = ""
filename_save_as = ""
dirname_open = ""
filename_open = ""