-
sdr.threshold(p_fa: ArrayLike, sigma2: ArrayLike =
1
, detector: 'coherent' | 'linear' | 'square-law' ='square-law'
, complex: bool =True
, n_c: int =1
, n_nc: int | None =None
) NDArray[float64] Computes the theoretical detection threshold \(\gamma\).
- Parameters:¶
- p_fa: ArrayLike¶
The desired probability of false alarm \(P_{fa}\) in \((0, 1)\).
- sigma2: ArrayLike =
1
¶ The noise variance \(\sigma^2\) in linear units.
- detector: 'coherent' | 'linear' | 'square-law' =
'square-law'
¶ The detector type.
"coherent"
: A coherent detector,\[T(x) = \mathrm{Re}\left\{\sum_{i=0}^{N_c-1} x[n-i]\right\} .\]"linear"
: A linear detector,\[T(x) = \sum_{j=0}^{N_{nc}-1}\left|\sum_{i=0}^{N_c-1} x[n-i-jN_c]\right| .\]"square-law"
: A square-law detector,\[T(x) = \sum_{j=0}^{N_{nc}-1}\left|\sum_{i=0}^{N_c-1} x[n-i-jN_c]\right|^2 .\]
- complex: bool =
True
¶ Indicates whether the input signal is real or complex. This affects how the SNR is converted to noise variance.
- n_c: int =
1
¶ The number of samples to coherently integrate \(N_c\).
- n_nc: int | None =
None
¶ The number of samples to non-coherently integrate \(N_{nc}\). Non-coherent integration is only allowable for linear and square-law detectors.
- Returns:¶
The detection threshold \(\gamma\) in linear units.
Examples
In [1]: p_fa = 1e-1 # Probability of false alarm In [2]: sigma2 = 1 # Noise variance
Compute the detection threshold for the coherent detector. Plot the PDFs and observe the desired \(P_{fa}\) is achieved.
In [3]: detector = "coherent"; \ ...: h0 = sdr.h0(sigma2, detector) ...: In [4]: threshold = sdr.threshold(p_fa, sigma2, detector); threshold Out[4]: 0.9061938024368232 In [5]: plt.figure(); \ ...: sdr.plot.detector_pdfs(h0=h0, threshold=threshold); \ ...: plt.title("Coherent Detector: Probability density functions"); ...:
Compute the detection threshold for the linear detector. Plot the PDFs and observe the desired \(P_{fa}\) is achieved.
In [6]: detector = "linear"; \ ...: h0 = sdr.h0(sigma2, detector) ...: In [7]: threshold = sdr.threshold(p_fa, sigma2, detector); threshold Out[7]: 1.5174271293851465 In [8]: plt.figure(); \ ...: sdr.plot.detector_pdfs(h0=h0, threshold=threshold); \ ...: plt.title("Linear Detector: Probability density functions"); ...:
Compute the detection threshold for the square-law detector. Plot the PDFs and observe the desired \(P_{fa}\) is achieved.
In [9]: detector = "square-law"; \ ...: h0 = sdr.h0(sigma2, detector) ...: In [10]: threshold = sdr.threshold(p_fa, sigma2, detector); threshold Out[10]: 2.302585092994046 In [11]: plt.figure(); \ ....: sdr.plot.detector_pdfs(h0=h0, threshold=threshold); \ ....: plt.title("Square-Law Detector: Probability density functions"); ....: