sdr.plot.detector_pdfs(h0: scipy.stats.rv_continuous | None = None, h1: scipy.stats.rv_continuous | None = None, threshold: float | None = None, shade: bool = True, annotate: bool = True, x: NDArray[float64] | None = None, points: int = 1001, p_h0: float = 1e-06, p_h1: float = 0.001, ax: plt.Axes | None = None, **kwargs)

Plots the probability density functions (PDFs) of the detector under \(\mathcal{H}_0\) and \(\mathcal{H}_1\).

Parameters:
h0: scipy.stats.rv_continuous | None = None

The statistical distribution under \(\mathcal{H}_0\).

h1: scipy.stats.rv_continuous | None = None

The statistical distribution under \(\mathcal{H}_1\).

threshold: float | None = None

The detection threshold \(\gamma\).

shade: bool = True

Indicates whether to shade the tails of the PDFs.

annotate: bool = True

Indicates whether to annotate the plot with the probabilities of false alarm and detection.

x: NDArray[float64] | None = None

The x-axis values to use for the plot. If not provided, it will be generated automatically.

points: int = 1001

The number of points to use for the x-axis.

p_h0: float = 1e-06

The probability of the \(\mathcal{H}_0\) tails to plot. The smaller the value, the longer the x-axis.

p_h1: float = 0.001

The probability of the \(\mathcal{H}_1\) tails to plot. The smaller the value, the longer the x-axis.

ax: plt.Axes | None = None

The axis to plot on. If None, the current axis is used.

**kwargs

Additional keyword arguments to pass to matplotlib.pyplot.plot().

Example

In [1]: snr = 5  # Signal-to-noise ratio in dB

In [2]: sigma2 = 1  # Noise variance

In [3]: p_fa = 1e-1  # Probability of false alarm
In [4]: detector = "linear"; \
   ...: h0 = sdr.h0(sigma2, detector); \
   ...: h1 = sdr.h1(snr, sigma2, detector); \
   ...: threshold = sdr.threshold(p_fa, sigma2, detector)
   ...: 

In [5]: plt.figure(); \
   ...: sdr.plot.detector_pdfs(h0, h1, threshold); \
   ...: plt.title("Linear Detector: Probability density functions");
   ...: 
../../_images/sdr_plot_detector_pdfs_1.png