pyecsca.sca.trace.trace module

Provides the Trace class.

class pyecsca.sca.trace.trace.Trace(samples, meta=None, trace_set=None)[source]

Bases: object

Trace, which has some samples and metadata.

Construct a new trace.

Parameters:
  • samples (ndarray) – The sample array of the trace.

  • meta (Optional[Mapping[str, Any]]) – Metadata associated with the trace.

  • trace_set (Any) – A trace set the trace is contained in.

meta: Mapping[str, Any]
samples: ndarray
property trace_set: Any

Return the trace set this trace is contained in, if any.

with_samples(samples)[source]

Construct a copy of this trace, with the same metadata, but samples replaced by samples.

Parameters:

samples (ndarray) – The samples of the new trace.

Return type:

Trace

Returns:

The new trace.

astype(dtype)[source]

Construct a copy of this trace, with the same samples retyped using dtype.

Parameters:

dtype (Union[dtype[Any], None, Type[Any], _SupportsDType[dtype[Any]], str, Tuple[Any, int], Tuple[Any, Union[SupportsIndex, Sequence[SupportsIndex]]], List[Any], _DTypeDict, Tuple[Any, Any]]) – The numpy dtype.

Return type:

Trace

Returns:

The new trace

class pyecsca.sca.trace.trace.CombinedTrace(samples, meta=None, trace_set=None, parents=None)[source]

Bases: Trace

Trace that was combined from other traces, parents.

Construct a new trace.

Parameters:
  • samples (ndarray) – The sample array of the trace.

  • meta (Optional[Mapping[str, Any]]) – Metadata associated with the trace.

  • trace_set (Any) – A trace set the trace is contained in.

astype(dtype)

Construct a copy of this trace, with the same samples retyped using dtype.

Parameters:

dtype (Union[dtype[Any], None, Type[Any], _SupportsDType[dtype[Any]], str, Tuple[Any, int], Tuple[Any, Union[SupportsIndex, Sequence[SupportsIndex]]], List[Any], _DTypeDict, Tuple[Any, Any]]) – The numpy dtype.

Return type:

Trace

Returns:

The new trace

property trace_set: Any

Return the trace set this trace is contained in, if any.

with_samples(samples)

Construct a copy of this trace, with the same metadata, but samples replaced by samples.

Parameters:

samples (ndarray) – The samples of the new trace.

Return type:

Trace

Returns:

The new trace.

meta: Mapping[str, Any]
samples: ndarray