Using project.textouts Error

Hello,

I have created a project and added some (ten) traces, including wave and textout:

for i in tnrange(10, desc='Capturing traces'):
    project.traces.append(Trace(wave, None, textout, None))

When I print the textouts:

for textout in project.textouts:
    print(textout)

I see the textouts index 1 to 9 printed, index 0 is missing, plus the following:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-13-6b629dff86a7> in <module>
----> 1 for textout in project.textouts:
  2     print(textout)

c:\program files (x86)\chipwhisperer5_64\chipwhisperer\software\chipwhisperer\common\api\ProjectFormat.py in __next__(self)
849 
850         self.n += 1
--> 851         return self.getter(self.n)
852 
853     def __getitem__(self, item):

c:\program files (x86)\chipwhisperer5_64\chipwhisperer\software\chipwhisperer\common\api\TraceManager.py in get_textout(self, n)
193     def get_textout(self, n):
194         """Return the output text of trace with index n in the list of enabled segments"""
--> 195         t = self.get_segment(n)
196         return t.getTextout(n - t.mappedRange[0])
197 

c:\program files (x86)\chipwhisperer5_64\chipwhisperer\software\chipwhisperer\common\api\TraceManager.py in get_segment(self, traceIndex)
162                 return traceSegment
163 
--> 164         raise ValueError("Error: Trace %d is not in mapped range." % traceIndex)
165 
166     getSegment = util.camel_case_deprecated(get_segment)

ValueError: Error: Trace 10 is not in mapped range.

Any advice, how this should be used correctly?

regards,
Henning

see attached full notebook for reproduction:

import chipwhisperer as cw
from chipwhisperer.common.traces import Trace
from tqdm import tnrange
import numpy as np

project = cw.create_project("projects/testTextout.cwp", overwrite=True)

for i in tnrange(10, desc='Capturing traces'):
    project.traces.append(Trace(np.zeros([1], dtype=np.uint8), None, str(i), None))
    
for textout in project.textouts:
    print(textout)

Hi,

There does seem to be a bug here, I’ll try to get a fix pushed out ASAP. In the meantime, you can access via project.traces as follows:

for trace in project.traces:
    print(trace.textout)

Alex

This should be fixed now. I’m in the process of implementing a unit test for this as well.

Alex

1 Like