diff options
Diffstat (limited to 'pyecsca/sca/trace/process.py')
| -rw-r--r-- | pyecsca/sca/trace/process.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/pyecsca/sca/trace/process.py b/pyecsca/sca/trace/process.py index 2499df4..dac24ed 100644 --- a/pyecsca/sca/trace/process.py +++ b/pyecsca/sca/trace/process.py @@ -1,6 +1,4 @@ -""" -This module provides functions for sample-wise processing of single traces. -""" +"""This module provides functions for sample-wise processing of single traces.""" from typing import cast import numpy as np @@ -12,7 +10,7 @@ from .trace import Trace @public def absolute(trace: Trace) -> Trace: """ - Apply absolute value to samples of `trace`. + Apply absolute value to samples of :paramref:`~.absolute.trace`. :param trace: :return: @@ -23,7 +21,7 @@ def absolute(trace: Trace) -> Trace: @public def invert(trace: Trace) -> Trace: """ - Invert(negate) the samples of `trace`. + Invert(negate) the samples of :paramref:`~.invert.trace`. :param trace: :return: @@ -34,7 +32,7 @@ def invert(trace: Trace) -> Trace: @public def threshold(trace: Trace, value) -> Trace: """ - Map samples of the `trace` to 1 if they are above `value` or to 0. + Map samples of the :paramref:`~.threshold.trace` to ``1`` if they are above :paramref:`~.threshold.value` or to ``0``. :param trace: :param value: @@ -55,7 +53,9 @@ def _rolling_window(samples: np.ndarray, window: int) -> np.ndarray: @public def rolling_mean(trace: Trace, window: int) -> Trace: """ - Compute the rolling mean of `trace` using `window`. Shortens the trace by `window` - 1. + Compute the rolling mean of :paramref:`~.rolling_mean.trace` using :paramref:`~.rolling_mean.window`. + + Shortens the trace by ``window - 1``. :param trace: :param window: @@ -74,7 +74,9 @@ def rolling_mean(trace: Trace, window: int) -> Trace: @public def offset(trace: Trace, offset) -> Trace: """ - Offset samples of `trace` by `offset`, sample-wise (Adds `offset` to all samples). + Offset samples of :paramref:`~.offset.trace` by :paramref:`~.offset.offset`, sample-wise. + + Adds :paramref:`~.offset.offset` to all samples. :param trace: :param offset: @@ -90,7 +92,7 @@ def _root_mean_square(trace: Trace): @public def recenter(trace: Trace) -> Trace: """ - Subtract the root mean square of the `trace` from its samples, sample-wise. + Subtract the root mean square of the :paramref:`~.recenter.trace` from its samples, sample-wise. :param trace: :return: @@ -102,7 +104,7 @@ def recenter(trace: Trace) -> Trace: @public def normalize(trace: Trace) -> Trace: """ - Normalize a `trace` by subtracting its mean and dividing by its standard deviation. + Normalize a :paramref:`~.normalize.trace` by subtracting its mean and dividing by its standard deviation. :param trace: :return: @@ -115,7 +117,7 @@ def normalize(trace: Trace) -> Trace: @public def normalize_wl(trace: Trace) -> Trace: """ - Normalize a `trace` by subtracting its mean and dividing by a multiple (= `len(trace)`) of its standard deviation. + Normalize a :paramref:`~.normalize_wl.trace` by subtracting its mean and dividing by a multiple (= ``len(trace)``) of its standard deviation. :param trace: :return: |
