Compare commits
16 Commits
2ec5584860
...
6de578a07e
| Author | SHA1 | Date |
|---|---|---|
|
|
6de578a07e | |
|
|
320971160d | |
|
|
190c0f0b80 | |
|
|
2ffb9a21e6 | |
|
|
2b84fab38d | |
|
|
17619f15ac | |
|
|
b26d8a2906 | |
|
|
52b612ba3e | |
|
|
5ebd842346 | |
|
|
4af3c4c9ea | |
|
|
b80e0f3c8e | |
|
|
1c3f6fb015 | |
|
|
3e5ef5d2bc | |
|
|
9c5b76e451 | |
|
|
769fd8581e | |
|
|
dc9264cd65 |
|
|
@ -20,50 +20,54 @@
|
|||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import time
|
||||
import sqlite3
|
||||
import logging
|
||||
|
||||
import numpy as np
|
||||
from PyQt5.QtWidgets import QFileDialog, QApplication, QMessageBox
|
||||
import sqlite3
|
||||
import settings as stg
|
||||
from os import chdir
|
||||
import time
|
||||
|
||||
from PyQt5.QtWidgets import QFileDialog, QApplication, QMessageBox
|
||||
|
||||
import settings as stg
|
||||
from settings import ABS_name
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
class CreateTableForSaveAs:
|
||||
|
||||
def __init__(self):
|
||||
|
||||
self.create_AcousticFile = """CREATE TABLE AcousticFile(
|
||||
ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
acoustic_data INTEGER,
|
||||
acoustic_file STRING,
|
||||
ABS_name STRING,
|
||||
path_BS_noise_data STRING,
|
||||
filename_BS_noise_data STRING,
|
||||
noise_method FLOAT,
|
||||
noise_value FLOAT,
|
||||
ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
acoustic_data INTEGER,
|
||||
acoustic_file STRING,
|
||||
ABS_name STRING,
|
||||
path_BS_noise_data STRING,
|
||||
filename_BS_noise_data STRING,
|
||||
noise_method FLOAT,
|
||||
noise_value FLOAT,
|
||||
data_preprocessed STRING
|
||||
)
|
||||
"""
|
||||
|
||||
self.create_Measure = """ CREATE TABLE Measure(
|
||||
ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
acoustic_data INTEGER,
|
||||
Date DATE,
|
||||
Hour TIME,
|
||||
acoustic_data INTEGER,
|
||||
Date DATE,
|
||||
Hour TIME,
|
||||
frequency FLOAT,
|
||||
sound_attenuation FLOAT,
|
||||
sound_attenuation FLOAT,
|
||||
kt_read FLOAT,
|
||||
kt_corrected FLOAT,
|
||||
NbProfiles FLOAT,
|
||||
NbProfilesPerSeconds FLOAT,
|
||||
NbCells FLOAT,
|
||||
CellSize FLOAT,
|
||||
PulseLength FLOAT,
|
||||
NbPingsPerSeconds FLOAT,
|
||||
NbPingsAveragedPerProfile FLOAT,
|
||||
GainRx FLOAT,
|
||||
kt_corrected FLOAT,
|
||||
NbProfiles FLOAT,
|
||||
NbProfilesPerSeconds FLOAT,
|
||||
NbCells FLOAT,
|
||||
CellSize FLOAT,
|
||||
PulseLength FLOAT,
|
||||
NbPingsPerSeconds FLOAT,
|
||||
NbPingsAveragedPerProfile FLOAT,
|
||||
GainRx FLOAT,
|
||||
GainTx FLOAT
|
||||
)
|
||||
"""
|
||||
|
|
@ -71,15 +75,15 @@ class CreateTableForSaveAs:
|
|||
self.create_BSRawData = '''CREATE TABLE BSRawData(
|
||||
ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
acoustic_data INTEGER,
|
||||
time BLOB, depth BLOB, BS_raw_data BLOB,
|
||||
time BLOB, depth BLOB, BS_raw_data BLOB,
|
||||
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 BLOB,
|
||||
depth_bottom, val_bottom, ind_bottom,
|
||||
time_noise BLOB, depth_noise BLOB, BS_noise_raw_data 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, BS_raw_data_pre_process_average BLOB,
|
||||
BS_cross_section_pre_process_SNR BLOB, BS_cross_section_pre_process_average BLOB,
|
||||
BS_stream_bed_pre_process_SNR BLOB, BS_stream_bed_pre_process_average BLOB,
|
||||
BS_raw_data_pre_process_SNR BLOB, BS_raw_data_pre_process_average BLOB,
|
||||
BS_cross_section_pre_process_SNR BLOB, BS_cross_section_pre_process_average BLOB,
|
||||
BS_stream_bed_pre_process_SNR BLOB, BS_stream_bed_pre_process_average BLOB,
|
||||
BS_mean BLOB
|
||||
)'''
|
||||
|
||||
|
|
@ -88,76 +92,76 @@ class CreateTableForSaveAs:
|
|||
acoustic_data INTEGER,
|
||||
temperature FLOAT,
|
||||
tmin_index FLOAT, tmin_value FLOAT, tmax_index FLOAT, tmax_value FLOAT,
|
||||
rmin_index FLOAT, rmin_value FLOAT, rmax_index FLOAT, rmax_value FLOAT,
|
||||
freq_bottom_detection_index FLOAT, freq_bottom_detection_value STRING,
|
||||
rmin_index FLOAT, rmin_value FLOAT, rmax_index FLOAT, rmax_value FLOAT,
|
||||
freq_bottom_detection_index FLOAT, freq_bottom_detection_value STRING,
|
||||
SNR_filter_value FLOAT, Nb_cells_to_average_BS_signal FLOAT
|
||||
)'''
|
||||
|
||||
self.create_SedimentsFile = """CREATE TABLE SedimentsFile(
|
||||
ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
path_fine STRING,
|
||||
filename_fine STRING,
|
||||
ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
path_fine STRING,
|
||||
filename_fine STRING,
|
||||
radius_grain_fine BLOB,
|
||||
path_sand STRING,
|
||||
filename_sand STRING,
|
||||
radius_grain_sand BLOB,
|
||||
time_column_label STRING,
|
||||
distance_from_bank_column_label STRING,
|
||||
depth_column_label STRING,
|
||||
Ctot_fine_column_label STRING,
|
||||
path_sand STRING,
|
||||
filename_sand STRING,
|
||||
radius_grain_sand BLOB,
|
||||
time_column_label STRING,
|
||||
distance_from_bank_column_label STRING,
|
||||
depth_column_label STRING,
|
||||
Ctot_fine_column_label STRING,
|
||||
D50_fine_column_label STRING,
|
||||
Ctot_sand_column_label STRING,
|
||||
Ctot_sand_column_label STRING,
|
||||
D50_sand_column_label STRING
|
||||
)
|
||||
"""
|
||||
|
||||
self.create_SedimentsData = """CREATE TABLE SedimentsData(
|
||||
ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
sample_fine_name STRING,
|
||||
ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
sample_fine_name STRING,
|
||||
sample_fine_index INTEGER,
|
||||
distance_from_bank_fine FLOAT,
|
||||
depth_fine FLOAT,
|
||||
time_fine FLOAT,
|
||||
distance_from_bank_fine FLOAT,
|
||||
depth_fine FLOAT,
|
||||
time_fine FLOAT,
|
||||
Ctot_fine FLOAT,
|
||||
Ctot_fine_per_cent FLOAT,
|
||||
D50_fine FLOAT,
|
||||
frac_vol_fine BLOB,
|
||||
frac_vol_fine_cumul BLOB,
|
||||
sample_sand_name STRING,
|
||||
Ctot_fine_per_cent FLOAT,
|
||||
D50_fine FLOAT,
|
||||
frac_vol_fine BLOB,
|
||||
frac_vol_fine_cumul BLOB,
|
||||
sample_sand_name STRING,
|
||||
sample_sand_index INTEGER,
|
||||
distance_from_bank_sand FLOAT,
|
||||
depth_sand FLOAT,
|
||||
time_sand FLOAT,
|
||||
distance_from_bank_sand FLOAT,
|
||||
depth_sand FLOAT,
|
||||
time_sand FLOAT,
|
||||
Ctot_sand FLOAT,
|
||||
Ctot_sand_per_cent FLOAT,
|
||||
D50_sand FLOAT,
|
||||
frac_vol_sand BLOB,
|
||||
Ctot_sand_per_cent FLOAT,
|
||||
D50_sand FLOAT,
|
||||
frac_vol_sand BLOB,
|
||||
frac_vol_sand_cumul BLOB
|
||||
)
|
||||
"""
|
||||
|
||||
self.create_Calibration = """CREATE TABLE Calibration(
|
||||
ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
path_calibration_file STRING,
|
||||
filename_calibration_file STRING,
|
||||
range_lin_interp BLOB,
|
||||
M_profile_fine BLOB,
|
||||
ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
path_calibration_file STRING,
|
||||
filename_calibration_file STRING,
|
||||
range_lin_interp BLOB,
|
||||
M_profile_fine BLOB,
|
||||
ks BLOB,
|
||||
sv BLOB,
|
||||
X_exponent BLOB,
|
||||
alpha_s BLOB,
|
||||
zeta BLOB,
|
||||
FCB BLOB,
|
||||
depth_real BLOB,
|
||||
sv BLOB,
|
||||
X_exponent BLOB,
|
||||
alpha_s BLOB,
|
||||
zeta BLOB,
|
||||
FCB BLOB,
|
||||
depth_real BLOB,
|
||||
lin_reg BLOB
|
||||
)"""
|
||||
|
||||
self.create_Inversion = """CREATE TABLE Inversion(
|
||||
ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
J_cross_section_freq1 BLOB,
|
||||
J_cross_section_freq2 BLOB,
|
||||
VBI_cross_section BLOB,
|
||||
SSC_fine BLOB,
|
||||
VBI_cross_section BLOB,
|
||||
SSC_fine BLOB,
|
||||
SSC_sand BLOB
|
||||
)"""
|
||||
|
||||
|
|
@ -165,23 +169,32 @@ class CreateTableForSaveAs:
|
|||
|
||||
|
||||
def open_file_dialog(self):
|
||||
options = QFileDialog.Options()
|
||||
name = QFileDialog.getSaveFileName(
|
||||
caption="Save As", directory="", filter="AcouSed Files (*.acd)", options=QFileDialog.DontUseNativeDialog)
|
||||
name, _ = QFileDialog.getSaveFileName(
|
||||
caption="Save As",
|
||||
directory="",
|
||||
filter="AcouSed Files (*.acd)",
|
||||
options=QFileDialog.DontUseNativeDialog
|
||||
)
|
||||
|
||||
if name[0]:
|
||||
if name != "":
|
||||
filename = os.path.basename(name)
|
||||
if os.path.splitext(filename)[1] != ".acd":
|
||||
filename += ".acd"
|
||||
|
||||
stg.dirname_save_as = "/".join(name[0].split("/")[:-1]) + "/"
|
||||
stg.filename_save_as = name[0].split("/")[-1]
|
||||
logger.debug(f"selected save file: '{filename}'")
|
||||
|
||||
chdir(stg.dirname_save_as)
|
||||
stg.dirname_save_as = os.path.dirname(name)
|
||||
stg.filename_save_as = filename
|
||||
|
||||
try:
|
||||
os.chdir(stg.dirname_save_as)
|
||||
except OSError as e:
|
||||
logger.warning(f"chdir: {str(e)}")
|
||||
|
||||
start = time.time()
|
||||
self.create_table()
|
||||
print(f"end : {time.time() - start} sec")
|
||||
|
||||
else:
|
||||
|
||||
msgBox = QMessageBox()
|
||||
msgBox.setWindowTitle("Save Error")
|
||||
msgBox.setIcon(QMessageBox.Warning)
|
||||
|
|
@ -190,9 +203,9 @@ class CreateTableForSaveAs:
|
|||
msgBox.exec()
|
||||
|
||||
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')
|
||||
cnx = sqlite3.connect(stg.filename_save_as)
|
||||
|
||||
# Create database cursor to execute SQL statements and fetch results from SQL queries.
|
||||
cur = cnx.cursor()
|
||||
|
|
@ -214,8 +227,8 @@ class CreateTableForSaveAs:
|
|||
print('stg.ABS_name', stg.ABS_name)
|
||||
print("stg.path_BS_raw_data ", stg.path_BS_raw_data[i])
|
||||
|
||||
cur.execute(''' INSERT into AcousticFile(acoustic_data, acoustic_file, ABS_name, path_BS_noise_data,
|
||||
filename_BS_noise_data, noise_method, noise_value, data_preprocessed)
|
||||
cur.execute(''' INSERT into AcousticFile(acoustic_data, acoustic_file, ABS_name, path_BS_noise_data,
|
||||
filename_BS_noise_data, noise_method, noise_value, data_preprocessed)
|
||||
VALUES(?, ?, ?, ?, ?, ?, ?, ?)''',
|
||||
(stg.acoustic_data[i], stg.filename_BS_raw_data[i].split('.')[0], stg.ABS_name[i],
|
||||
stg.path_BS_noise_data[i], stg.filename_BS_noise_data[i], stg.noise_method[i],
|
||||
|
|
@ -244,9 +257,9 @@ class CreateTableForSaveAs:
|
|||
|
||||
for j in range(stg.freq[i].shape[0]):
|
||||
|
||||
cur.execute(''' INSERT into Measure(acoustic_data, Date, Hour, frequency, sound_attenuation, kt_read, kt_corrected,
|
||||
NbProfiles, NbProfilesPerSeconds, NbCells, CellSize, PulseLength,
|
||||
NbPingsPerSeconds, NbPingsAveragedPerProfile, GainRx, GainTx
|
||||
cur.execute(''' INSERT into Measure(acoustic_data, Date, Hour, frequency, sound_attenuation, kt_read, kt_corrected,
|
||||
NbProfiles, NbProfilesPerSeconds, NbCells, CellSize, PulseLength,
|
||||
NbPingsPerSeconds, NbPingsAveragedPerProfile, GainRx, GainTx
|
||||
)
|
||||
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)''',
|
||||
(stg.acoustic_data[i], #stg.date[i], stg.hour[i],
|
||||
|
|
@ -276,16 +289,16 @@ class CreateTableForSaveAs:
|
|||
|
||||
for i in stg.acoustic_data:
|
||||
|
||||
cur.execute(''' INSERT into BSRawData(acoustic_data, time, depth, BS_raw_data,
|
||||
cur.execute(''' INSERT into BSRawData(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,
|
||||
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,
|
||||
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_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)
|
||||
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)''',
|
||||
(stg.acoustic_data[i], stg.time[i].tobytes(),
|
||||
|
|
@ -327,9 +340,9 @@ class CreateTableForSaveAs:
|
|||
cur.execute('''INSERT into Settings(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,
|
||||
freq_bottom_detection_index, freq_bottom_detection_value,
|
||||
SNR_filter_value, Nb_cells_to_average_BS_signal
|
||||
)
|
||||
)
|
||||
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)''',
|
||||
(stg.acoustic_data[i], stg.temperature,
|
||||
stg.tmin[i][0], stg.tmin[i][1], stg.tmax[i][0], stg.tmax[i][1],
|
||||
|
|
@ -355,8 +368,8 @@ class CreateTableForSaveAs:
|
|||
cur.execute(self.create_SedimentsFile)
|
||||
|
||||
cur.execute('''INSERT into SedimentsFile(path_fine, filename_fine, radius_grain_fine,
|
||||
path_sand, filename_sand, radius_grain_sand,
|
||||
time_column_label, distance_from_bank_column_label,
|
||||
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)
|
||||
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)''',
|
||||
|
|
@ -382,11 +395,11 @@ class CreateTableForSaveAs:
|
|||
|
||||
for f in range(len(stg.sample_fine)):
|
||||
cur.execute('''INSERT into SedimentsData(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,
|
||||
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
|
||||
depth_sand, time_sand, Ctot_sand, Ctot_sand_per_cent, D50_sand,
|
||||
frac_vol_sand, frac_vol_sand_cumul
|
||||
)
|
||||
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)''',
|
||||
(stg.sample_fine[f][0] , stg.sample_fine[f][1],
|
||||
|
|
@ -413,10 +426,10 @@ class CreateTableForSaveAs:
|
|||
|
||||
cur.execute(self.create_Calibration)
|
||||
|
||||
cur.execute('''INSERT into Calibration(path_calibration_file, filename_calibration_file,
|
||||
cur.execute('''INSERT into Calibration(path_calibration_file, filename_calibration_file,
|
||||
range_lin_interp, M_profile_fine,
|
||||
ks, sv, X_exponent, alpha_s, zeta,
|
||||
FCB, depth_real, lin_reg)
|
||||
FCB, depth_real, lin_reg)
|
||||
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)''',
|
||||
(stg.path_calibration_file, stg.filename_calibration_file,
|
||||
stg.range_lin_interp.tobytes(), stg.M_profile_fine.tobytes(),
|
||||
|
|
@ -441,8 +454,8 @@ class CreateTableForSaveAs:
|
|||
cur.execute(self.create_Inversion)
|
||||
|
||||
for i in range(len(stg.SSC_fine)):
|
||||
cur.execute('''INSERT into Inversion(J_cross_section_freq1, J_cross_section_freq2,
|
||||
VBI_cross_section, SSC_fine, SSC_sand)
|
||||
cur.execute('''INSERT into Inversion(J_cross_section_freq1, J_cross_section_freq2,
|
||||
VBI_cross_section, SSC_fine, SSC_sand)
|
||||
VALUES(?, ?, ?, ?, ?)''',
|
||||
(stg.J_cross_section[i][0].tobytes(), stg.J_cross_section[i][1].tobytes(),
|
||||
stg.VBI_cross_section[i].tobytes(), stg.SSC_fine[i].tobytes(), stg.SSC_sand[i].tobytes())
|
||||
|
|
@ -459,6 +472,3 @@ class CreateTableForSaveAs:
|
|||
|
||||
# Close database connection
|
||||
cnx.close()
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -20,37 +20,50 @@
|
|||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
import os
|
||||
import sys
|
||||
import numpy as np
|
||||
from PyQt5.QtWidgets import QFileDialog, QApplication, QWidget, QTabWidget
|
||||
import sqlite3
|
||||
from os import path, chdir
|
||||
import logging
|
||||
import numpy as np
|
||||
|
||||
from PyQt5.QtWidgets import QFileDialog, QApplication, QWidget, QTabWidget
|
||||
|
||||
import settings as stg
|
||||
from settings import BS_raw_data, acoustic_data
|
||||
|
||||
from View.acoustic_data_tab import AcousticDataTab
|
||||
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
class ReadTableForOpen:
|
||||
|
||||
def __init__(self):
|
||||
self.opened = False
|
||||
|
||||
pass
|
||||
self.open_file_dialog()
|
||||
|
||||
def open_file_dialog(self):
|
||||
name, _ = QFileDialog.getOpenFileName(
|
||||
caption="Open Acoused file",
|
||||
directory="",
|
||||
filter="Acoused file (*.acd)",
|
||||
options=QFileDialog.DontUseNativeDialog
|
||||
)
|
||||
|
||||
name = QFileDialog.getOpenFileName(caption="Open Acoused file", directory="", filter="Acoused file (*.acd)",
|
||||
options=QFileDialog.DontUseNativeDialog)
|
||||
if name != "":
|
||||
stg.dirname_open = os.path.dirname(name)
|
||||
stg.filename_open = os.path.basename(name)
|
||||
|
||||
if name:
|
||||
try:
|
||||
os.chdir(stg.dirname_open)
|
||||
except OSError as e:
|
||||
logger.warning(f"chdir: {str(e)}")
|
||||
|
||||
stg.dirname_open = path.dirname(name[0])
|
||||
stg.filename_open = path.basename(name[0])
|
||||
|
||||
chdir(stg.dirname_open)
|
||||
self.sql_file_to_open = open(stg.filename_open)
|
||||
|
||||
self.read_table()
|
||||
self.opened = True
|
||||
|
||||
|
||||
def read_table(self):
|
||||
|
||||
|
|
@ -76,7 +89,7 @@ class ReadTableForOpen:
|
|||
|
||||
for k in range(len(stg.acoustic_data)):
|
||||
print("hello")
|
||||
query = f'''SELECT acoustic_data, acoustic_file, ABS_name, path_BS_noise_data, filename_BS_noise_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 = cur.execute(query).fetchall()
|
||||
print("data acoustic file", data)
|
||||
|
|
@ -101,8 +114,8 @@ class ReadTableForOpen:
|
|||
stg.hour = [0]*len(stg.acoustic_data)
|
||||
for i in range(len(stg.acoustic_data)):
|
||||
print("i = ", i)
|
||||
query1 = f'''SELECT acoustic_data, Date, Hour, frequency, sound_attenuation, kt_read, kt_corrected, NbProfiles,
|
||||
NbProfilesPerSeconds, NbCells, CellSize, PulseLength, NbPingsPerSeconds, NbPingsAveragedPerProfile,
|
||||
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()
|
||||
|
||||
|
|
@ -140,16 +153,16 @@ class ReadTableForOpen:
|
|||
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,
|
||||
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,
|
||||
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,
|
||||
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
|
||||
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})'''
|
||||
|
||||
data2 = cur.execute(query2).fetchall()
|
||||
|
|
@ -270,10 +283,10 @@ class ReadTableForOpen:
|
|||
# +++++++++++++++++++++++
|
||||
|
||||
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,
|
||||
freq_bottom_detection_index, freq_bottom_detection_value,
|
||||
SNR_filter_value, Nb_cells_to_average_BS_signal
|
||||
FROM Settings WHERE (acoustic_data = {s})'''
|
||||
|
||||
|
|
@ -293,10 +306,10 @@ class ReadTableForOpen:
|
|||
# --- Table Sediment File ---
|
||||
# +++++++++++++++++++++++++++
|
||||
|
||||
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
|
||||
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'''
|
||||
|
||||
data4 = cur.execute(query4).fetchall()
|
||||
|
|
@ -321,10 +334,10 @@ class ReadTableForOpen:
|
|||
# --- Table Sediment Data ---
|
||||
# +++++++++++++++++++++++++++
|
||||
|
||||
query5 = f'''SELECT sample_fine_name, sample_fine_index, distance_from_bank_fine, depth_fine, time_fine,
|
||||
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
|
||||
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()
|
||||
|
|
@ -428,4 +441,3 @@ class ReadTableForOpen:
|
|||
|
||||
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])))
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class UpdateTableForSave:
|
|||
def update_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')
|
||||
cnx = sqlite3.connect(stg.filename_save_as)
|
||||
|
||||
# Create database cursor to execute SQL statements and fetch results from SQL queries.
|
||||
cur = cnx.cursor()
|
||||
|
|
@ -67,12 +67,12 @@ class UpdateTableForSave:
|
|||
|
||||
cur.execute("""CREATE TABLE AcousticFile(ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
acoustic_data INTEGER,
|
||||
acoustic_file STRING,
|
||||
acoustic_file STRING,
|
||||
ABS_name STRING,
|
||||
path_BS_noise_data STRING,
|
||||
filename_BS_noise_data STRING,
|
||||
noise_method FLOAT,
|
||||
noise_value FLOAT,
|
||||
noise_value FLOAT,
|
||||
data_preprocessed STRING
|
||||
)"""
|
||||
)
|
||||
|
|
@ -83,8 +83,8 @@ class UpdateTableForSave:
|
|||
print('stg.ABS_name', stg.ABS_name)
|
||||
print("stg.path_BS_raw_data ", stg.path_BS_raw_data[i])
|
||||
|
||||
cur.execute(''' INSERT into AcousticFile(acoustic_data, acoustic_file, ABS_name, path_BS_noise_data,
|
||||
filename_BS_noise_data, noise_method, noise_value, data_preprocessed)
|
||||
cur.execute(''' INSERT into AcousticFile(acoustic_data, acoustic_file, ABS_name, path_BS_noise_data,
|
||||
filename_BS_noise_data, noise_method, noise_value, data_preprocessed)
|
||||
VALUES(?, ?, ?, ?, ?, ?, ?, ?)''',
|
||||
(stg.acoustic_data[i], stg.filename_BS_raw_data[i].split('.')[0], stg.ABS_name[i],
|
||||
stg.path_BS_noise_data[i], stg.filename_BS_noise_data[i], stg.noise_method[i],
|
||||
|
|
@ -104,42 +104,72 @@ class UpdateTableForSave:
|
|||
# Drop Table if exists
|
||||
cur.execute("DROP TABLE if exists Measure")
|
||||
|
||||
cur.execute("""CREATE TABLE Measure(ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
acoustic_data INTEGER,
|
||||
Date STRING,
|
||||
Hour STRING,
|
||||
frequency FLOAT,
|
||||
sound_attenuation FLOAT,
|
||||
kt_read FLOAT,
|
||||
kt_corrected FLOAT,
|
||||
NbProfiles FLOAT,
|
||||
NbProfilesPerSeconds FLOAT,
|
||||
NbCells FLOAT,
|
||||
CellSize FLOAT,
|
||||
PulseLength FLOAT,
|
||||
NbPingsPerSeconds FLOAT,
|
||||
NbPingsAveragedPerProfile FLOAT,
|
||||
GainRx FLOAT,
|
||||
GainTx FLOAT
|
||||
)
|
||||
""")
|
||||
cur.execute(
|
||||
"""
|
||||
CREATE TABLE Measure(
|
||||
ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
acoustic_data INTEGER,
|
||||
Date STRING,
|
||||
Hour STRING,
|
||||
frequency FLOAT,
|
||||
sound_attenuation FLOAT,
|
||||
kt_read FLOAT,
|
||||
kt_corrected FLOAT,
|
||||
NbProfiles FLOAT,
|
||||
NbProfilesPerSeconds FLOAT,
|
||||
NbCells FLOAT,
|
||||
CellSize FLOAT,
|
||||
PulseLength FLOAT,
|
||||
NbPingsPerSeconds FLOAT,
|
||||
NbPingsAveragedPerProfile FLOAT,
|
||||
GainRx FLOAT,
|
||||
GainTx FLOAT
|
||||
)"""
|
||||
)
|
||||
|
||||
# Fill the table Measure
|
||||
for i in stg.acoustic_data:
|
||||
|
||||
for j in range(stg.freq[i].shape[0]):
|
||||
cur.execute(''' INSERT into Measure(acoustic_data, Date, Hour, frequency, sound_attenuation, kt_read, kt_corrected, NbProfiles,
|
||||
NbProfilesPerSeconds, NbCells, CellSize, PulseLength,
|
||||
NbPingsPerSeconds, NbPingsAveragedPerProfile, GainRx, GainTx,
|
||||
)
|
||||
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)''',
|
||||
(stg.acoustic_data[i], stg.freq[i][j], stg.water_attenuation[i][j], stg.kt_read[j], stg.kt_corrected[j],
|
||||
stg.nb_profiles[i][j], stg.nb_profiles_per_sec[i][j], stg.nb_cells[i][j],
|
||||
stg.cell_size[i][j], stg.pulse_length[i][j], stg.nb_pings_per_sec[i][j],
|
||||
stg.nb_pings_averaged_per_profile[i][j], stg.gain_rx[i][j], stg.gain_tx[i][j],
|
||||
str(stg.date[i].year) + str('-') + str(stg.date[i].month) + str('-') + str(stg.date[i].day),
|
||||
str(stg.hour[i].hour) + str(':') + str(stg.hour[i].minute)
|
||||
))
|
||||
cur.execute(
|
||||
'''
|
||||
INSERT into Measure(
|
||||
acoustic_data,
|
||||
Date, Hour,
|
||||
frequency,
|
||||
sound_attenuation,
|
||||
kt_read, kt_corrected,
|
||||
NbProfiles, NbProfilesPerSeconds,
|
||||
NbCells, CellSize,
|
||||
PulseLength,
|
||||
NbPingsPerSeconds,
|
||||
NbPingsAveragedPerProfile,
|
||||
GainRx, GainTx
|
||||
) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)''',
|
||||
(
|
||||
stg.acoustic_data[i],
|
||||
(
|
||||
str(stg.date[i].year) + str('-') +
|
||||
str(stg.date[i].month) + str('-') +
|
||||
str(stg.date[i].day)
|
||||
),
|
||||
(
|
||||
str(stg.hour[i].hour) + str(':') +
|
||||
str(stg.hour[i].minute)
|
||||
),
|
||||
stg.freq[i][j],
|
||||
stg.water_attenuation[i][j],
|
||||
stg.kt_read[j],
|
||||
stg.kt_corrected[j],
|
||||
stg.nb_profiles[i][j],
|
||||
stg.nb_profiles_per_sec[i][j],
|
||||
stg.nb_cells[i][j],
|
||||
stg.cell_size[i][j],
|
||||
stg.pulse_length[i][j],
|
||||
stg.nb_pings_per_sec[i][j],
|
||||
stg.nb_pings_averaged_per_profile[i][j],
|
||||
stg.gain_rx[i][j], stg.gain_tx[i][j]
|
||||
)
|
||||
)
|
||||
|
||||
# Commit the transaction after executing INSERT.
|
||||
cnx.commit()
|
||||
|
|
@ -150,7 +180,7 @@ class UpdateTableForSave:
|
|||
# +++++++++++++++++++++++++++
|
||||
# --- Table Acoustic Data ---
|
||||
# +++++++++++++++++++++++++++
|
||||
|
||||
|
||||
start_table_BSRawData = time.time()
|
||||
|
||||
cur.execute(''' DROP TABLE BSRawData ''')
|
||||
|
|
@ -158,29 +188,29 @@ class UpdateTableForSave:
|
|||
cur.execute('''CREATE TABLE BSRawData(ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
acoustic_data INTEGER,
|
||||
time BLOB, depth BLOB, BS_raw_data BLOB,
|
||||
time_reshape BLOB, depth_reshape BLOB, BS_raw_data_reshape BLOB,
|
||||
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 BLOB,
|
||||
depth_bottom, val_bottom, ind_bottom,
|
||||
time_noise BLOB, depth_noise BLOB, BS_noise_raw_data 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, BS_raw_data_pre_process_average BLOB,
|
||||
BS_cross_section_pre_process_SNR BLOB, BS_cross_section_pre_process_average BLOB,
|
||||
BS_stream_bed_pre_process_SNR BLOB, BS_stream_bed_pre_process_average BLOB,
|
||||
BS_raw_data_pre_process_SNR BLOB, BS_raw_data_pre_process_average BLOB,
|
||||
BS_cross_section_pre_process_SNR BLOB, BS_cross_section_pre_process_average BLOB,
|
||||
BS_stream_bed_pre_process_SNR BLOB, BS_stream_bed_pre_process_average BLOB,
|
||||
BS_mean BLOB
|
||||
)''')
|
||||
|
||||
for i in stg.acoustic_data:
|
||||
|
||||
cur.execute(''' INSERT into BSRawData(acoustic_data, time, depth, BS_raw_data,
|
||||
cur.execute(''' INSERT into BSRawData(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,
|
||||
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_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)
|
||||
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)''',
|
||||
(stg.acoustic_data[i], stg.time[i].tobytes(), stg.depth[i].tobytes(), stg.BS_raw_data[i].tobytes(),
|
||||
|
|
@ -219,8 +249,8 @@ class UpdateTableForSave:
|
|||
acoustic_data INTEGER,
|
||||
temperature FLOAT,
|
||||
tmin_index FLOAT, tmin_value FLOAT, tmax_index FLOAT, tmax_value FLOAT,
|
||||
rmin_index FLOAT, rmin_value FLOAT, rmax_index FLOAT, rmax_value FLOAT,
|
||||
freq_bottom_detection_index FLOAT, freq_bottom_detection_value STRING,
|
||||
rmin_index FLOAT, rmin_value FLOAT, rmax_index FLOAT, rmax_value FLOAT,
|
||||
freq_bottom_detection_index FLOAT, freq_bottom_detection_value STRING,
|
||||
SNR_filter_value FLOAT, Nb_cells_to_average_BS_signal FLOAT
|
||||
)'''
|
||||
)
|
||||
|
|
@ -229,8 +259,8 @@ class UpdateTableForSave:
|
|||
cur.execute('''INSERT into Settings(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)
|
||||
freq_bottom_detection_index, freq_bottom_detection_value,
|
||||
SNR_filter_value, Nb_cells_to_average_BS_signal)
|
||||
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)''',
|
||||
(stg.acoustic_data[i], stg.temperature,
|
||||
stg.tmin[i][0], stg.tmin[i][1], stg.tmax[i][0], stg.tmax[i][1],
|
||||
|
|
@ -252,29 +282,29 @@ class UpdateTableForSave:
|
|||
|
||||
cur.execute("DROP TABLE if exists SedimentsFile")
|
||||
|
||||
cur.execute("""CREATE TABLE SedimentsFile(ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
path_fine STRING,
|
||||
filename_fine STRING,
|
||||
radius_grain_fine BLOB,
|
||||
path_sand STRING,
|
||||
cur.execute("""CREATE TABLE SedimentsFile(ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
path_fine STRING,
|
||||
filename_fine STRING,
|
||||
radius_grain_fine BLOB,
|
||||
path_sand STRING,
|
||||
filename_sand STRING,
|
||||
radius_grain_sand BLOB,
|
||||
time_column_label STRING,
|
||||
distance_from_bank_column_label STRING,
|
||||
depth_column_label STRING,
|
||||
Ctot_fine_column_label STRING,
|
||||
radius_grain_sand BLOB,
|
||||
time_column_label STRING,
|
||||
distance_from_bank_column_label STRING,
|
||||
depth_column_label STRING,
|
||||
Ctot_fine_column_label STRING,
|
||||
D50_fine_column_label STRING,
|
||||
Ctot_sand_column_label STRING,
|
||||
Ctot_sand_column_label STRING,
|
||||
D50_sand_column_label STRING
|
||||
)"""
|
||||
)
|
||||
|
||||
cur.execute('''INSERT into SedimentsFile(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)
|
||||
cur.execute('''INSERT into SedimentsFile(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)
|
||||
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)''',
|
||||
(stg.path_fine, stg.filename_fine, stg.radius_grain_fine.tobytes(),
|
||||
stg.path_sand, stg.filename_sand, stg.radius_grain_sand.tobytes(),
|
||||
|
|
@ -294,26 +324,26 @@ class UpdateTableForSave:
|
|||
|
||||
cur.execute("DROP TABLE if exists SedimentsData")
|
||||
|
||||
cur.execute("""CREATE TABLE SedimentsData(ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
sample_fine_name STRING,
|
||||
cur.execute("""CREATE TABLE SedimentsData(ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
sample_fine_name STRING,
|
||||
sample_fine_index INTEGER,
|
||||
distance_from_bank_fine FLOAT,
|
||||
depth_fine FLOAT,
|
||||
time_fine FLOAT,
|
||||
distance_from_bank_fine FLOAT,
|
||||
depth_fine FLOAT,
|
||||
time_fine FLOAT,
|
||||
Ctot_fine FLOAT,
|
||||
Ctot_fine_per_cent FLOAT,
|
||||
D50_fine FLOAT,
|
||||
frac_vol_fine BLOB,
|
||||
frac_vol_fine_cumul BLOB,
|
||||
sample_sand_name STRING,
|
||||
Ctot_fine_per_cent FLOAT,
|
||||
D50_fine FLOAT,
|
||||
frac_vol_fine BLOB,
|
||||
frac_vol_fine_cumul BLOB,
|
||||
sample_sand_name STRING,
|
||||
sample_sand_index INTEGER,
|
||||
distance_from_bank_sand FLOAT,
|
||||
depth_sand FLOAT,
|
||||
time_sand FLOAT,
|
||||
distance_from_bank_sand FLOAT,
|
||||
depth_sand FLOAT,
|
||||
time_sand FLOAT,
|
||||
Ctot_sand FLOAT,
|
||||
Ctot_sand_per_cent FLOAT,
|
||||
D50_sand FLOAT,
|
||||
frac_vol_sand BLOB,
|
||||
Ctot_sand_per_cent FLOAT,
|
||||
D50_sand FLOAT,
|
||||
frac_vol_sand BLOB,
|
||||
frac_vol_sand_cumul BLOB
|
||||
)"""
|
||||
)
|
||||
|
|
@ -321,7 +351,7 @@ class UpdateTableForSave:
|
|||
for f in range(len(stg.sample_fine)):
|
||||
cur.execute('''INSERT into SedimentsData(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,
|
||||
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)
|
||||
|
|
@ -349,26 +379,26 @@ class UpdateTableForSave:
|
|||
|
||||
cur.execute("DROP TABLE if exists Calibration")
|
||||
|
||||
cur.execute("""CREATE TABLE Calibration(ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
path_calibration_file STRING,
|
||||
filename_calibration_file STRING,
|
||||
range_lin_interp BLOB,
|
||||
M_profile_fine BLOB,
|
||||
cur.execute("""CREATE TABLE Calibration(ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
path_calibration_file STRING,
|
||||
filename_calibration_file STRING,
|
||||
range_lin_interp BLOB,
|
||||
M_profile_fine BLOB,
|
||||
ks BLOB,
|
||||
sv BLOB,
|
||||
X_exponent BLOB,
|
||||
alpha_s BLOB,
|
||||
zeta BLOB,
|
||||
FCB BLOB,
|
||||
depth_real BLOB,
|
||||
sv BLOB,
|
||||
X_exponent BLOB,
|
||||
alpha_s BLOB,
|
||||
zeta BLOB,
|
||||
FCB BLOB,
|
||||
depth_real BLOB,
|
||||
lin_reg BLOB
|
||||
)"""
|
||||
)
|
||||
|
||||
cur.execute('''INSERT into Calibration(path_calibration_file, filename_calibration_file,
|
||||
cur.execute('''INSERT into Calibration(path_calibration_file, filename_calibration_file,
|
||||
range_lin_interp, M_profile_fine,
|
||||
ks, sv, X_exponent, alpha_s, zeta,
|
||||
FCB, depth_real, lin_reg)
|
||||
FCB, depth_real, lin_reg)
|
||||
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)''',
|
||||
(stg.path_calibration_file, stg.filename_calibration_file,
|
||||
stg.range_lin_interp.tobytes(), stg.M_profile_fine.tobytes(),
|
||||
|
|
@ -390,17 +420,17 @@ class UpdateTableForSave:
|
|||
|
||||
cur.execute("DROP TABLE if exists Inversion")
|
||||
|
||||
cur.execute("""CREATE TABLE Inversion(ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
cur.execute("""CREATE TABLE Inversion(ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
J_cross_section_freq1 BLOB,
|
||||
J_cross_section_freq2 BLOB,
|
||||
VBI_cross_section BLOB,
|
||||
SSC_fine BLOB,
|
||||
VBI_cross_section BLOB,
|
||||
SSC_fine BLOB,
|
||||
SSC_sand BLOB
|
||||
)""")
|
||||
|
||||
for i in range(len(stg.SSC_fine)):
|
||||
cur.execute('''INSERT into Inversion(J_cross_section_freq1, J_cross_section_freq2,
|
||||
VBI_cross_section, SSC_fine, SSC_sand)
|
||||
cur.execute('''INSERT into Inversion(J_cross_section_freq1, J_cross_section_freq2,
|
||||
VBI_cross_section, SSC_fine, SSC_sand)
|
||||
VALUES(?, ?, ?, ?, ?)''',
|
||||
(stg.J_cross_section[i][0].tobytes(), stg.J_cross_section[i][1].tobytes(),
|
||||
stg.VBI_cross_section[i].tobytes(), stg.SSC_fine[i].tobytes(), stg.SSC_sand[i].tobytes())
|
||||
|
|
@ -417,6 +447,3 @@ class UpdateTableForSave:
|
|||
|
||||
# Close database connection
|
||||
cnx.close()
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
108
README.md
108
README.md
|
|
@ -11,85 +11,43 @@ It is divided in six tabs:
|
|||
- Calibration : calibration parameter are computed
|
||||
- Inversion : inversion method is calculated to provide fine and sand sediments fields
|
||||
|
||||
## Software documentation
|
||||
|
||||
### Installation
|
||||
|
||||
## User Manual
|
||||
Acoused is developped for Linux and Windows on Python version 3.8 or
|
||||
greater. By default, Acoused is developped with Pypi package
|
||||
dependencies, but is also possible to use Guix package manager to run
|
||||
Acoused.
|
||||
|
||||
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
|
||||
## Development documentation
|
||||
|
||||
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
|
||||
### **TODO** Windows
|
||||
|
||||
### Linux
|
||||
|
||||
You can use Pypi to get correct software environment and run the
|
||||
program.
|
||||
|
||||
## Support files
|
||||
```shell
|
||||
python3 -m venv venv
|
||||
source ./venv/bin/activate
|
||||
python3 -m pip install -r requirement.txt
|
||||
python3 main.py
|
||||
```
|
||||
|
||||
- [ ] [Acoustic inversion method diagram](https://forgemia.inra.fr/theophile.terraz/acoused/-/blob/main/Acoustic_Inversion_theory.pdf?ref_type=heads)
|
||||
- [ ] [Tutorial AQUAscat software : AQUAtalk](https://forgemia.inra.fr/theophile.terraz/acoused/-/blob/main/Tutorial_AQUAscat_software.pdf?ref_type=heads)
|
||||
### Linux with Guix
|
||||
|
||||
## Integrate with your tools
|
||||
To run Acoused within a [GNU Guix](https://guix.gnu.org/) software
|
||||
environment, you need Guix installed on your computer and run the
|
||||
script `guix.sh` to run the program.
|
||||
|
||||
- [ ] [Set up project integrations](https://gitlab.irstea.fr/brahim/acoused/-/settings/integrations)
|
||||
```shell
|
||||
./guix.sh
|
||||
|
||||
## Collaborate with your team
|
||||
|
||||
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
|
||||
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
|
||||
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
|
||||
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
|
||||
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
|
||||
|
||||
## Test and Deploy
|
||||
|
||||
Use the built-in continuous integration in GitLab.
|
||||
|
||||
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
|
||||
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
|
||||
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
|
||||
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
|
||||
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
|
||||
|
||||
***
|
||||
|
||||
# Editing this README
|
||||
|
||||
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
|
||||
|
||||
## Suggestions for a good README
|
||||
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
|
||||
|
||||
## Name
|
||||
Choose a self-explaining name for your project.
|
||||
|
||||
## Description
|
||||
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
|
||||
|
||||
## Badges
|
||||
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
|
||||
|
||||
## Visuals
|
||||
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
|
||||
|
||||
## Installation
|
||||
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
|
||||
|
||||
## Usage
|
||||
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
|
||||
|
||||
## Support
|
||||
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
|
||||
|
||||
## Roadmap
|
||||
If you have ideas for releases in the future, it is a good idea to list them in the README.
|
||||
|
||||
## Contributing
|
||||
State if you are open to contributions and what your requirements are for accepting them.
|
||||
|
||||
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
|
||||
|
||||
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
|
||||
|
||||
## Acknowledgment
|
||||
This study was conducted within the [Rhône Sediment Observatory](https://observatoire-sediments-rhone.fr/) (OSR), a multi-partner research program funded through the Plan Rhône by the European Regional Development Fund (ERDF), Agence de l’Eau RMC, CNR, EDF and three regional councils (Auvergne-Rhône-Alpes, PACA and Occitanie). It was then also support by CNR.
|
||||
# If you need sqlitebrowser, use this command
|
||||
guix shell sqlitebrowser -- ./guix.sh
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
|
|
@ -102,11 +60,21 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
|||
|
||||
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
## Contacts
|
||||
## Authors & Contacts
|
||||
|
||||
- Brahim MOUDJED 2022-2025 ([INRAE](https://www.inrae.fr/))
|
||||
- Pierre-Antoine ROUBY 2025 ([TECC](https://parouby.fr))
|
||||
|
||||
If you have any questions or suggestions, please contact us to celine.berni@inrae.fr and/or jerome.lecoz@inrae.fr.
|
||||
|
||||
## References
|
||||
## Acknowledgment (Funding)
|
||||
This study was conducted within the [Rhône Sediment Observatory](https://observatoire-sediments-rhone.fr/) (OSR), a multi-partner research program funded through the Plan Rhône by the European Regional Development Fund (ERDF), Agence de l’Eau RMC, CNR, EDF and three regional councils (Auvergne-Rhône-Alpes, PACA and Occitanie). It was also support by CNR.
|
||||
|
||||
## Support files & References
|
||||
|
||||
- [ ] [Acoustic inversion method diagram](https://forgemia.inra.fr/theophile.terraz/acoused/-/blob/main/Acoustic_Inversion_theory.pdf?ref_type=heads)
|
||||
- [ ] [Tutorial AQUAscat software : AQUAtalk](https://forgemia.inra.fr/theophile.terraz/acoused/-/blob/main/Tutorial_AQUAscat_software.pdf?ref_type=heads)
|
||||
|
||||
|
||||
- [ ] [Adrien Vergne thesis (2018)](https://theses.fr/2018GREAU046)
|
||||
- [ ] [Vergne A., Le Coz J., Berni C., & Pierrefeu G. (2020), Water Resources Research, 56(2)](https://doi.org/10.1029/2019WR024877)
|
||||
|
|
|
|||
|
|
@ -21,11 +21,18 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
from PyQt5.QtWidgets import (QWidget, QVBoxLayout, QHBoxLayout, QGroupBox, QPushButton, QComboBox, QLineEdit, QLabel,
|
||||
QGridLayout, QTableView, QSpacerItem, QSizePolicy, QFileDialog, QMessageBox, QScrollArea,
|
||||
QSlider, QMenu, QCheckBox)
|
||||
from PyQt5.QtWidgets import (
|
||||
QWidget, QVBoxLayout, QHBoxLayout, QGroupBox,
|
||||
QPushButton, QComboBox, QLineEdit, QLabel,
|
||||
QGridLayout, QTableView, QSpacerItem, QSizePolicy,
|
||||
QFileDialog, QMessageBox, QScrollArea,
|
||||
QSlider, QMenu, QCheckBox
|
||||
)
|
||||
from PyQt5.QtGui import QPixmap, QIcon
|
||||
from PyQt5.QtCore import Qt, QCoreApplication, pyqtSignal, QEvent, QSize, QPropertyAnimation
|
||||
from PyQt5.QtCore import (
|
||||
Qt, QCoreApplication, pyqtSignal, QEvent, QSize,
|
||||
QPropertyAnimation
|
||||
)
|
||||
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
|
|
@ -35,7 +42,7 @@ from matplotlib.colors import LogNorm, CSS4_COLORS, BoundaryNorm
|
|||
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
|
||||
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolBar
|
||||
|
||||
from os import path
|
||||
import os
|
||||
from copy import deepcopy
|
||||
import locale
|
||||
|
||||
|
|
@ -1232,71 +1239,76 @@ class AcousticDataTab(QWidget):
|
|||
self.combobox_frequency_information.currentIndex()]))
|
||||
|
||||
def open_dialog_box(self):
|
||||
abs_params = [
|
||||
(None, None),
|
||||
("AQUAscat file", "Aquascat file (*.aqa)"),
|
||||
("UBSediFlow file", "UBSediFlow file (*.udt)"),
|
||||
]
|
||||
|
||||
# --- Open dialog box + choice directory and select file ---
|
||||
if self.combobox_ABS_system_choice.currentIndex() == 0:
|
||||
|
||||
system = self.combobox_ABS_system_choice.currentIndex()
|
||||
|
||||
if system == 0:
|
||||
msgBox = QMessageBox()
|
||||
msgBox.setWindowTitle("Download Error")
|
||||
msgBox.setIcon(QMessageBox.Warning)
|
||||
msgBox.setText("Choose ABS system before download acoustic files")
|
||||
msgBox.setStandardButtons(QMessageBox.Ok)
|
||||
msgBox.exec()
|
||||
elif self.combobox_ABS_system_choice.currentIndex() == 1:
|
||||
else:
|
||||
abs_name, abs_file_type = abs_params[system]
|
||||
|
||||
filename = QFileDialog.getOpenFileNames(self, "AQUAscat file",
|
||||
[stg.path_BS_raw_data[-1] if self.fileListWidget.count() > 0 else ""][0],
|
||||
"Aquascat file (*.aqa)",
|
||||
options=QFileDialog.DontUseNativeDialog)
|
||||
filenames, _ = QFileDialog.getOpenFileNames(
|
||||
self, abs_name,
|
||||
[
|
||||
stg.path_BS_raw_data[-1]
|
||||
if self.fileListWidget.count() > 0
|
||||
else ""
|
||||
][0],
|
||||
abs_file_type,
|
||||
options=QFileDialog.DontUseNativeDialog
|
||||
)
|
||||
|
||||
for n in filename[0]:
|
||||
if len(filenames) == 0:
|
||||
return
|
||||
|
||||
stg.path_BS_raw_data.append(path.dirname(n))
|
||||
stg.filename_BS_raw_data.append(path.basename(n))
|
||||
stg.data_preprocessed.append(path.basename(n))
|
||||
for n in filenames:
|
||||
stg.path_BS_raw_data.append(os.path.dirname(n))
|
||||
stg.filename_BS_raw_data.append(os.path.basename(n))
|
||||
stg.data_preprocessed.append(os.path.basename(n))
|
||||
|
||||
elif self.combobox_ABS_system_choice.currentIndex() == 2:
|
||||
filename = QFileDialog.getOpenFileNames(self, "UBSediFlow file",
|
||||
[stg.path_BS_raw_data[-1] if self.fileListWidget.count() > 0 else ""][0],
|
||||
"UBSediFlow file (*.udt)",
|
||||
options=QFileDialog.DontUseNativeDialog)
|
||||
|
||||
for n in filename[0]:
|
||||
|
||||
stg.path_BS_raw_data.append(path.dirname(n))
|
||||
stg.filename_BS_raw_data.append(path.basename(n))
|
||||
stg.data_preprocessed.append(path.basename(n))
|
||||
self.open_acoustic_data()
|
||||
|
||||
def open_acoustic_data(self):
|
||||
# --- Fill lineEdit with path and file names + load acoustic data ---
|
||||
# --- fill date, hour and measurements information + fill frequency combobox for bottom detection ---
|
||||
if self.combobox_ABS_system_choice.currentIndex() != 0:
|
||||
|
||||
system = self.combobox_ABS_system_choice.currentIndex()
|
||||
if system != 0:
|
||||
try:
|
||||
|
||||
self.load_BS_acoustic_raw_data()
|
||||
|
||||
except ValueError as e:
|
||||
|
||||
msgBox = QMessageBox()
|
||||
msgBox.setWindowTitle("Download Error")
|
||||
msgBox.setIcon(QMessageBox.Warning)
|
||||
msgBox.setText("Please select a file")
|
||||
msgBox.setStandardButtons(QMessageBox.Ok)
|
||||
msgBox.exec()
|
||||
|
||||
else:
|
||||
|
||||
if self.fileListWidget.count() == 0:
|
||||
|
||||
for p, f in zip(stg.path_BS_raw_data, stg.filename_BS_raw_data):
|
||||
for p, f in zip(stg.path_BS_raw_data,
|
||||
stg.filename_BS_raw_data):
|
||||
self.fileListWidget.addFilenames([f])
|
||||
self.fileListWidget.setToolTip(p)
|
||||
|
||||
else:
|
||||
|
||||
for k in range(self.fileListWidget.count(), len(stg.filename_BS_raw_data), 1):
|
||||
self.fileListWidget.addFilenames([stg.filename_BS_raw_data[k]])
|
||||
self.fileListWidget.setToolTip(stg.path_BS_raw_data[k])
|
||||
|
||||
for k in range(self.fileListWidget.count(),
|
||||
len(stg.filename_BS_raw_data),
|
||||
1):
|
||||
self.fileListWidget.addFilenames(
|
||||
[stg.filename_BS_raw_data[k]]
|
||||
)
|
||||
self.fileListWidget.setToolTip(
|
||||
stg.path_BS_raw_data[k]
|
||||
)
|
||||
|
||||
self.fill_measurements_information_groupbox()
|
||||
self.fill_table()
|
||||
|
|
@ -1304,7 +1316,11 @@ class AcousticDataTab(QWidget):
|
|||
self.update_frequency_combobox()
|
||||
self.water_attenuation()
|
||||
|
||||
stg.acoustic_data = list(range(self.fileListWidget.count()))
|
||||
stg.acoustic_data = list(
|
||||
range(
|
||||
self.fileListWidget.count()
|
||||
)
|
||||
)
|
||||
|
||||
def rename_file_in_ListWidget(self, event):
|
||||
|
||||
|
|
@ -2719,4 +2735,3 @@ class AcousticDataTab(QWidget):
|
|||
self.update_plot_profile()
|
||||
|
||||
self.fig_BS.canvas.draw_idle()
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ from View.about_window import AboutWindow
|
|||
import settings as stg
|
||||
|
||||
import numpy as np
|
||||
from subprocess import check_call, run
|
||||
from subprocess import Popen
|
||||
|
||||
import time
|
||||
|
||||
|
|
@ -262,37 +262,62 @@ class Ui_MainWindow(object):
|
|||
|
||||
def save_as(self):
|
||||
CreateTableForSaveAs()
|
||||
self.mainwindow.setWindowTitle("AcouSed - " + stg.filename_save_as + ".acd")
|
||||
self.mainwindow.setWindowTitle(
|
||||
"AcouSed - " +
|
||||
stg.filename_save_as
|
||||
)
|
||||
|
||||
def save(self):
|
||||
UpdateTableForSave()
|
||||
|
||||
def open(self):
|
||||
ReadTableForOpen()
|
||||
reader = ReadTableForOpen()
|
||||
if reader.opened:
|
||||
self.mainwindow.open_study_update_tabs()
|
||||
|
||||
def load_calibration_constant_values(self):
|
||||
cc_kt = CalibrationConstantKt()
|
||||
cc_kt.exec()
|
||||
|
||||
def db_browser_for_sqlite(self):
|
||||
check_call("/usr/bin/sqlitebrowser")
|
||||
try:
|
||||
Popen("sqlitebrowser")
|
||||
except OSError as e:
|
||||
msg_box = QtWidgets.QMessageBox()
|
||||
msg_box.setWindowTitle("DB Browser for SQLite Error")
|
||||
msg_box.setIcon(QtWidgets.QMessageBox.Critical)
|
||||
msg_box.setText(f"DB Browser for SQLite Error:\n {str(e)}")
|
||||
msg_box.setStandardButtons(QtWidgets.QMessageBox.Ok)
|
||||
msg_box.exec()
|
||||
|
||||
def about_window(self):
|
||||
print("about")
|
||||
aw = AboutWindow()
|
||||
aw.exec()
|
||||
|
||||
def current_file_path(self, filename):
|
||||
return os.path.abspath(
|
||||
os.path.join(
|
||||
os.path.dirname(__file__),
|
||||
"..", filename
|
||||
)
|
||||
)
|
||||
|
||||
def open_doc_file(self, filename):
|
||||
QtGui.QDesktopServices.openUrl(
|
||||
QtCore.QUrl(
|
||||
f"file://{self.current_file_path(filename)}"
|
||||
)
|
||||
)
|
||||
|
||||
def user_manual(self):
|
||||
open('AcouSed_UserManual.pdf')
|
||||
run(["open", 'AcouSed_UserManual.pdf'])
|
||||
self.open_doc_file('AcouSed_UserManual.pdf')
|
||||
|
||||
def inversion_acoustic_theory(self):
|
||||
open('Acoustic_Inversion_theory.pdf')
|
||||
run(["open", 'Acoustic_Inversion_theory.pdf'])
|
||||
self.open_doc_file('Acoustic_Inversion_theory.pdf')
|
||||
|
||||
def tutorial_AQUAscat_software(self):
|
||||
open('Tutorial_AQUAscat_software.pdf')
|
||||
run(["open", 'Tutorial_AQUAscat_software.pdf'])
|
||||
self.open_doc_file('Tutorial_AQUAscat_software.pdf')
|
||||
|
||||
def export_table_of_acoustic_BS_values_to_excel_or_libreOfficeCalc_file(self):
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import sys
|
||||
|
||||
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QHBoxLayout, QTextEdit, QPushButton, QSpacerItem, \
|
||||
QSpinBox, QSizePolicy, QFontComboBox, QColorDialog
|
||||
from PyQt5.QtWidgets import (
|
||||
QApplication, QWidget, QVBoxLayout, QHBoxLayout,
|
||||
QTextEdit, QPushButton, QSpacerItem, QSpinBox,
|
||||
QSizePolicy, QFontComboBox, QColorDialog
|
||||
)
|
||||
from PyQt5.QtGui import QPixmap, QIcon, QFont
|
||||
from PyQt5.QtCore import Qt
|
||||
|
||||
|
|
@ -189,27 +190,21 @@ class NoteTab(QWidget):
|
|||
self.textEdit.setAlignment(Qt.AlignJustify)
|
||||
|
||||
def print_settings(self):
|
||||
self.textEdit.setText(
|
||||
"Acoustic data: \n\n"
|
||||
f" ABS raw data file: {stg.path_BS_raw_data}/{stg.filename_BS_raw_data} \n"
|
||||
f" ABS noise data file: {stg.path_BS_noise_data}/{stg.filename_BS_noise_data} \n"
|
||||
"\n\n"
|
||||
"------------------------------------------------------------------------- \n\n\n"
|
||||
|
||||
self.textEdit.setText("Acoustic data: \n\n"
|
||||
f" ABS raw data file: {stg.path_BS_raw_data}/{stg.filename_BS_raw_data} \n"
|
||||
f" ABS noise data file: {stg.path_BS_noise_data}/{stg.filename_BS_noise_data} \n"
|
||||
"\n\n"
|
||||
"------------------------------------------------------------------------- \n\n\n"
|
||||
"Particle size data: \n"
|
||||
f" Fine sediments data file: {stg.path_fine}/{stg.filename_fine} \n"
|
||||
f" Sand sediments data file: {stg.path_sand}/{stg.filename_sand} \n"
|
||||
"\n\n"
|
||||
"------------------------------------------------------------------------- \n\n\n"
|
||||
)
|
||||
|
||||
"Particle size data: \n"
|
||||
f" Fine sediments data file: {stg.fine_sediment_path}/{stg.fine_sediment_filename} \n"
|
||||
f" Sand sediments data file: {stg.sand_sediment_path}/{stg.sand_sediment_filename} \n"
|
||||
"\n\n"
|
||||
"------------------------------------------------------------------------- \n\n\n")
|
||||
|
||||
# "Acoustic Inversion parameters: \n"
|
||||
# f" frequencies to compute VBI: {stg.freq_text[int(stg.frequencies_to_compute_VBI[0, 0])]}, "
|
||||
# f"{stg.freq_text[int(stg.frequencies_to_compute_VBI[1, 0])]} \n"
|
||||
# f" frequency to compute SSC: {stg.freq_text[int(stg.frequency_to_compute_SSC[0])]}")
|
||||
|
||||
|
||||
# if __name__ == "__main__":
|
||||
# app = QApplication(sys.argv)
|
||||
# window = NoteTab()
|
||||
# window.show()
|
||||
# sys.exit(app.exec_())
|
||||
# "Acoustic Inversion parameters: \n"
|
||||
# f" frequencies to compute VBI: {stg.freq_text[int(stg.frequencies_to_compute_VBI[0, 0])]}, "
|
||||
# f"{stg.freq_text[int(stg.frequencies_to_compute_VBI[1, 0])]} \n"
|
||||
# f" frequency to compute SSC: {stg.freq_text[int(stg.frequency_to_compute_SSC[0])]}")
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
|
||||
from PyQt5.QtGui import QIcon, QPixmap
|
||||
from PyQt5.QtWidgets import (QWidget, QLabel, QHBoxLayout, QVBoxLayout, QApplication, QMainWindow, QGridLayout,
|
||||
QDialog, QDialogButtonBox, QPushButton, QTextEdit, QFrame, QTabWidget, QScrollArea)
|
||||
from PyQt5.QtCore import Qt
|
||||
QDialog, QFrame, QTabWidget, QScrollArea)
|
||||
|
||||
import numpy as np
|
||||
|
||||
|
|
@ -11,13 +10,8 @@ from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
|
|||
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolBar
|
||||
from matplotlib.colors import LogNorm, BoundaryNorm
|
||||
|
||||
import datetime
|
||||
|
||||
import settings as stg
|
||||
|
||||
from Translation.constant_string import HORIZONTAL
|
||||
from settings import depth_cross_section
|
||||
|
||||
|
||||
class PlotNoiseWindow(QDialog):
|
||||
|
||||
|
|
@ -55,12 +49,10 @@ class PlotNoiseWindow(QDialog):
|
|||
val_min = np.nanmin(stg.BS_noise_raw_data[i][freq_ind, :, :])
|
||||
val_max = np.nanmax(stg.BS_noise_raw_data[i][freq_ind, :, :])
|
||||
|
||||
print("val_min = ", val_min, "val_max = ", val_max)
|
||||
|
||||
if val_min == val_max:
|
||||
exec("pcm = self.ax" + str(i) + "[" + str(freq_ind) + "]" + ".pcolormesh(" +
|
||||
"stg.time[" + str(i) + "][" + str(freq_ind) + ", :]," +
|
||||
"-stg.depth[" + str(i) + "][" + str(freq_ind) + ", :]," +
|
||||
"stg.time_noise[" + str(i) + "][" + str(freq_ind) + ", :]," +
|
||||
"-stg.depth_noise[" + str(i) + "][" + str(freq_ind) + ", :]," +
|
||||
"stg.BS_noise_raw_data[" + str(i) + "][" + str(freq_ind) + ", :, :]," +
|
||||
"cmap='hsv')")
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -1084,23 +1084,20 @@ class SignalProcessingTab(QWidget):
|
|||
val_max = np.nanmax(stg.SNR_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][f, :, :])
|
||||
if val_min == val_max:
|
||||
levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6])
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2]
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max * 1.2]
|
||||
norm = BoundaryNorm(boundaries=bounds, ncolors=300)
|
||||
else:
|
||||
if val_min == 0:
|
||||
val_min = 1e-5
|
||||
if val_max > 1000:
|
||||
levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6])
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2]
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max * 1.2]
|
||||
norm = BoundaryNorm(boundaries=bounds, ncolors=300)
|
||||
else:
|
||||
levels = np.array([00.1, 1, 2, 10, 100, val_max])
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max * 1000]
|
||||
levels = np.array([00.1, 1, 2, 10, 100, 1000, val_max * 1000 + 1])
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max * 1000 + 1]
|
||||
norm = BoundaryNorm(boundaries=bounds, ncolors=300)
|
||||
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2]
|
||||
norm = BoundaryNorm(boundaries=bounds, ncolors=300)
|
||||
|
||||
cf = (self.axis_SNR[f].contourf(x, -y,
|
||||
stg.SNR_stream_bed[self.combobox_acoustic_data_choice.currentIndex()][f, :, :],
|
||||
levels, cmap='gist_rainbow',
|
||||
|
|
@ -1140,24 +1137,21 @@ class SignalProcessingTab(QWidget):
|
|||
val_max = np.nanmax(stg.SNR_cross_section[self.combobox_acoustic_data_choice.currentIndex()][f, :, :])
|
||||
if val_min == val_max:
|
||||
levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6])
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2]
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max * 1.2]
|
||||
norm = BoundaryNorm(boundaries=bounds, ncolors=300)
|
||||
else:
|
||||
if val_min == 0:
|
||||
val_min = 1e-5
|
||||
if val_max > 1000:
|
||||
levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6])
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2]
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max * 1.2]
|
||||
norm = BoundaryNorm(boundaries=bounds, ncolors=300)
|
||||
|
||||
else:
|
||||
levels = np.array([00.1, 1, 2, 10, 100, val_max])
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max * 1000]
|
||||
levels = np.array([00.1, 1, 2, 10, 100, 1000, val_max * 1000 + 1])
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max * 1000 + 1]
|
||||
norm = BoundaryNorm(boundaries=bounds, ncolors=300)
|
||||
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2]
|
||||
norm = BoundaryNorm(boundaries=bounds, ncolors=300)
|
||||
|
||||
cf = (self.axis_SNR[f].contourf(x, -y,
|
||||
stg.SNR_cross_section[
|
||||
self.combobox_acoustic_data_choice.currentIndex()][f, :, :],
|
||||
|
|
@ -1172,18 +1166,18 @@ class SignalProcessingTab(QWidget):
|
|||
val_max = np.nanmax(stg.SNR_raw_data[self.combobox_acoustic_data_choice.currentIndex()][f, :, :])
|
||||
if val_min == val_max:
|
||||
levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6])
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2]
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max * 1.2]
|
||||
norm = BoundaryNorm(boundaries=bounds, ncolors=300)
|
||||
else:
|
||||
if val_min == 0:
|
||||
val_min = 1e-5
|
||||
if val_max > 1000:
|
||||
levels = np.array([00.1, 1, 2, 10, 100, 1000, 1e6])
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max, val_max * 1.2]
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max * 1.2]
|
||||
norm = BoundaryNorm(boundaries=bounds, ncolors=300)
|
||||
else:
|
||||
levels = np.array([00.1, 1, 2, 10, 100, val_max])
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max * 1000]
|
||||
levels = np.array([00.1, 1, 2, 10, 100, 1000, val_max*1000 + 1])
|
||||
bounds = [00.1, 1, 2, 10, 100, 1000, val_max * 1000 + 1]
|
||||
norm = BoundaryNorm(boundaries=bounds, ncolors=300)
|
||||
|
||||
cf = (self.axis_SNR[f].contourf(x, -y,
|
||||
|
|
|
|||
27
main.py
27
main.py
|
|
@ -1,4 +1,5 @@
|
|||
import sys
|
||||
import logging
|
||||
import traceback
|
||||
|
||||
from PyQt5.QtWidgets import QApplication, QMainWindow
|
||||
|
|
@ -26,6 +27,13 @@ import matplotlib.pyplot as plt
|
|||
PERCENT_SCREEN_SIZE = 0.85
|
||||
_translate = QCoreApplication.translate
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.DEBUG,
|
||||
format=('[AcouSed][%(levelname)s] %(message)s')
|
||||
)
|
||||
|
||||
logger = logging.getLogger()
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
||||
class MainApplication(QMainWindow):
|
||||
|
||||
|
|
@ -41,15 +49,18 @@ class MainApplication(QMainWindow):
|
|||
height = size.height()
|
||||
self.resize(int(PERCENT_SCREEN_SIZE*width), int(PERCENT_SCREEN_SIZE*height))
|
||||
try:
|
||||
self.read_table_open = ReadTableForOpen()
|
||||
# **************************************************
|
||||
# -------------- Acoustic data tab ---------------
|
||||
|
||||
self.acoustic_data_tab = AcousticDataTab(self.ui_mainwindow.tab1)
|
||||
print("0 AcousticDataTab ", id(AcousticDataTab))
|
||||
|
||||
self.acoustic_data_tab.combobox_ABS_system_choice.editTextChanged.connect(
|
||||
self.acoustic_data_tab.ABS_system_choice)
|
||||
self.acoustic_data_tab\
|
||||
.combobox_ABS_system_choice\
|
||||
.editTextChanged\
|
||||
.connect(
|
||||
self.acoustic_data_tab.ABS_system_choice
|
||||
)
|
||||
|
||||
# **************************************************
|
||||
# --------- Signal pre-processing data tab ----------
|
||||
|
|
@ -84,20 +95,19 @@ class MainApplication(QMainWindow):
|
|||
|
||||
# self.user_manual_tab = UserManualTab(self.ui_mainwindow.tab7)
|
||||
|
||||
self.ui_mainwindow.actionOpen.triggered.connect(self.trig_open)
|
||||
|
||||
# **************************************************
|
||||
# ---------------- Text File Error -----------------
|
||||
|
||||
except Exception as e:
|
||||
logger.error(str(e))
|
||||
logger.error(traceback.format_exc())
|
||||
|
||||
with open("Error_file.txt", "w", encoding="utf-8") as sortie:
|
||||
sortie.write(str(e))
|
||||
sortie.write(traceback.format_exc())
|
||||
# traceback.TracebackException.from_exception(e).print(file=sortie)
|
||||
|
||||
def trig_open(self):
|
||||
self.read_table_open.open_file_dialog()
|
||||
|
||||
def open_study_update_tabs(self):
|
||||
self.acoustic_data_tab.combobox_ABS_system_choice.setCurrentText(stg.ABS_name[0])
|
||||
self.acoustic_data_tab.fileListWidget.addFilenames(stg.filename_BS_raw_data)
|
||||
|
||||
|
|
@ -108,7 +118,6 @@ class MainApplication(QMainWindow):
|
|||
self.sample_data_tab.lineEdit_fine_sediment.setToolTip(stg.path_fine)
|
||||
# self.sample_data_tab.fill_table_fine()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# print("sys.argv:", [arg for arg in sys.argv])
|
||||
# app = MainApplication(sys.argv)
|
||||
|
|
|
|||
|
|
@ -210,4 +210,4 @@ user-defined extensions).")
|
|||
"python-scipy" "python-scikit-learn"
|
||||
"python-pyqt@5" "python-pyqt5-sip"
|
||||
"python-numpy@1" "python-pandas@1.5"
|
||||
"python-matplotlib"))))
|
||||
"python-matplotlib" "python-odfpy"))))
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
matplotlib==3.6.3
|
||||
numpy==1.23.5
|
||||
pandas==1.5.3
|
||||
PyQt5==5.15.9
|
||||
PyQt5-Qt5==5.15.2
|
||||
PyQt5-sip==12.11.0
|
||||
python-dateutil==2.8.2
|
||||
scikit-learn==1.2.1
|
||||
scipy==1.10.0
|
||||
pyqt-file-list-widget==0.0.1
|
||||
qtrangeslider==0.1.5
|
||||
astropy==6.1.7
|
||||
odfpy==1.4.1
|
||||
Loading…
Reference in New Issue