mirror of
https://github.com/jonathanhogg/scopething
synced 2025-07-14 03:02:09 +01:00
Small efficiency improvements in processing results of capture
This commit is contained in:
9
scope.py
9
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])
|
value_multiplier, value_offset = (1, 0) if raw else ((high-low), low+self.analog_offsets[channel])
|
||||||
if capture_mode.sample_width == 2:
|
if capture_mode.sample_width == 2:
|
||||||
data = struct.unpack(f'>{asamples}h', data)
|
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:
|
else:
|
||||||
data = [(value/256)*value_multiplier + value_offset for value in data]
|
data = ((value/256)*value_multiplier + value_offset for value in data)
|
||||||
traces[channel] = {(t+dump_channel*ticks*clock_scale)*self.capture_clock_period: value
|
ts = (t*self.capture_clock_period for t in range(start_timestamp+dump_channel*ticks*clock_scale, timestamp,
|
||||||
for (t, value) in zip(range(start_timestamp, timestamp, ticks*clock_scale*len(analog_channels)), data)}
|
ticks*clock_scale*len(analog_channels)))
|
||||||
|
traces[channel] = dict(zip(ts, data))
|
||||||
|
|
||||||
if logic_channels:
|
if logic_channels:
|
||||||
async with self.transaction():
|
async with self.transaction():
|
||||||
|
Reference in New Issue
Block a user