sigkit.metrics package

Submodules

sigkit.metrics.integrity module

Methods for computing signal integrity metrics like SNR and BER.

sigkit.metrics.integrity.calculate_ber(bits: ndarray | Tensor, truth_bits: ndarray | Tensor) float[source]

Compute bit-error rate (fraction of mismatches).

sigkit.metrics.integrity.estimate_snr(clean: ndarray | Tensor, noisy: ndarray | Tensor) float[source]

Compute SNR (dB) between clean and noisy signals.

sigkit.metrics.visuals module

Contains matplotlib visualizations for signal metrics.

sigkit.metrics.visuals.plot_constellation(signal: Signal, ax=None, s: int = 20)[source]

Plot the constellation diagram of a Signal.

Parameters:
  • signal – Signal object containing complex samples.

  • ax – Optional matplotlib Axes to plot on.

  • s – Marker size.

Returns:

The matplotlib Axes containing the plot.

sigkit.metrics.visuals.plot_frequency(signal: Signal, ax=None)[source]

Plot the magnitude spectrum of a Signal using FFT.

Parameters:
  • signal – Signal object containing complex samples.

  • ax – Optional matplotlib Axes to plot on.

Returns:

The matplotlib Axes containing the plot.

sigkit.metrics.visuals.plot_phase(signal: Signal, ax=None, unwrap: bool = False, n_samples: int | None = None) Axes[source]

Plot the instantaneous phase of a Signal over time.

Parameters:
  • signal – Signal object containing complex samples.

  • ax – Optional matplotlib Axes to plot on.

  • unwrap – If True, unwrap the phase to show continuous variation.

  • n_samples – Optional number of samples to plot. If None, plots all.

Returns:

The matplotlib Axes containing the plot.

sigkit.metrics.visuals.plot_psd(signal: Signal, ax=None, nfft=1024)[source]

Plot the Power Spectral Density (PSD) of a Signal.

Parameters:
  • signal – Signal object containing complex samples.

  • ax – Optional matplotlib Axes to plot on.

  • nfft – Number of FFT points.

Returns:

The matplotlib Axes containing the plot.

sigkit.metrics.visuals.plot_spectrogram(signal: Signal, ax=None, nfft=2048, noverlap=None, cmap='viridis')[source]

Plot the spectrogram of a Signal using Matplotlib’s specgram.

Parameters:
  • signal – Signal object containing complex samples.

  • ax – Optional matplotlib Axes to plot on.

  • nfft – Number of FFT points.

  • noverlap – Number of overlapping points.

  • cmap – Colormap to use.

Returns:

The matplotlib Axes containing the plot.

sigkit.metrics.visuals.plot_time(signal: Signal, n_samples: int | None = None, ax=None) Axes[source]

Plot the real (I) part of a Signal over time.

Parameters:
  • signal – Signal object containing complex samples.

  • n_samples – Optional number of samples to plot. If None, plots all.

  • ax – Optional matplotlib Axes to plot on.

Returns:

The matplotlib Axes containing the plot.