Acoustic data: Remove useless 'eval' or 'exec'.

dev-brahim
Pierre-Antoine 2025-03-17 17:18:02 +01:00
parent f0150443e3
commit b9ca307c59
1 changed files with 24 additions and 21 deletions

View File

@ -1411,40 +1411,43 @@ class AcousticDataTab(QWidget):
# --- Clear variables ---
list_to_pop1 = [
"stg.acoustic_data", "stg.date", "stg.hour",
"stg.freq", "stg.freq_text",
"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.kt_read", "stg.kt_corrected", "stg.gain_rx", "stg.gain_tx",
"stg.filename_BS_raw_data", "stg.path_BS_raw_data",
"stg.BS_raw_data", "stg.time", "stg.depth",
"stg.BS_raw_data_reshape", "stg.time_reshape", "stg.depth_reshape"
stg.acoustic_data, stg.date, stg.hour,
stg.freq, stg.freq_text,
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.kt_read, stg.kt_corrected, stg.gain_rx, stg.gain_tx,
stg.filename_BS_raw_data, stg.path_BS_raw_data,
stg.BS_raw_data, stg.time, stg.depth,
stg.BS_raw_data_reshape, stg.time_reshape, stg.depth_reshape
]
for p in list_to_pop1:
if isinstance(eval(p), list):
exec(p + ".pop(current_row)")
if isinstance(p, list):
p.pop(current_row)
if stg.BS_cross_section:
list_to_pop2 = ["stg.rmin", "stg.rmax", "stg.tmin", "stg.tmax",
"stg.time_cross_section", "stg.depth_cross_section", "stg.BS_cross_section"]
list_to_pop2 = [
stg.rmin, stg.rmax, stg.tmin, stg.tmax,
stg.time_cross_section, stg.depth_cross_section,
stg.BS_cross_section
]
for k in list_to_pop2:
exec(k + ".pop(current_row)")
k.pop(current_row)
if stg.BS_stream_bed:
list_to_pop3 = ["stg.BS_stream_bed", "stg.depth_bottom",
"stg.val_bottom", "stg.ind_bottom", "stg.freq_bottom_detection"]
list_to_pop3 = [
stg.BS_stream_bed, stg.depth_bottom,
stg.val_bottom, stg.ind_bottom,
stg.freq_bottom_detection
]
for s in list_to_pop3:
exec(s + ".pop(current_row)")
s.pop(current_row)
if self.fileListWidget.count() == 0:
# --- Clear measurements information ---
self.label_date_acoustic_file.clear()
self.label_date_acoustic_file.setText("Date: ")