Jitter Modeling Utilities

Jitter utilities for PyBERT.

Original author: David Banas <capn.freako@gmail.com>

Original date: June 16, 2024

Copyright (c) 2024 David Banas; all rights reserved World wide.

A partial extraction of the old pybert/utility.py, as part of a refactoring.

pybert.utility.jitter.calc_jitter(ui: float, nui: int, pattern_len: int, ideal_xings: numpy.typing.NDArray.~Real, actual_xings: numpy.typing.NDArray.~Real, rel_thresh: float = 3.0, num_bins: int = 101, zero_mean: bool = True, dbg_obj: object | None = None, smooth_width: int = 5) tuple[numpy.typing.NDArray.~Real, numpy.typing.NDArray.~Real, float, float, float, float, float, float, numpy.typing.NDArray.~Real, numpy.typing.NDArray.~Real, numpy.typing.NDArray.~Real, numpy.typing.NDArray.~Real, numpy.typing.NDArray.~Real, numpy.typing.NDArray.~Real, numpy.typing.NDArray.~Real, numpy.typing.NDArray.~Real, float, float][source]

Calculate the jitter in a set of actual zero crossings, given the ideal crossings and unit interval.

Parameters:
  • ui – The nominal unit interval (s).

  • nui – The number of unit intervals spanned by the input signal.

  • pattern_len – The number of unit intervals, before input symbol stream repeats.

  • ideal_xings – The ideal zero crossing locations of the edges (s).

  • actual_xings – The actual zero crossing locations of the edges (s).

Keyword Arguments:
  • rel_thresh – The threshold for determining periodic jitter spectral components (sigma). Default: 3.0

  • num_bins – The number of bins to use, when forming histograms. Default: 101

  • zero_mean – Force the mean jitter to zero, when True. Default: True

  • dbg_obj – Object for stashing debugging info. Default: None

  • smooth_width – Width of smoothing window to use when calculating moving averages. Default: 5

Returns:

A tuple containing

  • The total jitter.

  • The times (taken from ‘ideal_xings’) corresponding to the returned jitter values.

  • The peak to peak jitter due to intersymbol interference (ISI).

  • The peak to peak jitter due to duty cycle distortion (DCD).

  • The peak to peak jitter due to uncorrelated periodic sources (Pj).

  • The standard deviation of the jitter due to uncorrelated unbounded random sources (Rj).

  • Dual-Dirac peak to peak jitter.

  • Dual-Dirac random jitter.

  • The data independent jitter.

  • Threshold for determining periodic components.

  • The spectral magnitude of the total jitter.

  • The spectral magnitude of the data independent jitter.

  • The frequencies corresponding to the spectrum components.

  • The smoothed histogram of the total jitter.

  • The smoothed histogram of the data-independent jitter.

  • The bin center values for both histograms.

  • The mean of the Gaussian distribution best fitted to the right tail.

  • The mean of the Gaussian distribution best fitted to the left tail.

Raises:

ValueError – If input checking fails, or curve fitting goes awry.

Notes

1. The actual crossings should arrive pre-aligned to the ideal crossings. And both should start near zero time.

pybert.utility.jitter.find_crossing_times(t: numpy.typing.NDArray.~Real, x: numpy.typing.NDArray.~Real, min_delay: float = 0.0, rising_first: bool = True, min_init_dev: float = 0.1, thresh: float = 0.0) numpy.typing.NDArray.~Real[source]

Finds the threshold crossing times of the input signal.

Parameters:
  • t – Vector of sample times. Intervals do NOT need to be uniform.

  • x – Sampled input vector.

Keyword Arguments:
  • min_delay – Minimum delay required, before allowing crossings. (Helps avoid false crossings at beginning of signal.) Default: 0

  • rising_first – When True, start with the first rising edge found. When this option is True, the first rising edge crossing is the first crossing returned. This is the desired behavior for PyBERT, because we always initialize the bit stream with [0, 0, 1, 1], in order to provide a known synchronization point for jitter analysis. Default: True

  • min_init_dev – The minimum initial deviation from zero, which must be detected before searching for crossings. Normalized to maximum input signal magnitude. Default: 0.1

  • thresh – Vertical crossing threshold.

Returns:

Array of signal threshold crossing times.

pybert.utility.jitter.find_crossings(t: numpy.typing.NDArray.~Real, x: numpy.typing.NDArray.~Real, amplitude: float = 1.0, min_delay: float = 0.0, rising_first: bool = True, min_init_dev: float = 0.1, mod_type: int = 0) numpy.typing.NDArray.~Real[source]

Find the crossing times in a signal, according to the modulation type.

Parameters:
  • t – The times associated with each signal sample.

  • x – The signal samples.

Keyword Arguments:
  • amplitude – The nominal signal amplitude. (Used for determining thresholds, in the case of some modulation types.) Default: 1.0

  • min_delay (float) – The earliest possible sample time we want returned. Default: 0

  • rising_first – When True, start with the first rising edgefound. When this option is True, the first rising edge crossing is the first crossing returned. This is the desired behavior for PyBERT, because we always initialize the bit stream with [0, 0, 1, 1], in order to provide a known synchronization point for jitter analysis. Default: True

  • min_init_dev – The minimum initial deviation from zero, which must be detected before searching for crossings. Normalized to maximum input signal magnitude. Default: 0.1

  • mod_type – The modulation type. Allowed values are: {0: NRZ, 1: Duo-binary, 2: PAM-4} Default: 0

Returns:

The signal threshold crossing times.