From d29be6ba76ec885ca1f5bd94ef067e60b63e3e5e Mon Sep 17 00:00:00 2001 From: Jonathan Hogg Date: Tue, 4 Jul 2017 15:42:49 +0100 Subject: [PATCH] Small efficiency improvements in processing results of capture --- scope.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scope.py b/scope.py index 2230f9d..8711253 100755 --- a/scope.py +++ b/scope.py @@ -249,11 +249,12 @@ class Scope(vm.VirtualMachine): value_multiplier, value_offset = (1, 0) if raw else ((high-low), low+self.analog_offsets[channel]) if capture_mode.sample_width == 2: data = struct.unpack(f'>{asamples}h', data) - data = [(value/65536+0.5)*value_multiplier + value_offset for value in data] + data = ((value/65536+0.5)*value_multiplier + value_offset for value in data) else: - data = [(value/256)*value_multiplier + value_offset for value in data] - traces[channel] = {(t+dump_channel*ticks*clock_scale)*self.capture_clock_period: value - for (t, value) in zip(range(start_timestamp, timestamp, ticks*clock_scale*len(analog_channels)), data)} + data = ((value/256)*value_multiplier + value_offset for value in data) + ts = (t*self.capture_clock_period for t in range(start_timestamp+dump_channel*ticks*clock_scale, timestamp, + ticks*clock_scale*len(analog_channels))) + traces[channel] = dict(zip(ts, data)) if logic_channels: async with self.transaction():