N = 100 for i in tnrange(N, desc='Capturing traces'): scope.arm() if text[0] & 0x01: text[0] = 0xFF else: text[0] = 0x00 target.simpleserial_write('p', text) ret = scope.capture() if ret: print("Target timed out!") continue response = target.simpleserial_read('r', 16) trace_array.append(scope.get_last_trace()) textin_array.append(text) key, text = ktp.next()
将数据分为两组,并将结果转为numpy array类型
1 2 3 4 5 6 7 8
zero_list=[] one_list=[] for i inrange(len(trace_array)): if textin_array[i][0] == 0x00: zero_list.append(trace_array[i]) else: one_list.append(trace_array[i])