@@ -488,6 +488,27 @@ def run_tvla(ctx: typer.Context):
488
488
# Amount of tolerable deviation from average during filtering.
489
489
num_sigmas = 3.5
490
490
491
+ # Slice of wave file
492
+ # these options are only tested for otbn
493
+ if ("sample_start" in cfg and cfg ["sample_start" ] is not None ):
494
+ sample_start = cfg ["sample_start" ]
495
+ else :
496
+ sample_start = 0
497
+
498
+ assert sample_start < len (project .waves [0 ])
499
+
500
+ if ("num_samples" in cfg and cfg ["num_samples" ] is not None ):
501
+ num_samples = cfg ["num_samples" ]
502
+ else :
503
+ num_samples = len (project .waves [0 ]) - sample_start
504
+
505
+ if (num_samples + sample_start > len (project .waves [0 ])):
506
+ log .warning (f"Selected sample window { sample_start } to " +
507
+ f"{ sample_start + num_samples } is out of range!" )
508
+ num_samples = len (project .waves [0 ]) - sample_start
509
+ log .warning (f"Will use samples from { sample_start } " +
510
+ f"to { sample_start + num_samples } instead!" )
511
+
491
512
# Overall number of traces, trace start and end indices.
492
513
num_traces_max = len (project .waves )
493
514
if cfg ["trace_start" ] is None :
@@ -548,8 +569,11 @@ def run_tvla(ctx: typer.Context):
548
569
log .info ("Converting Traces" )
549
570
if project .waves [0 ].dtype == 'uint16' :
550
571
traces = np .empty ((num_traces , num_samples ), dtype = np .uint16 )
572
+ log .info (f"Will use samples from { sample_start } to { sample_start + num_samples } " )
551
573
for i_trace in range (num_traces ):
552
- traces [i_trace ] = project .waves [i_trace + trace_start ]
574
+ traces [i_trace ] = project .waves [i_trace +
575
+ trace_start ][sample_start :sample_start +
576
+ num_samples ]
553
577
else :
554
578
traces = np .empty ((num_traces , num_samples ), dtype = np .double )
555
579
for i_trace in range (num_traces ):
0 commit comments