Signal processing: Fix 'time_noise' and 'depth_noise' recomputation.

dev
Pierre-Antoine 2025-04-24 11:22:31 +02:00
parent 84fe5738a3
commit 68d3bd14aa
2 changed files with 16 additions and 27 deletions

View File

@ -199,12 +199,17 @@ class ReadTableForOpen:
logger.debug(f"- stg.kt_read {stg.kt_read}") logger.debug(f"- stg.kt_read {stg.kt_read}")
logger.debug(f"- stg.kt_corrected {stg.kt_corrected}") logger.debug(f"- stg.kt_corrected {stg.kt_corrected}")
logger.debug(f"- stg.nb_profiles {stg.nb_profiles}") 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_profiles_per_sec {stg.nb_profiles_per_sec}"
)
logger.debug(f"- stg.nb_cells {stg.nb_cells}") logger.debug(f"- stg.nb_cells {stg.nb_cells}")
logger.debug(f"- stg.cell_size {stg.cell_size}") logger.debug(f"- stg.cell_size {stg.cell_size}")
logger.debug(f"- stg.pulse_length {stg.pulse_length}") 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_per_sec {stg.nb_pings_per_sec}")
logger.debug(f"- stg.nb_pings_averaged_per_profile {stg.nb_pings_averaged_per_profile}") logger.debug(
"- stg.nb_pings_averaged_per_profile "
+ f"{stg.nb_pings_averaged_per_profile}"
)
logger.debug(f"- stg.gain_rx {stg.gain_rx}") logger.debug(f"- stg.gain_rx {stg.gain_rx}")
logger.debug(f"- stg.gain_tx {stg.gain_tx}") logger.debug(f"- stg.gain_tx {stg.gain_tx}")
@ -379,8 +384,8 @@ class ReadTableForOpen:
it = iter(data) it = iter(data)
time = next(it) time = np_f64_parse(next(it))
depth = next(it) depth = np_f64_parse(next(it))
BS = np_f64_parse(next(it)) BS = np_f64_parse(next(it))
if len(BS) == 0: if len(BS) == 0:
@ -390,12 +395,12 @@ class ReadTableForOpen:
stg.BS_noise_averaged_data.append(np.array([])) stg.BS_noise_averaged_data.append(np.array([]))
else: else:
stg.time_noise.append( stg.time_noise.append(
np_f64_parse(time).reshape( time.reshape(
(stg.freq[i].shape[0], -1) (stg.freq[i].shape[0], -1)
) )
) )
stg.depth_noise.append( stg.depth_noise.append(
np_f64_parse(depth).reshape( depth.reshape(
(stg.freq[i].shape[0], -1) (stg.freq[i].shape[0], -1)
) )
) )

View File

@ -629,33 +629,16 @@ class SignalProcessingTab(QWidget):
if len(stg.BS_noise_raw_data) == 0: if len(stg.BS_noise_raw_data) == 0:
self.load_noise_data_and_compute_SNR() self.load_noise_data_and_compute_SNR()
else: else:
self.compute_noise() for i in range(self.combobox_acoustic_data_choice.count()):
self.compute_noise(i)
elif stg.noise_method[data_id] == 1: elif stg.noise_method[data_id] == 1:
self.compute_noise_from_profile_tail_value() self.compute_noise_from_profile_tail_value()
self.remove_point_with_snr_filter() self.remove_point_with_snr_filter()
self.compute_averaged_BS_data() self.compute_averaged_BS_data()
def compute_noise(self): @trace
data_id = max(0, self.combobox_acoustic_data_choice.currentIndex()) def compute_noise(self, data_id):
if stg.time_cross_section[data_id].shape != (0,):
stg.time_noise[data_id] = (
stg.time_cross_section[data_id]
)
else:
stg.time_noise[data_id] = (
stg.time[data_id]
)
if stg.depth_cross_section[data_id].shape != (0,):
stg.depth_noise[data_id] = (
stg.depth_cross_section[data_id]
)
else:
stg.depth_noise[data_id] = (
stg.depth[data_id]
)
if self._is_correct_shape(stg.BS_stream_bed): if self._is_correct_shape(stg.BS_stream_bed):
BS_data = stg.BS_stream_bed BS_data = stg.BS_stream_bed
SNR_data = stg.SNR_stream_bed SNR_data = stg.SNR_stream_bed
@ -1139,6 +1122,7 @@ class SignalProcessingTab(QWidget):
self.compute_noise_from_profile_tail_value_compute() self.compute_noise_from_profile_tail_value_compute()
@trace
def compute_noise_from_profile_tail_value_compute(self): def compute_noise_from_profile_tail_value_compute(self):
data_id = max(0, self.combobox_acoustic_data_choice.currentIndex()) data_id = max(0, self.combobox_acoustic_data_choice.currentIndex())