pyecsca.sca.trace.edit module

Provides functions for editing traces as if they were tapes you can trim, reverse, etc.

trim(trace, start=None, end=None)[source]

Trim the trace samples, output contains samples between the start and end indices.

Parameters:
  • trace (Trace) – The trace to trim.

  • start (Optional[int]) – Starting index (inclusive).

  • end (Optional[int]) – Ending index (exclusive).

Return type:

Trace

Returns:

reverse(trace)[source]

Reverse the samples of the trace.

Parameters:

trace (Trace) – The trace to reverse.

Return type:

Trace

Returns:

pad(trace, lengths, values=(0, 0))[source]

Pad the samples of the trace by values at the beginning and end.

Parameters:
  • trace (Trace) – The trace to pad.

  • lengths (Union[Tuple[int, int], int]) – How much to pad at the beginning and end, either symmetric (if integer) or asymmetric (if tuple).

  • values (Union[Tuple[Any, Any], Any]) – What value to pad with, either symmetric or asymmetric (if tuple).

Return type:

Trace

Returns:

stretch(trace, length)[source]

Stretch (or squeeze) a trace linearly to fit a given length.

Parameters:
  • trace (Trace) – The trace to stretch (or squeeze).

  • length (int) – The length it should be.

Return type:

Trace

Returns: