Compare commits
No commits in common. "74137405fc3a5299cc4923b7963b58b8b630812e" and "5d3ae961b2ca9d13c5136939324d8016b4c18dbc" have entirely different histories.
74137405fc
...
5d3ae961b2
|
|
@ -81,7 +81,7 @@ class CreateTableForSaveAs:
|
|||
time_reshape BLOB, depth_reshape BLOB, BS_raw_data_reshape BLOB,
|
||||
time_cross_section BLOB, depth_cross_section BLOB,
|
||||
BS_cross_section BLOB, BS_stream_bed BLO B,
|
||||
depth_bottom BLOB, val_bottom BLOB, ind_bottom BLOB,
|
||||
depth_bottom, val_bottom, ind_bottom,
|
||||
time_noise BLOB, depth_noise BLOB, BS_noise_raw_data BLOB,
|
||||
SNR_raw_data BLOB, SNR_cross_section BLOB, SNR_stream_bed BLOB,
|
||||
BS_raw_data_pre_process_SNR BLOB,
|
||||
|
|
|
|||
|
|
@ -60,534 +60,384 @@ class ReadTableForOpen:
|
|||
except OSError as e:
|
||||
logger.warning(f"chdir: {str(e)}")
|
||||
|
||||
self.sql_file_to_open = open(stg.filename_open)
|
||||
self.read_table()
|
||||
self.opened = True
|
||||
|
||||
|
||||
def execute(self, query):
|
||||
return self._cur.execute(query).fetchall()
|
||||
|
||||
def read_table(self):
|
||||
|
||||
stg.read_table_trigger = 1
|
||||
|
||||
logger.debug(f"Open '{stg.filename_open}'")
|
||||
|
||||
# connexion to File db
|
||||
cnx = sqlite3.connect(stg.filename_open)
|
||||
self._cur = cnx.cursor()
|
||||
|
||||
self.read_table_acoustic_file()
|
||||
self.read_table_measure()
|
||||
self.read_table_BS_raw_data()
|
||||
self.read_table_settings()
|
||||
self.read_table_sediment_file()
|
||||
self.read_table_table_sediment_data()
|
||||
# Create database cursor to execute SQL statements and fetch results from SQL queries.
|
||||
cur = cnx.cursor()
|
||||
|
||||
logger.debug(f"Reading '{stg.filename_open}' done")
|
||||
# --------------------------------------------------------------------------------------------------------------
|
||||
# +++++++++++++++++++++++++++
|
||||
# --- Table Acoustic File ---
|
||||
# +++++++++++++++++++++++++++
|
||||
|
||||
self._cur.close()
|
||||
cnx.close()
|
||||
|
||||
logger.debug(f"'{stg.filename_open}' closed")
|
||||
|
||||
def read_table_acoustic_file(self):
|
||||
query0 = f'''SELECT acoustic_data FROM AcousticFile'''
|
||||
data0 = self.execute(query0)
|
||||
|
||||
logger.debug(f"data0: {data0}")
|
||||
data0 = cur.execute(query0).fetchall()
|
||||
print("data0 ", data0)
|
||||
|
||||
stg.acoustic_data = [x[0] for x in data0]
|
||||
logger.debug(f"stg.acoustic_data: {stg.acoustic_data}")
|
||||
print("stg.acoustic_data ", stg.acoustic_data)
|
||||
|
||||
for k in range(len(stg.acoustic_data)):
|
||||
query = f'''
|
||||
SELECT
|
||||
acoustic_data, acoustic_file, ABS_name, path_BS_noise_data,
|
||||
filename_BS_noise_data,
|
||||
noise_method, noise_value, data_preprocessed
|
||||
FROM AcousticFile
|
||||
WHERE (acoustic_data = {k})
|
||||
'''
|
||||
data = self.execute(query)[0]
|
||||
print("hello")
|
||||
query = f'''SELECT acoustic_data, acoustic_file, ABS_name, path_BS_noise_data, filename_BS_noise_data,
|
||||
noise_method, noise_value, data_preprocessed FROM AcousticFile WHERE (acoustic_data = {k})'''
|
||||
data = cur.execute(query).fetchall()
|
||||
print("data acoustic file", data)
|
||||
|
||||
stg.filename_BS_raw_data.append(
|
||||
str(data[1]) + '.aqa'
|
||||
)
|
||||
stg.ABS_name.append(data[2])
|
||||
stg.path_BS_noise_data.append(data[3])
|
||||
stg.filename_BS_noise_data.append(data[4])
|
||||
stg.noise_method.append(data[5])
|
||||
stg.noise_value.append(data[6])
|
||||
stg.data_preprocessed.append(data[7])
|
||||
stg.filename_BS_raw_data.append([str(y[1]) + '.aqa' for y in data][0])
|
||||
stg.ABS_name.append([z[2] for z in data][0])
|
||||
stg.path_BS_noise_data.append([z[3] for z in data][0])
|
||||
stg.filename_BS_noise_data.append([z[4] for z in data][0])
|
||||
stg.noise_method.append([z[5] for z in data][0])
|
||||
stg.noise_value.append([z[6] for z in data][0])
|
||||
stg.data_preprocessed.append([z[7] for z in data][0])
|
||||
|
||||
logger.debug("data acoustic file:")
|
||||
logger.debug(f"- {stg.filename_BS_raw_data}")
|
||||
logger.debug(f"- {stg.ABS_name}")
|
||||
logger.debug(f"- {stg.path_BS_noise_data}")
|
||||
logger.debug(f"- {stg.filename_BS_noise_data}")
|
||||
logger.debug(f"- {stg.noise_method}")
|
||||
logger.debug(f"- {stg.noise_value}")
|
||||
logger.debug(f"- {stg.data_preprocessed}")
|
||||
print("data acoustic file ", stg.filename_BS_raw_data, stg.ABS_name, stg.path_BS_noise_data, stg.filename_BS_noise_data,
|
||||
stg.noise_method, stg.noise_value, stg.data_preprocessed)
|
||||
|
||||
# --------------------------------------------------------------------------------------------------------------
|
||||
# +++++++++++++++++++++
|
||||
# --- Table Measure ---
|
||||
# +++++++++++++++++++++
|
||||
|
||||
def read_table_measure(self):
|
||||
stg.date = [0]*len(stg.acoustic_data)
|
||||
stg.hour = [0]*len(stg.acoustic_data)
|
||||
|
||||
for i in range(len(stg.acoustic_data)):
|
||||
query1 = f'''
|
||||
SELECT
|
||||
acoustic_data, Date, Hour, frequency,
|
||||
sound_attenuation, kt_read, kt_corrected, NbProfiles,
|
||||
NbProfilesPerSeconds, NbCells, CellSize, PulseLength,
|
||||
NbPingsPerSeconds, NbPingsAveragedPerProfile,
|
||||
GainRx, GainTx
|
||||
FROM Measure
|
||||
WHERE (acoustic_data = {i})
|
||||
'''
|
||||
data1 = self.execute(query1)
|
||||
print("i = ", i)
|
||||
query1 = f'''SELECT acoustic_data, Date, Hour, frequency, sound_attenuation, kt_read, kt_corrected, NbProfiles,
|
||||
NbProfilesPerSeconds, NbCells, CellSize, PulseLength, NbPingsPerSeconds, NbPingsAveragedPerProfile,
|
||||
GainRx, GainTx FROM Measure WHERE (acoustic_data = {i})'''
|
||||
data1 = cur.execute(query1).fetchall()
|
||||
|
||||
logger.debug(f"data1 for {i}: {data1}")
|
||||
print("--------------------------------------")
|
||||
print("data1 ", data1)
|
||||
|
||||
stg.date[i] = data1[0][1]
|
||||
stg.hour[i] = data1[0][2]
|
||||
stg.freq.append(
|
||||
np.array([x[3] for x in data1])
|
||||
)
|
||||
stg.freq_text.append(
|
||||
[str(x[3]*1e-6) + 'MHz' for x in data1]
|
||||
)
|
||||
stg.water_attenuation.append(
|
||||
[x[4] for x in data1]
|
||||
)
|
||||
|
||||
stg.kt_read = [x[5] for x in data1]
|
||||
stg.freq.append(np.array([x[3] for x in data1]))
|
||||
stg.freq_text.append([str(x[3]*1e-6) + 'MHz' for x in data1])
|
||||
stg.water_attenuation.append([x[4] for x in data1])
|
||||
stg.kt_read.append([x[5] for x in data1])
|
||||
stg.kt_corrected = [x[6] for x in data1]
|
||||
|
||||
stg.nb_profiles.append([x[7] for x in data1])
|
||||
stg.nb_profiles_per_sec.append([x[8] for x in data1])
|
||||
stg.nb_cells.append([x[9] for x in data1])
|
||||
stg.cell_size.append([x[10] for x in data1])
|
||||
stg.pulse_length.append([x[11] for x in data1])
|
||||
stg.nb_pings_per_sec.append(
|
||||
[x[12] for x in data1]
|
||||
)
|
||||
stg.nb_pings_averaged_per_profile.append(
|
||||
[x[13] for x in data1]
|
||||
)
|
||||
stg.nb_pings_per_sec.append([x[12] for x in data1])
|
||||
stg.nb_pings_averaged_per_profile.append([x[13] for x in data1])
|
||||
stg.gain_rx.append([x[14] for x in data1])
|
||||
stg.gain_tx.append([x[15] for x in data1])
|
||||
|
||||
logger.debug("measure:")
|
||||
logger.debug(f"- stg.acoustic_data: {stg.acoustic_data}")
|
||||
logger.debug(f"- stg.freq {stg.freq}")
|
||||
logger.debug(f"- stg.water_attenuation {stg.water_attenuation}")
|
||||
logger.debug(f"- stg.kt_read {stg.kt_read}")
|
||||
logger.debug(f"- stg.kt_corrected {stg.kt_corrected}")
|
||||
logger.debug(f"- stg.nb_profiles {stg.nb_profiles}")
|
||||
logger.debug(f"- stg.nb_profiles_per_sec {stg.nb_profiles_per_sec}")
|
||||
logger.debug(f"- stg.nb_cells {stg.nb_cells}")
|
||||
logger.debug(f"- stg.cell_size {stg.cell_size}")
|
||||
logger.debug(f"- stg.pulse_length {stg.pulse_length}")
|
||||
logger.debug(f"- stg.nb_pings_per_sec {stg.nb_pings_per_sec}")
|
||||
logger.debug(f"- stg.nb_pings_averaged_per_profile {stg.nb_pings_averaged_per_profile}")
|
||||
logger.debug(f"- stg.gain_rx {stg.gain_rx}")
|
||||
logger.debug(f"- stg.gain_tx {stg.gain_tx}")
|
||||
print(stg.acoustic_data, stg.freq, stg.water_attenuation, stg.kt_read, stg.kt_corrected, stg.nb_profiles, stg.nb_profiles_per_sec,
|
||||
stg.nb_cells, stg.cell_size, stg.pulse_length, stg.nb_pings_per_sec, stg.nb_pings_averaged_per_profile,
|
||||
stg.gain_rx, stg.gain_tx)
|
||||
|
||||
logger.debug(f"- {stg.date}")
|
||||
logger.debug(f"- {stg.hour}")
|
||||
print(stg.date)
|
||||
print(stg.hour)
|
||||
|
||||
def read_table_BS_raw_data(self):
|
||||
logger.debug(f"len stg.acoustic_data: {len(stg.acoustic_data)}")
|
||||
# --------------------------------------------------------------------------------------------------------------
|
||||
# +++++++++++++++++++++++
|
||||
# --- Table BSRawData ---
|
||||
# ++++++++++++++++++++++
|
||||
print("len stg.acoustic_data ", len(stg.acoustic_data))
|
||||
for j in range(len(stg.acoustic_data)):
|
||||
print(f"j = {j}")
|
||||
query2 = f'''SELECT acoustic_data, time, depth, BS_raw_data,
|
||||
time_reshape, depth_reshape, BS_raw_data_reshape,
|
||||
time_cross_section, depth_cross_section,
|
||||
BS_cross_section, BS_stream_bed,
|
||||
depth_bottom, val_bottom, ind_bottom,
|
||||
time_noise, depth_noise, BS_noise_raw_data,
|
||||
SNR_raw_data, SNR_cross_section, SNR_stream_bed,
|
||||
BS_raw_data_pre_process_SNR, BS_raw_data_pre_process_average,
|
||||
BS_cross_section_pre_process_SNR, BS_cross_section_pre_process_average,
|
||||
BS_stream_bed_pre_process_SNR, BS_stream_bed_pre_process_average, BS_mean
|
||||
FROM BSRawData WHERE (acoustic_data = {j})'''
|
||||
|
||||
for i in range(len(stg.acoustic_data)):
|
||||
query = lambda values: f'''
|
||||
SELECT
|
||||
{", ".join(values)}
|
||||
FROM BSRawData
|
||||
WHERE (acoustic_data = {i})
|
||||
'''
|
||||
data2 = cur.execute(query2).fetchall()
|
||||
print("len data2 ", len(data2))
|
||||
|
||||
self.read_table_BS_raw_data_raw(query, i)
|
||||
self.read_table_BS_raw_data_cross_section(query, i)
|
||||
self.read_table_BS_raw_data_bed(query, i)
|
||||
self.read_table_BS_raw_data_noise(query, i)
|
||||
self.read_table_BS_raw_data_SNR(query, i)
|
||||
self.read_table_BS_raw_data_rest(query, i)
|
||||
self.read_table_BS_raw_data_mean(query, i)
|
||||
stg.time.append(np.frombuffer(data2[0][1], dtype=np.float64).reshape((stg.freq[j].shape[0], -1)))
|
||||
print("stg.time[0].shape ", stg.time[j].shape, np.frombuffer(data2[0][1], dtype=np.float64).shape)
|
||||
print(stg.time)
|
||||
stg.depth.append(np.frombuffer(data2[0][2], dtype=np.float64).reshape((stg.freq[j].shape[0], -1)))
|
||||
print("stg.depth[0].shape ", stg.depth[j].shape)
|
||||
print(stg.depth)
|
||||
stg.BS_raw_data.append(np.frombuffer(data2[0][3], dtype=np.float64).reshape((stg.freq[j].shape[0], stg.depth[j].shape[1], stg.time[j].shape[1])))
|
||||
print("BS_raw_data ", stg.BS_raw_data[j].shape)
|
||||
stg.time_reshape.append(np.frombuffer(data2[0][4], dtype=np.float64).reshape((-1, stg.freq[j].shape[0])))
|
||||
print("stg.time_reshape[0].shape ", stg.time_reshape[j].shape)
|
||||
stg.depth_reshape.append(np.frombuffer(data2[0][5], dtype=np.float64).reshape((-1, stg.freq[j].shape[0])))
|
||||
stg.BS_raw_data_reshape.append(np.frombuffer(data2[0][6], dtype=np.float64).reshape((-1, stg.freq[j].shape[0])))
|
||||
print("time cross section ", stg.time_cross_section, stg.time_cross_section == [])
|
||||
|
||||
def read_table_BS_raw_data_raw(self, query, i):
|
||||
np_f64_parse = lambda d: np.frombuffer(d, dtype=np.float64)
|
||||
data = self.execute(
|
||||
query(
|
||||
[
|
||||
"time", "depth",
|
||||
"BS_raw_data",
|
||||
"time_reshape", "depth_reshape",
|
||||
"BS_raw_data_reshape",
|
||||
]
|
||||
)
|
||||
)[0]
|
||||
|
||||
it = iter(data)
|
||||
|
||||
time = next(it)
|
||||
depth = next(it)
|
||||
BS_raw_data = next(it)
|
||||
time_reshape = next(it)
|
||||
depth_reshape = next(it)
|
||||
BS_raw_data_reshape = next(it)
|
||||
|
||||
stg.time.append(
|
||||
np_f64_parse(time).reshape((stg.freq[i].shape[0], -1))
|
||||
)
|
||||
stg.depth.append(np_f64_parse(depth).reshape(
|
||||
(stg.freq[i].shape[0], -1)
|
||||
))
|
||||
stg.BS_raw_data.append(
|
||||
np_f64_parse(BS_raw_data).reshape(
|
||||
(
|
||||
stg.freq[i].shape[0],
|
||||
stg.depth[i].shape[1],
|
||||
stg.time[i].shape[1]
|
||||
)
|
||||
)
|
||||
)
|
||||
stg.time_reshape.append(
|
||||
np_f64_parse(time_reshape).reshape(
|
||||
(-1, stg.freq[i].shape[0])
|
||||
)
|
||||
)
|
||||
stg.depth_reshape.append(
|
||||
np_f64_parse(depth_reshape).reshape(
|
||||
(-1, stg.freq[i].shape[0])
|
||||
)
|
||||
)
|
||||
stg.BS_raw_data_reshape.append(
|
||||
np_f64_parse(BS_raw_data_reshape).reshape(
|
||||
(-1, stg.freq[i].shape[0])
|
||||
)
|
||||
)
|
||||
|
||||
def read_table_BS_raw_data_cross_section(self, query, i):
|
||||
np_f64_parse = lambda d: np.frombuffer(d, dtype=np.float64)
|
||||
data = self.execute(
|
||||
query(
|
||||
[
|
||||
"time_cross_section",
|
||||
"depth_cross_section",
|
||||
"BS_cross_section",
|
||||
]
|
||||
)
|
||||
)[0]
|
||||
|
||||
it = iter(data)
|
||||
|
||||
time = next(it)
|
||||
depth = next(it)
|
||||
BS = np_f64_parse(next(it))
|
||||
|
||||
if len(BS) == 0:
|
||||
print("np.frombuffer(data2[0][9], dtype=np.float64) ", np.frombuffer(data2[0][9], dtype=np.float64))
|
||||
if len(np.frombuffer(data2[0][9], dtype=np.float64)) == 0:
|
||||
print("Je suis là")
|
||||
stg.time_cross_section.append(np.array([]))
|
||||
stg.depth_cross_section.append(np.array([]))
|
||||
stg.BS_cross_section.append(np.array([]))
|
||||
else:
|
||||
stg.time_cross_section.append(
|
||||
np_f64_parse(time).reshape(
|
||||
(stg.freq[i].shape[0], -1)
|
||||
)
|
||||
)
|
||||
stg.depth_cross_section.append(
|
||||
np_f64_parse(depth).reshape(
|
||||
(stg.freq[i].shape[0], -1)
|
||||
)
|
||||
)
|
||||
print("Je suis ici")
|
||||
print(stg.freq[j].shape)
|
||||
print(np.frombuffer(data2[0][7], dtype=np.float64).shape)
|
||||
stg.time_cross_section.append(np.frombuffer(data2[0][7], dtype=np.float64).reshape((stg.freq[j].shape[0], -1)))
|
||||
print("time cross section ", stg.time_cross_section, stg.time_cross_section[j].shape)
|
||||
stg.depth_cross_section.append(np.frombuffer(data2[0][8], dtype=np.float64).reshape((stg.freq[j].shape[0], -1)))
|
||||
print("depth cross section ", stg.depth_cross_section, stg.depth_cross_section[j].shape)
|
||||
stg.BS_cross_section.append(np.frombuffer(data2[0][9], dtype=np.float64).reshape(
|
||||
(stg.freq[j].shape[0], stg.depth_cross_section[j].shape[1], stg.time_cross_section[j].shape[1])))
|
||||
|
||||
stg.BS_cross_section.append(
|
||||
BS.reshape(
|
||||
(
|
||||
stg.freq[i].shape[0],
|
||||
stg.depth_cross_section[i].shape[1],
|
||||
stg.time_cross_section[i].shape[1]
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
def read_table_BS_raw_data_bed(self, query, i):
|
||||
np_f64_parse = lambda d: np.frombuffer(d, dtype=np.float64)
|
||||
data = self.execute(
|
||||
query(
|
||||
[
|
||||
"BS_stream_bed",
|
||||
"depth_bottom", "val_bottom", "ind_bottom",
|
||||
]
|
||||
)
|
||||
)[0]
|
||||
|
||||
it = iter(data)
|
||||
|
||||
BS = np_f64_parse(next(it))
|
||||
depth = np_f64_parse(next(it))
|
||||
val = np_f64_parse(next(it))
|
||||
ind = np_f64_parse(next(it))
|
||||
|
||||
if len(BS) == 0:
|
||||
if len(np.frombuffer(data2[0][10], dtype=np.float64)) == 0:
|
||||
stg.BS_stream_bed.append(np.array([]))
|
||||
else:
|
||||
stg.BS_stream_bed.append(
|
||||
BS.reshape(
|
||||
(
|
||||
stg.freq[i].shape[0],
|
||||
stg.depth_cross_section[i].shape[1],
|
||||
stg.time_cross_section[i].shape[1]
|
||||
)
|
||||
)
|
||||
)
|
||||
stg.BS_stream_bed.append(np.frombuffer(data2[0][10], dtype=np.float64).reshape(
|
||||
(stg.freq[j].shape[0], stg.depth_cross_section[j].shape[1], stg.time_cross_section[j].shape[1])))
|
||||
|
||||
if len(depth) == 0:
|
||||
if len(np.frombuffer(data2[0][11], dtype=np.float64)) == 0:
|
||||
stg.depth_bottom.append(np.array([]))
|
||||
stg.val_bottom.append([])
|
||||
stg.ind_bottom.append([])
|
||||
else:
|
||||
stg.depth_bottom.append(depth)
|
||||
stg.val_bottom.append(val.tolist())
|
||||
stg.ind_bottom.append(ind.tolist())
|
||||
stg.depth_bottom.append(np.frombuffer(data2[0][11], dtype=np.float64))
|
||||
stg.val_bottom.append(np.frombuffer(data2[0][12], dtype=np.float64).tolist())
|
||||
stg.ind_bottom.append(np.frombuffer(data2[0][13], dtype=np.float64).tolist())
|
||||
print("stg.depth_bottom ", stg.depth_bottom)
|
||||
print("stg.val_bottom ", stg.val_bottom)
|
||||
print("stg.ind_bottom ", stg.ind_bottom)
|
||||
|
||||
def read_table_BS_raw_data_noise(self, query, i):
|
||||
np_f64_parse = lambda d: np.frombuffer(d, dtype=np.float64)
|
||||
data = self.execute(
|
||||
query(
|
||||
[
|
||||
"time_noise", "depth_noise", "BS_noise_raw_data",
|
||||
]
|
||||
)
|
||||
)[0]
|
||||
|
||||
it = iter(data)
|
||||
|
||||
time = next(it)
|
||||
depth = next(it)
|
||||
BS = np_f64_parse(next(it))
|
||||
|
||||
if len(BS) == 0:
|
||||
if len(np.frombuffer(data2[0][14], dtype=np.float64)) == 0:
|
||||
stg.time_noise.append(np.array([]))
|
||||
stg.depth_noise.append(np.array([]))
|
||||
stg.BS_noise_raw_data.append(np.array([]))
|
||||
stg.BS_noise_averaged_data.append(np.array([]))
|
||||
else:
|
||||
stg.time_noise.append(
|
||||
np_f64_parse(time).reshape(
|
||||
(stg.freq[i].shape[0], -1)
|
||||
)
|
||||
)
|
||||
stg.depth_noise.append(
|
||||
np_f64_parse(depth).reshape(
|
||||
(stg.freq[i].shape[0], -1)
|
||||
)
|
||||
)
|
||||
stg.BS_noise_raw_data.append(
|
||||
BS.reshape(
|
||||
(
|
||||
stg.freq[i].shape[0],
|
||||
stg.depth_noise[i].shape[1],
|
||||
stg.time_noise[i].shape[1]
|
||||
)
|
||||
)
|
||||
)
|
||||
stg.BS_noise_averaged_data.append(np.array([]))
|
||||
stg.time_noise.append(np.frombuffer(data2[0][14], dtype=np.float64).reshape((stg.freq[j].shape[0], -1)))
|
||||
stg.depth_noise.append(np.frombuffer(data2[0][15], dtype=np.float64).reshape((stg.freq[j].shape[0], -1)))
|
||||
stg.BS_noise_raw_data.append(np.frombuffer(data2[0][16], dtype=np.float64).reshape(
|
||||
(stg.freq[j].shape[0], stg.depth_noise[j].shape[1], stg.time_noise[j].shape[1])))
|
||||
|
||||
def read_table_BS_raw_data_SNR(self, query, i):
|
||||
np_f64_parse = lambda d: np.frombuffer(d, dtype=np.float64)
|
||||
data = self.execute(
|
||||
query(
|
||||
[
|
||||
"SNR_raw_data", "SNR_cross_section", "SNR_stream_bed",
|
||||
]
|
||||
)
|
||||
)[0]
|
||||
if len(np.frombuffer(data2[0][17], dtype=np.float64)) == 0:
|
||||
stg.SNR_raw_data.append(np.array([]))
|
||||
else:
|
||||
stg.SNR_raw_data.append(np.frombuffer(data2[0][17], dtype=np.float64).reshape(stg.BS_raw_data[j].shape))
|
||||
|
||||
it = iter(data)
|
||||
|
||||
SNR_vars = [
|
||||
(stg.SNR_raw_data, stg.BS_raw_data),
|
||||
(stg.SNR_cross_section, stg.BS_cross_section),
|
||||
(stg.SNR_stream_bed, stg.BS_stream_bed),
|
||||
]
|
||||
if len(np.frombuffer(data2[0][18], dtype=np.float64)) == 0:
|
||||
stg.SNR_cross_section.append(np.array([]))
|
||||
else:
|
||||
stg.SNR_cross_section.append(np.frombuffer(data2[0][18], dtype=np.float64).reshape(stg.BS_cross_section[j].shape))
|
||||
|
||||
if len(np.frombuffer(data2[0][19], dtype=np.float64)) == 0:
|
||||
stg.SNR_stream_bed.append(np.array([]))
|
||||
|
||||
for dest, resh in SNR_vars:
|
||||
SNR = np_f64_parse(next(it))
|
||||
|
||||
if len(SNR) == 0:
|
||||
dest.append(np.array([]))
|
||||
else:
|
||||
dest.append(SNR.reshape(resh[i].shape))
|
||||
stg.SNR_stream_bed.append(np.frombuffer(data2[0][19], dtype=np.float64).reshape(stg.BS_stream_bed[j].shape))
|
||||
|
||||
def read_table_BS_raw_data_rest(self, query, i):
|
||||
np_f64_parse = lambda d: np.frombuffer(d, dtype=np.float64)
|
||||
data = self.execute(
|
||||
query(
|
||||
[
|
||||
"BS_raw_data_pre_process_SNR",
|
||||
"BS_raw_data_pre_process_average",
|
||||
"BS_cross_section_pre_process_SNR",
|
||||
"BS_cross_section_pre_process_average",
|
||||
"BS_stream_bed_pre_process_SNR",
|
||||
"BS_stream_bed_pre_process_average",
|
||||
]
|
||||
)
|
||||
)[0]
|
||||
|
||||
BS_vars = [
|
||||
(stg.BS_raw_data_pre_process_SNR, stg.BS_raw_data),
|
||||
(stg.BS_raw_data_pre_process_average, stg.BS_raw_data),
|
||||
(stg.BS_cross_section_pre_process_SNR, stg.BS_cross_section),
|
||||
(stg.BS_cross_section_pre_process_average, stg.BS_cross_section),
|
||||
(stg.BS_stream_bed_pre_process_SNR, stg.BS_stream_bed),
|
||||
(stg.BS_stream_bed_pre_process_average, stg.BS_stream_bed),
|
||||
]
|
||||
|
||||
it = iter(data)
|
||||
for dest, resh in BS_vars:
|
||||
BS = np_f64_parse(next(it))
|
||||
|
||||
if len(BS) == 0:
|
||||
dest.append(np.array([]))
|
||||
if len(np.frombuffer(data2[0][20], dtype=np.float64)) == 0:
|
||||
stg.BS_raw_data_pre_process_SNR.append(np.array([]))
|
||||
else:
|
||||
dest.append(BS.reshape(resh[i].shape))
|
||||
stg.BS_raw_data_pre_process_SNR.append(np.frombuffer(data2[0][20], dtype=np.float64).reshape(stg.BS_raw_data[j].shape))
|
||||
|
||||
def read_table_BS_raw_data_mean(self, query, i):
|
||||
np_f64_parse = lambda d: np.frombuffer(d, dtype=np.float64)
|
||||
data = self.execute(
|
||||
query(["BS_mean"])
|
||||
)[0]
|
||||
if len(np.frombuffer(data2[0][21], dtype=np.float64)) == 0:
|
||||
stg.BS_raw_data_pre_process_average.append(np.array([]))
|
||||
else:
|
||||
stg.BS_raw_data_pre_process_average.append(np.frombuffer(data2[0][21], dtype=np.float64).reshape(stg.BS_raw_data[j].shape))
|
||||
|
||||
BS = np_f64_parse(data[0])
|
||||
if len(np.frombuffer(data2[0][22], dtype=np.float64)) == 0:
|
||||
stg.BS_cross_section_pre_process_SNR.append(np.array([]))
|
||||
else:
|
||||
stg.BS_cross_section_pre_process_SNR.append(np.frombuffer(data2[0][22], dtype=np.float64).reshape(stg.BS_cross_section[j].shape))
|
||||
|
||||
if len(BS) == 0:
|
||||
if len(np.frombuffer(data2[0][23], dtype=np.float64)) == 0:
|
||||
stg.BS_cross_section_pre_process_average.append(np.array([]))
|
||||
else:
|
||||
stg.BS_cross_section_pre_process_average.append(np.frombuffer(data2[0][23], dtype=np.float64).reshape(stg.BS_cross_section[j].shape))
|
||||
|
||||
if len(np.frombuffer(data2[0][24], dtype=np.float64)) == 0:
|
||||
stg.BS_stream_bed_pre_process_SNR.append(np.array([]))
|
||||
else:
|
||||
stg.BS_stream_bed_pre_process_SNR.append(np.frombuffer(data2[0][24], dtype=np.float64).reshape(stg.BS_stream_bed[j].shape))
|
||||
|
||||
if len(np.frombuffer(data2[0][25], dtype=np.float64)) == 0:
|
||||
stg.BS_stream_bed_pre_process_average.append(np.array([]))
|
||||
else:
|
||||
stg.BS_stream_bed_pre_process_average.append(np.frombuffer(data2[0][25], dtype=np.float64).reshape(stg.BS_stream_bed[j].shape))
|
||||
|
||||
if len(np.frombuffer(data2[0][26], dtype=np.float64)) == 0:
|
||||
stg.BS_mean.append(np.array([]))
|
||||
else:
|
||||
stg.BS_mean.append(
|
||||
BS.reshape(
|
||||
(stg.freq[i].shape[0], -1)
|
||||
)
|
||||
)
|
||||
stg.BS_mean.append(np.frombuffer(data2[0][26], dtype=np.float64).reshape((stg.freq[j].shape[0], -1)))
|
||||
print(stg.BS_mean[j].shape)
|
||||
# --------------------------------------------------------------------------------------------------------------
|
||||
# +++++++++++++++++++++++
|
||||
# --- Table Settings ---
|
||||
# +++++++++++++++++++++++
|
||||
|
||||
def read_table_settings(self):
|
||||
for s in range(len(stg.acoustic_data)):
|
||||
query3 = f'''
|
||||
SELECT
|
||||
acoustic_data, temperature,
|
||||
query3 = f'''SELECT acoustic_data, temperature,
|
||||
tmin_index, tmin_value, tmax_index, tmax_value,
|
||||
rmin_index, rmin_value, rmax_index, rmax_value,
|
||||
freq_bottom_detection_index, freq_bottom_detection_value,
|
||||
SNR_filter_value, Nb_cells_to_average_BS_signal
|
||||
FROM Settings
|
||||
WHERE (acoustic_data = {s})
|
||||
'''
|
||||
FROM Settings WHERE (acoustic_data = {s})'''
|
||||
|
||||
data = self.execute(query3)
|
||||
x = data[0]
|
||||
data3 = cur.execute(query3).fetchall()
|
||||
|
||||
stg.temperature = [x[1]][0]
|
||||
stg.tmin.append((x[2], x[3]))
|
||||
stg.tmax.append((x[4], x[5]))
|
||||
stg.rmin.append((x[6], x[7]))
|
||||
stg.rmax.append((x[8], x[9]))
|
||||
stg.freq_bottom_detection.append((x[10], x[11]))
|
||||
stg.SNR_filter_value.append(x[12])
|
||||
stg.Nb_cells_to_average_BS_signal.append(x[13])
|
||||
stg.temperature = [x[1] for x in data3][0]
|
||||
stg.tmin.append([(x[2], x[3]) for x in data3])
|
||||
stg.tmax.append([(x[4], x[5]) for x in data3])
|
||||
stg.rmin.append([(x[6], x[7]) for x in data3])
|
||||
stg.rmax.append([(x[8], x[9]) for x in data3])
|
||||
stg.freq_bottom_detection.append([(x[10], x[11]) for x in data3])
|
||||
stg.SNR_filter_value.append([x[12] for x in data3])
|
||||
stg.Nb_cells_to_average_BS_signal.append([x[13] for x in data3])
|
||||
|
||||
logger.debug(f"stg.tmin: {stg.tmin}")
|
||||
logger.debug(f"stg.tmin: {stg.tmax}")
|
||||
logger.debug(f"stg.SNR_filter_value: {stg.SNR_filter_value}")
|
||||
# --------------------------------------------------------------------------------------------------------------
|
||||
# +++++++++++++++++++++++++++
|
||||
# --- Table Sediment File ---
|
||||
# +++++++++++++++++++++++++++
|
||||
|
||||
def read_table_sediment_file(self):
|
||||
query = f'''
|
||||
SELECT
|
||||
path_fine, filename_fine, radius_grain_fine,
|
||||
path_sand, filename_sand, radius_grain_sand,
|
||||
time_column_label, distance_from_bank_column_label,
|
||||
depth_column_label,
|
||||
query4 = f'''SELECT path_fine, filename_fine, radius_grain_fine, path_sand, filename_sand, radius_grain_sand,
|
||||
time_column_label, distance_from_bank_column_label, depth_column_label,
|
||||
Ctot_fine_column_label, D50_fine_column_label,
|
||||
Ctot_sand_column_label, D50_sand_column_label
|
||||
FROM SedimentsFile
|
||||
'''
|
||||
from SedimentsFile'''
|
||||
|
||||
data = self.execute(query)[0]
|
||||
data4 = cur.execute(query4).fetchall()
|
||||
|
||||
stg.path_fine = data[0]
|
||||
stg.filename_fine = data[1]
|
||||
stg.radius_grain_fine = np.array(
|
||||
np.frombuffer(data[2], dtype=np.float64)
|
||||
)
|
||||
stg.path_sand = data[3]
|
||||
stg.filename_sand = data[4]
|
||||
stg.radius_grain_sand = np.array(
|
||||
np.frombuffer(data[5], dtype=np.float64)
|
||||
)
|
||||
stg.columns_fine = (
|
||||
[data[6], data[7], data[8], data[9], data[10]]
|
||||
+ list(stg.radius_grain_fine)
|
||||
)
|
||||
stg.columns_sand = (
|
||||
[data[6], data[7], data[8], data[11], data[12]]
|
||||
+ list(stg.radius_grain_sand)
|
||||
)
|
||||
print("data4 ", data4)
|
||||
|
||||
def read_table_table_sediment_data(self):
|
||||
np_f64_parse = lambda d: np.frombuffer(d, dtype=np.float64)
|
||||
stg.path_fine = data4[0][0]
|
||||
stg.filename_fine = data4[0][1]
|
||||
stg.radius_grain_fine = np.array(np.frombuffer(data4[0][2], dtype=np.float64))
|
||||
stg.path_sand = data4[0][3]
|
||||
stg.filename_sand = data4[0][4]
|
||||
stg.radius_grain_sand = np.array(np.frombuffer(data4[0][5], dtype=np.float64))
|
||||
stg.columns_fine = [data4[0][6], data4[0][7], data4[0][8], data4[0][9], data4[0][10]] + list(stg.radius_grain_fine)
|
||||
stg.columns_sand = [data4[0][6], data4[0][7], data4[0][8], data4[0][11], data4[0][12]] + list(stg.radius_grain_sand)
|
||||
|
||||
query = f'''
|
||||
SELECT
|
||||
sample_fine_name, sample_fine_index, distance_from_bank_fine,
|
||||
depth_fine, time_fine, Ctot_fine, Ctot_fine_per_cent, D50_fine,
|
||||
frac_vol_fine, frac_vol_fine_cumul,
|
||||
print("sediment file : ", stg.path_fine, stg.filename_fine, stg.path_sand, stg.filename_sand)
|
||||
print(stg.radius_grain_fine, stg.radius_grain_sand)
|
||||
print('stg.columns_fine ', stg.columns_fine)
|
||||
|
||||
sample_sand_name, sample_sand_index, distance_from_bank_sand,
|
||||
depth_sand, time_sand, Ctot_sand, Ctot_sand_per_cent, D50_sand,
|
||||
frac_vol_sand, frac_vol_sand_cumul
|
||||
FROM SedimentsData
|
||||
'''
|
||||
# --------------------------------------------------------------------------------------------------------------
|
||||
# +++++++++++++++++++++++++++
|
||||
# --- Table Sediment Data ---
|
||||
# +++++++++++++++++++++++++++
|
||||
|
||||
data = self.execute(query)
|
||||
query5 = f'''SELECT sample_fine_name, sample_fine_index, distance_from_bank_fine, depth_fine, time_fine,
|
||||
Ctot_fine, Ctot_fine_per_cent, D50_fine, frac_vol_fine, frac_vol_fine_cumul,
|
||||
sample_sand_name, sample_sand_index, distance_from_bank_sand, depth_sand, time_sand,
|
||||
Ctot_sand, Ctot_sand_per_cent, D50_sand, frac_vol_sand, frac_vol_sand_cumul
|
||||
from SedimentsData'''
|
||||
|
||||
data5 = cur.execute(query5).fetchall()
|
||||
|
||||
stg.frac_vol_fine = []
|
||||
stg.frac_vol_fine_cumul = []
|
||||
stg.frac_vol_sand = []
|
||||
stg.frac_vol_sand_cumul = []
|
||||
|
||||
for f in range(len(data)):
|
||||
stg.sample_fine.append((data[f][0], data[f][1]))
|
||||
stg.distance_from_bank_fine.append(data[f][2])
|
||||
stg.depth_fine.append(data[f][3])
|
||||
stg.time_fine.append(data[f][4])
|
||||
stg.Ctot_fine.append(data[f][5])
|
||||
stg.Ctot_fine_per_cent.append(data[f][6])
|
||||
stg.D50_fine.append(data[f][7])
|
||||
stg.frac_vol_fine.append(
|
||||
np_f64_parse(data[f][8])
|
||||
)
|
||||
stg.frac_vol_fine_cumul.append(
|
||||
np_f64_parse(data[f][9])
|
||||
)
|
||||
stg.sample_sand.append((data[f][10], data[f][11]))
|
||||
stg.distance_from_bank_sand.append(data[f][12])
|
||||
stg.depth_sand.append(data[f][13])
|
||||
stg.time_sand.append(data[f][14])
|
||||
stg.Ctot_sand.append(data[f][15])
|
||||
stg.Ctot_sand_per_cent.append(data[f][16])
|
||||
stg.D50_sand.append(data[f][17])
|
||||
stg.frac_vol_sand.append(
|
||||
np_f64_parse(data[f][18])
|
||||
)
|
||||
stg.frac_vol_sand_cumul.append(
|
||||
np_f64_parse(data[f][19])
|
||||
)
|
||||
for f in range(len(data5)):
|
||||
stg.sample_fine.append((data5[f][0], data5[f][1]))
|
||||
stg.distance_from_bank_fine.append(data5[f][2])
|
||||
stg.depth_fine.append(data5[f][3])
|
||||
stg.time_fine.append(data5[f][4])
|
||||
stg.Ctot_fine.append(data5[f][5])
|
||||
stg.Ctot_fine_per_cent.append(data5[f][6])
|
||||
stg.D50_fine.append(data5[f][7])
|
||||
print("np.frombuffer(data4[f][8], dtype=np.float64) ", np.frombuffer(data5[f][8], dtype=np.float64))
|
||||
stg.frac_vol_fine.append(np.frombuffer(data5[f][8], dtype=np.float64))
|
||||
stg.frac_vol_fine_cumul.append(np.frombuffer(data5[f][9], dtype=np.float64))
|
||||
stg.sample_sand.append((data5[f][10], data5[f][11]))
|
||||
stg.distance_from_bank_sand.append(data5[f][12])
|
||||
stg.depth_sand.append(data5[f][13])
|
||||
stg.time_sand.append(data5[f][14])
|
||||
stg.Ctot_sand.append(data5[f][15])
|
||||
stg.Ctot_sand_per_cent.append(data5[f][16])
|
||||
stg.D50_sand.append(data5[f][17])
|
||||
stg.frac_vol_sand.append(np.frombuffer(data5[f][18], dtype=np.float64))
|
||||
stg.frac_vol_sand_cumul.append(np.frombuffer(data5[f][19], dtype=np.float64))
|
||||
|
||||
stg.frac_vol_fine = np.array(stg.frac_vol_fine)
|
||||
stg.frac_vol_fine_cumul = np.array(stg.frac_vol_fine_cumul)
|
||||
stg.frac_vol_sand = np.array(stg.frac_vol_sand)
|
||||
stg.frac_vol_sand_cumul = np.array(stg.frac_vol_sand_cumul)
|
||||
|
||||
logger.debug(f"fine: {stg.Ctot_fine}, sand: {stg.sample_sand}")
|
||||
# print("data 4 : ", len(data4), data4)
|
||||
print('data 5 :')
|
||||
print(stg.Ctot_fine, stg.sample_sand)
|
||||
print(type(stg.frac_vol_fine_cumul), stg.frac_vol_fine_cumul)
|
||||
|
||||
|
||||
# Close database cursor
|
||||
cur.close()
|
||||
|
||||
# Close database connection
|
||||
cnx.close()
|
||||
|
||||
print("read table finished")
|
||||
|
||||
def fill_acoustic_data_tab(self):
|
||||
print("start fill acoustic data tab")
|
||||
|
||||
# tab_adt = AcousticDataTab(self.master_widget)
|
||||
print("1 AcousticDataTab ", id(AcousticDataTab))
|
||||
print("tab_adt.combobox_ABS_system_choice ", self.tab.combobox_ABS_system_choice)
|
||||
self.tab.combobox_ABS_system_choice.editTextChanged.connect(self.tab.ABS_system_choice)
|
||||
if stg.ABS_name[0] == "AQUAscat":
|
||||
self.tab.combobox_ABS_system_choice.setCurrentText(stg.ABS_name[0])
|
||||
print("combobox_ABS_system_choice.setCurrentIndex(1)", self.tab.combobox_ABS_system_choice.itemText(1),
|
||||
self.tab.combobox_ABS_system_choice.itemText(2))
|
||||
else:
|
||||
self.tab.combobox_ABS_system_choice.setCurrentText(stg.ABS_name[0])
|
||||
|
||||
self.tab.plot_backscattered_acoustic_signal_recording()
|
||||
# app = QApplication(sys.argv)
|
||||
|
||||
# sys.exit(app.exec_())
|
||||
|
||||
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])))
|
||||
|
|
|
|||
|
|
@ -733,27 +733,6 @@ class AcousticDataTab(QWidget):
|
|||
|
||||
# -------------------- Functions for Acoustic dataTab --------------------
|
||||
|
||||
def full_update(self):
|
||||
logger.debug(f"{__name__}: Update")
|
||||
self.blockSignals(True)
|
||||
self.fileListWidget.blockSignals(True)
|
||||
|
||||
self.combobox_ABS_system_choice.setCurrentText(stg.ABS_name[0])
|
||||
self.fileListWidget.addFilenames(stg.filename_BS_raw_data)
|
||||
|
||||
self.fill_measurements_information_groupbox()
|
||||
self.fill_table()
|
||||
self.plot_backscattered_acoustic_signal_recording()
|
||||
self.plot_profile()
|
||||
self.update_frequency_combobox()
|
||||
self.water_attenuation()
|
||||
self.compute_tmin_tmax()
|
||||
self.compute_rmin_rmax()
|
||||
self.set_range_for_spinboxes_bathymetry()
|
||||
|
||||
self.fileListWidget.blockSignals(False)
|
||||
self.blockSignals(False)
|
||||
|
||||
def retranslate_acoustic_data_tab(self):
|
||||
|
||||
self.groupbox_info.setTitle(_translate("CONSTANT_STRING", cs.MEASUREMENTS_INFORMATION))
|
||||
|
|
@ -1653,9 +1632,9 @@ class AcousticDataTab(QWidget):
|
|||
stg.gain_tx.append(acoustic_data._gain_tx)
|
||||
stg.water_attenuation.append([])
|
||||
|
||||
self.initiate_setting_parameters_new_others()
|
||||
# --- The other acoustic variables lists are filled with empty object. ---
|
||||
# --- They will be used for pre- and post-processing ---
|
||||
|
||||
def initiate_setting_parameters_new_others(self):
|
||||
stg.BS_cross_section.append(np.array([]))
|
||||
stg.depth_cross_section.append(np.array([]))
|
||||
stg.time_cross_section.append(np.array([]))
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import logging
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
from math import isinf
|
||||
|
|
@ -51,7 +50,6 @@ from Model.acoustic_inversion_method_high_concentration import AcousticInversion
|
|||
|
||||
_translate = QCoreApplication.translate
|
||||
|
||||
logger = logging.getLogger("acoused")
|
||||
|
||||
class AcousticInversionTab(QWidget):
|
||||
|
||||
|
|
@ -371,14 +369,6 @@ class AcousticInversionTab(QWidget):
|
|||
# ------------------------------------ Functions for Acoustic Inversion Tab ----------------------------------------
|
||||
# ==================================================================================================================
|
||||
|
||||
def full_update(self):
|
||||
logger.debug(f"{__name__}: Update")
|
||||
self.blockSignals(True)
|
||||
|
||||
# TODO: Update all widgets
|
||||
|
||||
self.blockSignals(False)
|
||||
|
||||
def update_acoustic_data_choice(self):
|
||||
|
||||
self.combobox_acoustic_data_choice.clear()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import logging
|
||||
|
||||
from PyQt5.QtWidgets import (
|
||||
QApplication, QWidget, QVBoxLayout, QHBoxLayout,
|
||||
QTextEdit, QPushButton, QSpacerItem, QSpinBox,
|
||||
|
|
@ -10,8 +8,6 @@ from PyQt5.QtCore import Qt
|
|||
|
||||
import settings as stg
|
||||
|
||||
logger = logging.getLogger("acoused")
|
||||
|
||||
class NoteTab(QWidget):
|
||||
|
||||
''' This class generates a enhanced notepad in Note Tab '''
|
||||
|
|
@ -134,14 +130,6 @@ class NoteTab(QWidget):
|
|||
## -------------------------------
|
||||
|
||||
|
||||
def full_update(self):
|
||||
logger.debug(f"{__name__}: Update")
|
||||
self.blockSignals(True)
|
||||
|
||||
# TODO: Update all widgets
|
||||
|
||||
self.blockSignals(False)
|
||||
|
||||
# def new_text(self):
|
||||
# window = self.ui_mainwindow.tab5
|
||||
# window.show()
|
||||
|
|
|
|||
|
|
@ -271,20 +271,6 @@ class SampleDataTab(QWidget):
|
|||
|
||||
self.groupbox_plot_PSD.setTitle(_translate("CONSTANT_STRING", cs.DISTRIBUTION_PLOT))
|
||||
|
||||
def full_update(self):
|
||||
logger.debug(f"{__name__}: Update")
|
||||
self.blockSignals(True)
|
||||
|
||||
self.fill_comboboxes_and_plot_transect()
|
||||
self.lineEdit_fine_sediment.setText(stg.filename_fine)
|
||||
self.lineEdit_fine_sediment.setToolTip(stg.path_fine)
|
||||
self.fill_table_fine()
|
||||
|
||||
self.lineEdit_sand_sediment.setText(stg.filename_sand)
|
||||
self.lineEdit_sand_sediment.setToolTip(stg.path_sand)
|
||||
self.fill_table_sand()
|
||||
|
||||
self.blockSignals(False)
|
||||
|
||||
def last_opened_file_path(self, priority="sand"):
|
||||
lst = []
|
||||
|
|
@ -410,7 +396,7 @@ class SampleDataTab(QWidget):
|
|||
horizontal_header = list(
|
||||
itertools.chain(
|
||||
["Color", "Sample"],
|
||||
[str(stg.columns_fine[0]), str(stg.columns_fine[2])],
|
||||
list(map(str, stg.columns_fine[[0, 2]])),
|
||||
list(map(str, stg.columns_fine[3:]))
|
||||
)
|
||||
)
|
||||
|
|
@ -509,7 +495,7 @@ class SampleDataTab(QWidget):
|
|||
horizontal_header = list(
|
||||
itertools.chain(
|
||||
["Color", "Sample"],
|
||||
[str(stg.columns_fine[0]), str(stg.columns_fine[2])],
|
||||
list(map(str, stg.columns_sand[[0, 2]])),
|
||||
list(map(str, stg.columns_sand[3:]))
|
||||
)
|
||||
)
|
||||
|
|
@ -1012,7 +998,7 @@ class SampleDataTab(QWidget):
|
|||
|
||||
self.axis_plot_sample_position_on_transect.text(
|
||||
1, .85, stg.freq_text[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()],
|
||||
fontsize=14, fontweight='bold', fontname="DejaVu Sans", c="black", alpha=0.5,
|
||||
fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5,
|
||||
horizontalalignment='right', verticalalignment='bottom',
|
||||
transform=self.axis_plot_sample_position_on_transect.transAxes)
|
||||
|
||||
|
|
@ -1020,11 +1006,11 @@ class SampleDataTab(QWidget):
|
|||
self.axis_plot_sample_position_on_transect.tick_params(axis='both', labelsize=8)
|
||||
|
||||
self.axis_plot_sample_position_on_transect.text(.98, .03, "Time (sec)",
|
||||
fontsize=10, fontweight='bold', fontname="DejaVu Sans", c="black", alpha=0.9,
|
||||
fontsize=10, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.9,
|
||||
horizontalalignment='right', verticalalignment='bottom', rotation='horizontal',
|
||||
transform=self.axis_plot_sample_position_on_transect.transAxes)
|
||||
self.axis_plot_sample_position_on_transect.text(.04, .53, "Depth (m)",
|
||||
fontsize=10, fontweight='bold', fontname="DejaVu Sans", c="black", alpha=0.9,
|
||||
fontsize=10, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.9,
|
||||
horizontalalignment='right', verticalalignment='bottom', rotation='vertical',
|
||||
transform=self.axis_plot_sample_position_on_transect.transAxes)
|
||||
|
||||
|
|
@ -1338,7 +1324,7 @@ class SampleDataTab(QWidget):
|
|||
|
||||
self.axis_plot_sample_position_on_transect.text(
|
||||
1, .85, stg.freq_text[self.combobox_acoustic_data.currentIndex()][self.combobox_frequencies.currentIndex()],
|
||||
fontsize=14, fontweight='bold', fontname="DejaVu Sans", c="black", alpha=0.5,
|
||||
fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5,
|
||||
horizontalalignment='right', verticalalignment='bottom',
|
||||
transform=self.axis_plot_sample_position_on_transect.transAxes)
|
||||
|
||||
|
|
@ -1346,13 +1332,13 @@ class SampleDataTab(QWidget):
|
|||
self.axis_plot_sample_position_on_transect.tick_params(axis='both', labelsize=8)
|
||||
|
||||
self.axis_plot_sample_position_on_transect.text(.98, .03, "Time (sec)",
|
||||
fontsize=10, fontweight='bold', fontname="DejaVu Sans", c="black",
|
||||
fontsize=10, fontweight='bold', fontname="Ubuntu", c="black",
|
||||
alpha=0.9,
|
||||
horizontalalignment='right', verticalalignment='bottom',
|
||||
rotation='horizontal',
|
||||
transform=self.axis_plot_sample_position_on_transect.transAxes)
|
||||
self.axis_plot_sample_position_on_transect.text(.04, .53, "Depth (m)",
|
||||
fontsize=10, fontweight='bold', fontname="DejaVu Sans", c="black",
|
||||
fontsize=10, fontweight='bold', fontname="Ubuntu", c="black",
|
||||
alpha=0.9,
|
||||
horizontalalignment='right', verticalalignment='bottom',
|
||||
rotation='vertical',
|
||||
|
|
|
|||
|
|
@ -857,14 +857,6 @@ class SedimentCalibrationTab(QWidget):
|
|||
# ----------------------------------- Functions for Signal processing Tab --------------------------------------
|
||||
# ==============================================================================================================
|
||||
|
||||
def full_update(self):
|
||||
logger.debug(f"{__name__}: Update")
|
||||
self.blockSignals(True)
|
||||
|
||||
self.function_pushbutton_update_acoustic_file()
|
||||
|
||||
self.blockSignals(False)
|
||||
|
||||
def function_pushbutton_update_acoustic_file(self):
|
||||
if len(stg.data_preprocessed) == 0:
|
||||
return
|
||||
|
|
@ -1784,6 +1776,10 @@ class SedimentCalibrationTab(QWidget):
|
|||
)
|
||||
|
||||
def update_label_kt_value_for_calibration(self):
|
||||
print("self.combobox_freq1.currentIndex() ",
|
||||
self.combobox_freq1.currentIndex(),
|
||||
self.combobox_freq1.currentText())
|
||||
|
||||
freq_1 = self.combobox_freq1.currentIndex()
|
||||
freq_2 = self.combobox_freq2.currentIndex()
|
||||
|
||||
|
|
|
|||
|
|
@ -509,33 +509,14 @@ class SignalProcessingTab(QWidget):
|
|||
self.icon_clear = QIcon(path_icon("clear.png"))
|
||||
self.icon_apply = QIcon(path_icon("circle_green_arrow_right.png"))
|
||||
|
||||
def full_update(self):
|
||||
logger.debug(f"{__name__}: Update")
|
||||
self.blockSignals(True)
|
||||
self.combobox_acoustic_data_choice.blockSignals(True)
|
||||
|
||||
self.full_update_fill_text()
|
||||
self.update_SignalPreprocessingTab(recompute=True)
|
||||
# --------------------------------------------------------------------------------------------------------------
|
||||
# --------------------------------------------------------------------------------------------------------------
|
||||
# +++++++++ FUNCTION +++++++++
|
||||
# --------------------------------------------------------------------------------------------------------------
|
||||
# --------------------------------------------------------------------------------------------------------------
|
||||
|
||||
self.combobox_acoustic_data_choice.blockSignals(False)
|
||||
self.blockSignals(False)
|
||||
|
||||
def full_update_fill_text(self):
|
||||
data_id = self.combobox_acoustic_data_choice.currentIndex()
|
||||
|
||||
self.lineEdit_profile_tail_value.setText(
|
||||
str(stg.noise_value[data_id])
|
||||
)
|
||||
|
||||
self.lineEdit_SNR_criterion.setText(
|
||||
str(stg.SNR_filter_value[data_id])
|
||||
)
|
||||
|
||||
self.lineEdit_horizontal_average.setText(
|
||||
str(stg.Nb_cells_to_average_BS_signal[data_id])
|
||||
)
|
||||
|
||||
def update_SignalPreprocessingTab(self, recompute=True):
|
||||
def update_SignalPreprocessingTab(self):
|
||||
|
||||
""" The tab is updated in two cases :
|
||||
- the user remove a file (in the list widget) in the first tab (Acoustic data), so that the combobox
|
||||
|
|
@ -573,9 +554,7 @@ class SignalProcessingTab(QWidget):
|
|||
stg.freq_text[data_id]
|
||||
)
|
||||
|
||||
if recompute:
|
||||
self.recompute()
|
||||
|
||||
self.replot()
|
||||
|
||||
logger.debug("Update the Signal preprocessing tab... Done")
|
||||
|
|
@ -803,17 +782,9 @@ class SignalProcessingTab(QWidget):
|
|||
|
||||
self.compute_average_profile_tail()
|
||||
|
||||
self.lineEdit_SNR_criterion.setText(
|
||||
str(stg.SNR_filter_value[
|
||||
self.combobox_acoustic_data_choice.currentIndex()
|
||||
])
|
||||
)
|
||||
self.lineEdit_SNR_criterion.setText(str(stg.SNR_filter_value[self.combobox_acoustic_data_choice.currentIndex()]))
|
||||
|
||||
self.lineEdit_horizontal_average.setText(
|
||||
str(stg.Nb_cells_to_average_BS_signal[
|
||||
self.combobox_acoustic_data_choice.currentIndex()
|
||||
])
|
||||
)
|
||||
self.lineEdit_horizontal_average.setText(str(stg.Nb_cells_to_average_BS_signal[self.combobox_acoustic_data_choice.currentIndex()]))
|
||||
|
||||
self.combobox_frequency_profile.clear()
|
||||
self.combobox_frequency_profile.addItems(
|
||||
|
|
|
|||
|
|
@ -27,10 +27,5 @@ class UserManualTab(QWidget):
|
|||
# self.label_picture_theory.resize(np.int(pic.width()/100), np.int(pic.height()/100))
|
||||
# self.verticalLayout_main.addWidget(self.label_picture_theory)
|
||||
|
||||
def full_update(self):
|
||||
logger.debug(f"{__name__}: Update")
|
||||
self.blockSignals(True)
|
||||
|
||||
# TODO: Update all widgets
|
||||
|
||||
self.blockSignals(False)
|
||||
|
|
|
|||
24
main.py
24
main.py
|
|
@ -95,15 +95,6 @@ class MainApplication(QMainWindow):
|
|||
|
||||
# self.user_manual_tab = UserManualTab(self.ui_mainwindow.tab7)
|
||||
|
||||
self.tabs = [
|
||||
self.acoustic_data_tab,
|
||||
self.signal_processing_tab,
|
||||
self.sample_data_tab,
|
||||
self.sediment_calibration_tab,
|
||||
self.acoustic_inversion_tab,
|
||||
self.note_tab
|
||||
]
|
||||
|
||||
# **************************************************
|
||||
# ---------------- Text File Error -----------------
|
||||
|
||||
|
|
@ -117,17 +108,14 @@ class MainApplication(QMainWindow):
|
|||
# traceback.TracebackException.from_exception(e).print(file=sortie)
|
||||
|
||||
def open_study_update_tabs(self):
|
||||
for tab in self.tabs:
|
||||
tab.full_update()
|
||||
self.acoustic_data_tab.combobox_ABS_system_choice.setCurrentText(stg.ABS_name[0])
|
||||
self.acoustic_data_tab.fileListWidget.addFilenames(stg.filename_BS_raw_data)
|
||||
|
||||
# self.acoustic_data_tab.combobox_ABS_system_choice.setCurrentText(stg.ABS_name[0])
|
||||
# self.acoustic_data_tab.fileListWidget.addFilenames(stg.filename_BS_raw_data)
|
||||
self.signal_processing_tab.combobox_acoustic_data_choice.addItems(stg.filename_BS_raw_data)
|
||||
|
||||
# self.signal_processing_tab.combobox_acoustic_data_choice.addItems(stg.filename_BS_raw_data)
|
||||
|
||||
# self.sample_data_tab.fill_comboboxes_and_plot_transect()
|
||||
# self.sample_data_tab.lineEdit_fine_sediment.setText(stg.filename_fine)
|
||||
# self.sample_data_tab.lineEdit_fine_sediment.setToolTip(stg.path_fine)
|
||||
self.sample_data_tab.fill_comboboxes_and_plot_transect()
|
||||
self.sample_data_tab.lineEdit_fine_sediment.setText(stg.filename_fine)
|
||||
self.sample_data_tab.lineEdit_fine_sediment.setToolTip(stg.path_fine)
|
||||
# self.sample_data_tab.fill_table_fine()
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
Loading…
Reference in New Issue