static sdr.EnergyDetector.roc(snr: float, N_nc: float, p_fa: ArrayLike | None = None, complex: bool = True) tuple[NDArray[float_], NDArray[float_]]

Computes the receiver operating characteristic (ROC) curve.

Parameters:
snr: float

The received signal-to-noise ratio \(\sigma_s^2 / \sigma^2\) in dB.

N_nc: float

The number of samples \(N_{NC}\) to non-coherently integrate.

p_fa: ArrayLike | None = None

The probability of false alarm \(P_{FA}\). If None, the ROC curve is computed for p_fa = np.logspace(-10, 0, 101).

complex: bool = True

Indicates whether the signal is complex.

Returns:

  • The probability of false alarm \(P_{FA}\).

  • The probability of detection \(P_D\).

Examples

Plot the theoretical ROC curves for integrating a single sample at various SNRs.

In [1]: plt.figure(figsize=(8, 4)); \
   ...: sdr.plot.roc(*sdr.EnergyDetector.roc(-20, 1), label=f"SNR = -20 dB"); \
   ...: sdr.plot.roc(*sdr.EnergyDetector.roc(-10, 1), label=f"SNR = -10 dB"); \
   ...: sdr.plot.roc(*sdr.EnergyDetector.roc(0, 1), label=f"SNR = -0 dB"); \
   ...: sdr.plot.roc(*sdr.EnergyDetector.roc(10, 1), label=f"SNR = 10 dB"); \
   ...: sdr.plot.roc(*sdr.EnergyDetector.roc(20, 1), label=f"SNR = 20 dB");
   ...: 
../../_images/sdr_EnergyDetector_roc_1.png

Plot the theoretical ROC curves for various integration lengths at -10 dB SNR.

In [2]: plt.figure(figsize=(8, 4)); \
   ...: sdr.plot.roc(*sdr.EnergyDetector.roc(-10, 1), label=f"N = 1"); \
   ...: sdr.plot.roc(*sdr.EnergyDetector.roc(-10, 10), label=f"N = 10"); \
   ...: sdr.plot.roc(*sdr.EnergyDetector.roc(-10, 100), label=f"N = 100"); \
   ...: sdr.plot.roc(*sdr.EnergyDetector.roc(-10, 1_000), label=f"N = 1,000"); \
   ...: sdr.plot.roc(*sdr.EnergyDetector.roc(-10, 5_000), label=f"N = 5,000");
   ...: 
../../_images/sdr_EnergyDetector_roc_2.png