From e5639100fac37ad387667078c5681b25ec72e623 Mon Sep 17 00:00:00 2001 From: Jose Velazquez Date: Fri, 14 Oct 2022 16:56:42 -0500 Subject: [PATCH] Inherit signal timestamp to signals created from father signal --- src/urh/controller/widgets/SignalFrame.py | 2 +- src/urh/signalprocessing/Signal.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/urh/controller/widgets/SignalFrame.py b/src/urh/controller/widgets/SignalFrame.py index cb086078a..adb58ca02 100644 --- a/src/urh/controller/widgets/SignalFrame.py +++ b/src/urh/controller/widgets/SignalFrame.py @@ -1263,7 +1263,7 @@ def on_bandpass_filter_triggered(self, f_low: float, f_high: float): time.sleep(0.1) filtered = np.frombuffer(filtered.get_obj(), dtype=np.complex64) - signal = self.signal.create_new(new_data=filtered.astype(np.complex64)) + signal = self.signal.create_new(new_data=filtered.astype(np.complex64), new_timestamp=self.signal.timestamp) signal.name = self.signal.name + " filtered with f_low={0:.4n} f_high={1:.4n} bw={2:.4n}".format(f_low, f_high, filter_bw) self.signal_created.emit(signal) diff --git a/src/urh/signalprocessing/Signal.py b/src/urh/signalprocessing/Signal.py index c63006e4a..af63aaf81 100644 --- a/src/urh/signalprocessing/Signal.py +++ b/src/urh/signalprocessing/Signal.py @@ -440,13 +440,15 @@ def calc_relative_noise_threshold_from_range(self, noise_start: int, noise_end: logger.warning("Could not calculate noise threshold for range {}-{}".format(noise_start, noise_end)) return self.noise_threshold_relative - def create_new(self, start=0, end=0, new_data=None): + def create_new(self, start=0, end=0, new_data=None, new_timestamp=0): new_signal = Signal("", "New " + self.name) if new_data is None: new_signal.iq_array = IQArray(self.iq_array[start:end]) + new_signal.__timestamp = self.timestamp + (start / self.sample_rate) else: new_signal.iq_array = IQArray(new_data) + new_signal.__timestamp = new_timestamp new_signal._noise_threshold = self.noise_threshold new_signal.noise_min_plot = self.noise_min_plot