import sys
import os
from notscared import snr
from notscared.data import trace_handler
from notscared import cpa
import time
import matplotlib.pyplot as plt
import numpy as np
initialization
Results_1 = {}
Results_15 = {}
db_file = '1x1x100000_r1_singlerail5_sr_ise.zarr'
proj_root = os.getcwd()
file_name = os.path.join(proj_root, db_file)
print(file_name)
/Users/utkarshsaxenna/Documents/capstone/notscared2/benchmarking/1x1x100000_r1_singlerail5_sr_ise.zarr
25k traces and 1 byte
initial = 75000
to_avg = np.array([])
th = trace_handler.TraceHandler(fileName=file_name,
batchSize=5000,
batchStart=initial)
for i in range(3):
th.set_cursor(initial)
temp = snr.SNR(Tracehandler=th, Bytes=[0], file_name=file_name)
start = time.perf_counter()
temp.run()
stop = time.perf_counter()
to_avg = np.append(to_avg, stop-start)
avg = np.mean(to_avg)
print(avg)
Results_1[25000] = avg
opened zarr file /Users/utkarshsaxenna/Documents/capstone/notscared2/benchmarking/1x1x100000_r1_singlerail5_sr_ise.zarr
Computing SNR: Tiles: False Bytes: [0]
Computing SNR: Tiles: False Bytes: [0]
Computing SNR: Tiles: False Bytes: [0]
5.133082930663174
25k traces and 16 bytes
initial = 75000
to_avg = np.array([])
th = trace_handler.TraceHandler(fileName=file_name,
batchSize=5000,
batchStart=initial)
for i in range(3):
th.set_cursor(initial)
temp = snr.SNR(Tracehandler=th, Bytes=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15], file_name=file_name)
start = time.perf_counter()
temp.run()
stop = time.perf_counter()
to_avg = np.append(to_avg, stop-start)
avg = np.mean(to_avg)
print(avg)
Results_15[25000] = avg
opened zarr file /Users/utkarshsaxenna/Documents/capstone/notscared2/1x1x100000_r1_singlerail5_sr_ise.zarr
Computing SNR: Tiles: False Bytes: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
Computing SNR: Tiles: False Bytes: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
Computing SNR: Tiles: False Bytes: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
15.1849780829992
50k traces and 1 byte
initial = 50000
to_avg = np.array([])
th = trace_handler.TraceHandler(fileName=file_name,
batchSize=5000,
batchStart=initial)
for i in range(3):
th.set_cursor(initial)
temp = snr.SNR(Tracehandler=th, Bytes=[0], file_name=file_name)
start = time.perf_counter()
temp.run()
stop = time.perf_counter()
to_avg = np.append(to_avg, stop-start)
avg = np.mean(to_avg)
print(avg)
Results_1[50000] = avg
opened zarr file c:\Users\Jonah\Documents\GitHub\notscared2\1x1x100000_r1_singlerail5_sr_ise.zarr
15.594515300016306
50k traces and 16 bytes
initial = 50000
to_avg = np.array([])
th = trace_handler.TraceHandler(fileName=file_name,
batchSize=5000,
batchStart=initial)
for i in range(3):
th.set_cursor(initial)
temp = snr.SNR(Tracehandler=th, Bytes=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15], file_name=file_name)
start = time.perf_counter()
temp.run()
stop = time.perf_counter()
to_avg = np.append(to_avg, stop-start)
avg = np.mean(to_avg)
print(avg)
Results_15[50000] = avg
opened zarr file c:\Users\Jonah\Documents\GitHub\notscared2\1x1x100000_r1_singlerail5_sr_ise.zarr
49.26091919999453
100k traces and 1 byte
initial = 0
to_avg = np.array([])
th = trace_handler.TraceHandler(fileName=file_name,
batchSize=5000,
batchStart=initial)
for i in range(3):
th.set_cursor(initial)
temp = snr.SNR(Tracehandler=th, Bytes=[0], file_name=file_name)
start = time.perf_counter()
temp.run()
stop = time.perf_counter()
to_avg = np.append(to_avg, stop-start)
avg = np.mean(to_avg)
print(avg)
Results_1[100000] = avg
opened zarr file c:\Users\Jonah\Documents\GitHub\notscared2\1x1x100000_r1_singlerail5_sr_ise.zarr
28.278265466671048
100k traces and 16 bytes
initial = 0
to_avg = np.array([])
th = trace_handler.TraceHandler(fileName=file_name,
batchSize=5000,
batchStart=initial)
for i in range(3):
th.set_cursor(initial)
temp = snr.SNR(Tracehandler=th, Bytes=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15], file_name=file_name)
start = time.perf_counter()
temp.run()
stop = time.perf_counter()
to_avg = np.append(to_avg, stop-start)
avg = np.mean(to_avg)
print(avg)
Results_15[100000] = avg
opened zarr file c:\Users\Jonah\Documents\GitHub\notscared2\1x1x100000_r1_singlerail5_sr_ise.zarr
99.45222276667482
Results
fig, ax = plt.subplots(figsize=(8, 4))
byte_1 = Results_1.items()
x_1, y_1 = zip(*byte_1)
byte_15 = Results_15.items()
x_15, y_15 = zip(*byte_15)
labels = []
labels.append('1')
ax.plot(x_1, y_1, color='blue')
labels.append('15')
ax.plot(x_15,y_15, color='red')
ax.set_xlabel('Traces Processed')
ax.set_ylabel('Time (seconds)')
ax.legend(labels)
plt.show()
Initialization
Results_1 = {}
Results_15 = {}
file_name = (proj_root + '\\notscared2\\1x1x100000_r1_singlerail5_sr_ise.zarr')
print(file_name)
c:\Users\Jonah\Documents\GitHub\notscared2\1x1x100000_r1_singlerail5_sr_ise.zarr
100 rows and 1 byte
initial = 50000
to_avg = np.array([])
th = trace_handler.TraceHandler(fileName=file_name,
batchSize=100,
batchStart=initial)
for i in range(3):
th.set_cursor(initial)
temp = snr.SNR(Tracehandler=th, Bytes=[0], file_name=file_name)
start = time.perf_counter()
temp.run()
stop = time.perf_counter()
to_avg = np.append(to_avg, stop-start)
avg = np.mean(to_avg)
print(avg)
Results_1[100] = avg
opened zarr file c:\Users\Jonah\Documents\GitHub\notscared2\1x1x100000_r1_singlerail5_sr_ise.zarr
425.68893860000145
100 rows and 16 bytes
initial = 50000
to_avg = np.array([])
th = trace_handler.TraceHandler(fileName=file_name,
batchSize=100,
batchStart=initial)
for i in range(3):
th.set_cursor(initial)
temp = snr.SNR(Tracehandler=th, Bytes=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15], file_name=file_name)
start = time.perf_counter()
temp.run()
stop = time.perf_counter()
to_avg = np.append(to_avg, stop-start)
avg = np.mean(to_avg)
print(avg)
Results_15[100] = avg
opened zarr file c:\Users\Jonah\Documents\GitHub\notscared2\1x1x100000_r1_singlerail5_sr_ise.zarr
1355.774814000004
1000 rows and 1 byte
initial = 50000
to_avg = np.array([])
th = trace_handler.TraceHandler(fileName=file_name,
batchSize=1000,
batchStart=initial)
for i in range(3):
th.set_cursor(initial)
temp = snr.SNR(Tracehandler=th, Bytes=[0], file_name=file_name)
start = time.perf_counter()
temp.run()
stop = time.perf_counter()
to_avg = np.append(to_avg, stop-start)
avg = np.mean(to_avg)
print(avg)
Results_1[1000] = avg
opened zarr file c:\Users\Jonah\Documents\GitHub\notscared2\1x1x100000_r1_singlerail5_sr_ise.zarr
48.252551233337726
1000 rows and 16 bytes
initial = 50000
to_avg = np.array([])
th = trace_handler.TraceHandler(fileName=file_name,
batchSize=1000,
batchStart=initial)
for i in range(3):
th.set_cursor(initial)
temp = snr.SNR(Tracehandler=th, Bytes=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15], file_name=file_name)
start = time.perf_counter()
temp.run()
stop = time.perf_counter()
to_avg = np.append(to_avg, stop-start)
avg = np.mean(to_avg)
print(avg)
Results_15[1000] = avg
opened zarr file c:\Users\Jonah\Documents\GitHub\notscared2\1x1x100000_r1_singlerail5_sr_ise.zarr
165.87790306667253
2500 rows and 1 byte
initial = 50000
to_avg = np.array([])
th = trace_handler.TraceHandler(fileName=file_name,
batchSize=2500,
batchStart=initial)
for i in range(3):
th.set_cursor(initial)
temp = snr.SNR(Tracehandler=th, Bytes=[0], file_name=file_name)
start = time.perf_counter()
temp.run()
stop = time.perf_counter()
to_avg = np.append(to_avg, stop-start)
avg = np.mean(to_avg)
print(avg)
Results_1[2500] = avg
opened zarr file c:\Users\Jonah\Documents\GitHub\notscared2\1x1x100000_r1_singlerail5_sr_ise.zarr
24.577417699998477
2500 rows and 16 bytes
initial = 50000
to_avg = np.array([])
th = trace_handler.TraceHandler(fileName=file_name,
batchSize=2500,
batchStart=initial)
for i in range(3):
th.set_cursor(initial)
temp = snr.SNR(Tracehandler=th, Bytes=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15], file_name=file_name)
start = time.perf_counter()
temp.run()
stop = time.perf_counter()
to_avg = np.append(to_avg, stop-start)
avg = np.mean(to_avg)
print(avg)
Results_15[2500] = avg
opened zarr file c:\Users\Jonah\Documents\GitHub\notscared2\1x1x100000_r1_singlerail5_sr_ise.zarr
81.96921439999521
5000 rows and 1 byte
initial = 50000
to_avg = np.array([])
th = trace_handler.TraceHandler(fileName=file_name,
batchSize=5000,
batchStart=initial)
for i in range(3):
th.set_cursor(initial)
temp = snr.SNR(Tracehandler=th, Bytes=[0], file_name=file_name)
start = time.perf_counter()
temp.run()
stop = time.perf_counter()
to_avg = np.append(to_avg, stop-start)
avg = np.mean(to_avg)
print(avg)
Results_1[5000] = avg
opened zarr file c:\Users\Jonah\Documents\GitHub\notscared2\1x1x100000_r1_singlerail5_sr_ise.zarr
15.703692500004157
5000 rows and 16 bytes
initial = 50000
to_avg = np.array([])
th = trace_handler.TraceHandler(fileName=file_name,
batchSize=5000,
batchStart=initial)
for i in range(3):
th.set_cursor(initial)
temp = snr.SNR(Tracehandler=th, Bytes=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15], file_name=file_name)
start = time.perf_counter()
temp.run()
stop = time.perf_counter()
to_avg = np.append(to_avg, stop-start)
avg = np.mean(to_avg)
print(avg)
Results_15[5000] = avg
opened zarr file c:\Users\Jonah\Documents\GitHub\notscared2\1x1x100000_r1_singlerail5_sr_ise.zarr
51.49608489999082
Results
fig, ax = plt.subplots(figsize=(8, 4))
byte_1 = Results_1.items()
x_1, y_1 = zip(*byte_1)
byte_15 = Results_15.items()
x_15, y_15 = zip(*byte_15)
labels = []
labels.append('1')
ax.plot(x_1, y_1, color='blue')
labels.append('15')
ax.plot(x_15,y_15, color='red')
ax.set_xlabel('Traces Processed')
ax.set_ylabel('Time (seconds)')
ax.legend(labels)
plt.show()
initialization
Results_1 = {}
Results_15 = {}
file_name = (proj_root + '\\notscared2\\1x1x100000_r1_singlerail5_sr_ise.zarr')
print(file_name)
c:\Users\Jonah\Documents\GitHub\notscared2\1x1x100000_r1_singlerail5_sr_ise.zarr
25k traces and 1 byte
initial = 75000
to_avg = np.array([])
th = trace_handler.TraceHandler(fileName=file_name,
batchSize=5000,
batchStart=initial)
for i in range(3):
th.set_cursor(initial)
temp = cpa.CPA(Tracehandler=th, Bytes=[0])
start = time.perf_counter()
temp.run()
stop = time.perf_counter()
to_avg = np.append(to_avg, stop-start)
avg = np.mean(to_avg)
print(avg)
Results_1[25000] = avg
opened zarr file c:\Users\Jonah\Documents\GitHub\notscared2\1x1x100000_r1_singlerail5_sr_ise.zarr
8.112893099993622
25k traces and 16 bytes
initial = 75000
to_avg = np.array([])
th = trace_handler.TraceHandler(fileName=file_name,
batchSize=5000,
batchStart=initial)
for i in range(3):
th.set_cursor(initial)
temp = cpa.CPA(Tracehandler=th, Bytes=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])
start = time.perf_counter()
temp.run()
stop = time.perf_counter()
to_avg = np.append(to_avg, stop-start)
avg = np.mean(to_avg)
print(avg)
Results_15[25000] = avg
opened zarr file c:\Users\Jonah\Documents\GitHub\notscared2\1x1x100000_r1_singlerail5_sr_ise.zarr
49.43534693335338
50k traces and 1 byte
initial = 50000
to_avg = np.array([])
th = trace_handler.TraceHandler(fileName=file_name,
batchSize=5000,
batchStart=initial)
for i in range(3):
th.set_cursor(initial)
temp = cpa.CPA(Tracehandler=th, Bytes=[0])
start = time.perf_counter()
temp.run()
stop = time.perf_counter()
to_avg = np.append(to_avg, stop-start)
avg = np.mean(to_avg)
print(avg)
Results_1[50000] = avg
opened zarr file c:\Users\Jonah\Documents\GitHub\notscared2\1x1x100000_r1_singlerail5_sr_ise.zarr
15.28419803334206
50k traces and 16 bytes
initial = 50000
to_avg = np.array([])
th = trace_handler.TraceHandler(fileName=file_name,
batchSize=5000,
batchStart=initial)
for i in range(3):
th.set_cursor(initial)
temp = cpa.CPA(Tracehandler=th, Bytes=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])
start = time.perf_counter()
temp.run()
stop = time.perf_counter()
to_avg = np.append(to_avg, stop-start)
avg = np.mean(to_avg)
print(avg)
Results_15[50000] = avg
opened zarr file c:\Users\Jonah\Documents\GitHub\notscared2\1x1x100000_r1_singlerail5_sr_ise.zarr
94.03455686666227
100k traces and 1 byte
initial = 0
to_avg = np.array([])
th = trace_handler.TraceHandler(fileName=file_name,
batchSize=5000,
batchStart=initial)
for i in range(3):
th.set_cursor(initial)
temp = cpa.CPA(Tracehandler=th, Bytes=[0])
start = time.perf_counter()
temp.run()
stop = time.perf_counter()
to_avg = np.append(to_avg, stop-start)
avg = np.mean(to_avg)
print(avg)
Results_1[100000] = avg
opened zarr file c:\Users\Jonah\Documents\GitHub\notscared2\1x1x100000_r1_singlerail5_sr_ise.zarr
30.406354900003254
100k traces and 16 bytes
initial = 0
to_avg = np.array([])
th = trace_handler.TraceHandler(fileName=file_name,
batchSize=5000,
batchStart=initial)
for i in range(3):
th.set_cursor(initial)
temp = cpa.CPA(Tracehandler=th, Bytes=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])
start = time.perf_counter()
temp.run()
stop = time.perf_counter()
to_avg = np.append(to_avg, stop-start)
avg = np.mean(to_avg)
print(avg)
Results_15[100000] = avg
opened zarr file c:\Users\Jonah\Documents\GitHub\notscared2\1x1x100000_r1_singlerail5_sr_ise.zarr
173.49993390001086
Results
fig, ax = plt.subplots(figsize=(8, 4))
byte_1 = Results_1.items()
x_1, y_1 = zip(*byte_1)
byte_15 = Results_15.items()
x_15, y_15 = zip(*byte_15)
labels = []
labels.append('1')
ax.plot(x_1, y_1, color='blue')
labels.append('15')
ax.plot(x_15,y_15, color='red')
ax.set_xlabel('Traces Processed')
ax.set_ylabel('Time (seconds)')
ax.legend(labels)
plt.show()
initialization
Results_1 = {}
Results_15 = {}
db_file = '1x1x100000_r1_singlerail5_sr_ise.zarr'
proj_root = os.path.split(os.getcwd())[0]
file_name = os.path.join(proj_root, db_file)
print(file_name)
/Users/utkarshsaxenna/Documents/capstone/notscared2/1x1x100000_r1_singlerail5_sr_ise.zarr
1000 rows and 1 byte
initial = 50000
to_avg = np.array([])
th = trace_handler.TraceHandler(fileName=file_name,
batchSize=1000,
batchStart=initial)
for i in range(3):
th.set_cursor(initial)
temp = cpa.CPA(Tracehandler=th, Bytes=[0])
start = time.perf_counter()
temp.run()
stop = time.perf_counter()
to_avg = np.append(to_avg, stop-start)
avg = np.mean(to_avg)
print(avg)
Results_1[1000] = avg
opened zarr file /Users/utkarshsaxenna/Documents/capstone/notscared2/1x1x100000_r1_singlerail5_sr_ise.zarr
Computing CPA: Tiles: False Bytes: [0]
Computing CPA: Tiles: False Bytes: [0]
Computing CPA: Tiles: False Bytes: [0]
31.24551376400147
1000 rows and 16 bytes
initial = 50000
to_avg = np.array([])
th = trace_handler.TraceHandler(fileName=file_name,
batchSize=1000,
batchStart=initial)
for i in range(3):
th.set_cursor(initial)
temp = cpa.CPA(Tracehandler=th, Bytes=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])
start = time.perf_counter()
temp.run()
stop = time.perf_counter()
to_avg = np.append(to_avg, stop-start)
avg = np.mean(to_avg)
print(avg)
Results_15[1000] = avg
opened zarr file c:\Users\Jonah\Documents\GitHub\notscared2\1x1x100000_r1_singlerail5_sr_ise.zarr
208.96429296667338
2500 rows and 1 byte
initial = 50000
to_avg = np.array([])
th = trace_handler.TraceHandler(fileName=file_name,
batchSize=2500,
batchStart=initial)
for i in range(3):
th.set_cursor(initial)
temp = cpa.CPA(Tracehandler=th, Bytes=[0])
start = time.perf_counter()
temp.run()
stop = time.perf_counter()
to_avg = np.append(to_avg, stop-start)
avg = np.mean(to_avg)
print(avg)
Results_1[2500] = avg
opened zarr file c:\Users\Jonah\Documents\GitHub\notscared2\1x1x100000_r1_singlerail5_sr_ise.zarr
23.625437000009697
2500 rows and 16 bytes
initial = 50000
to_avg = np.array([])
th = trace_handler.TraceHandler(fileName=file_name,
batchSize=2500,
batchStart=initial)
for i in range(3):
th.set_cursor(initial)
temp = cpa.CPA(Tracehandler=th, Bytes=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])
start = time.perf_counter()
temp.run()
stop = time.perf_counter()
to_avg = np.append(to_avg, stop-start)
avg = np.mean(to_avg)
print(avg)
Results_15[2500] = avg
opened zarr file c:\Users\Jonah\Documents\GitHub\notscared2\1x1x100000_r1_singlerail5_sr_ise.zarr
123.86702323332429
5000 rows and 1 bytes
initial = 50000
to_avg = np.array([])
th = trace_handler.TraceHandler(fileName=file_name,
batchSize=5000,
batchStart=initial)
for i in range(3):
th.set_cursor(initial)
temp = cpa.CPA(Tracehandler=th, Bytes=[0])
start = time.perf_counter()
temp.run()
stop = time.perf_counter()
to_avg = np.append(to_avg, stop-start)
avg = np.mean(to_avg)
print(avg)
Results_1[5000] = avg
opened zarr file c:\Users\Jonah\Documents\GitHub\notscared2\1x1x100000_r1_singlerail5_sr_ise.zarr
15.433512933338838
5000 rows and 16 bytes
initial = 50000
to_avg = np.array([])
th = trace_handler.TraceHandler(fileName=file_name,
batchSize=5000,
batchStart=initial)
for i in range(3):
th.set_cursor(initial)
temp = cpa.CPA(Tracehandler=th, Bytes=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])
start = time.perf_counter()
temp.run()
stop = time.perf_counter()
to_avg = np.append(to_avg, stop-start)
avg = np.mean(to_avg)
print(avg)
Results_15[5000] = avg
opened zarr file c:\Users\Jonah\Documents\GitHub\notscared2\1x1x100000_r1_singlerail5_sr_ise.zarr
101.76269319998876
Results
fig, ax = plt.subplots(figsize=(8, 4))
byte_1 = Results_1.items()
x_1, y_1 = zip(*byte_1)
byte_15 = Results_15.items()
x_15, y_15 = zip(*byte_15)
labels = []
labels.append('1')
ax.plot(x_1, y_1, color='blue')
labels.append('15')
ax.plot(x_15,y_15, color='red')
ax.set_xlabel('Traces Processed')
ax.set_ylabel('Time (seconds)')
ax.legend(labels)
plt.show()
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[27], line 7
4 x_1, y_1 = zip(*byte_1)
6 byte_15 = Results_15.items()
----> 7 x_15, y_15 = zip(*byte_15)
9 labels = []
11 labels.append('1')
ValueError: not enough values to unpack (expected 2, got 0)