Tools

Useful tools for radar system analysis

This script requires that ‘numpy’ and ‘scipy’ be installed within the Python environment you are running this script in.

This file can be imported as a module and contains the following functions:

  • roc_pd - Calculate probability of detection (Pd) in receiver operating

    characteristic (ROC)

  • roc_snr - Calculate the minimal SNR for certain probability of

    detection (Pd) and probability of false alarm (Pfa) in receiver operating characteristic (ROC)

██████╗  █████╗ ██████╗  █████╗ ██████╗ ███████╗██╗███╗   ███╗██╗  ██╗
██╔══██╗██╔══██╗██╔══██╗██╔══██╗██╔══██╗██╔════╝██║████╗ ████║╚██╗██╔╝
██████╔╝███████║██║  ██║███████║██████╔╝███████╗██║██╔████╔██║ ╚███╔╝ 
██╔══██╗██╔══██║██║  ██║██╔══██║██╔══██╗╚════██║██║██║╚██╔╝██║ ██╔██╗ 
██║  ██║██║  ██║██████╔╝██║  ██║██║  ██║███████║██║██║ ╚═╝ ██║██╔╝ ██╗
╚═╝  ╚═╝╚═╝  ╚═╝╚═════╝ ╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚═╝╚═╝     ╚═╝╚═╝  ╚═╝
radarsimpy.tools.roc_pd(pfa: float | ndarray[tuple[int, ...], dtype[_ScalarType_co]], snr: float | ndarray[tuple[int, ...], dtype[_ScalarType_co]], npulses: int = 1, stype: str = 'Coherent') float | ndarray[tuple[int, ...], dtype[_ScalarType_co]] | None[source]

Calculate probability of detection (Pd) in receiver operating characteristic (ROC)

Parameters:
  • pfa (float or numpy.1darray) – Probability of false alarm (Pfa)

  • snr (float or numpy.1darray) – Signal to noise ratio in decibel (dB)

  • npulses (int) – Number of pulses for integration (default is 1)

  • stype (str) –

    Signal type (default is Coherent)

    • Coherent: Non-fluctuating coherent

    • Real: Non-fluctuating real signal

    • Swerling 0: Non-coherent Swerling 0, Non-fluctuating non-coherent

    • Swerling 1: Non-coherent Swerling 1

    • Swerling 2: Non-coherent Swerling 2

    • Swerling 3: Non-coherent Swerling 3

    • Swerling 4: Non-coherent Swerling 4

    • Swerling 5: Non-coherent Swerling 5, Non-fluctuating non-coherent

Returns:

probability of detection (Pd). if both pfa and snr are floats, pd is a float if pfa or snr is a 1-D array, pd is a 1-D array if both pfa and snr are 1-D arrays, pd is a 2-D array

Return type:

float or 1-D array or 2-D array

Reference

Mahafza, Bassem R. Radar systems analysis and design using MATLAB. Chapman and Hall/CRC, 2005.

radarsimpy.tools.roc_snr(pfa: float | ndarray[tuple[int, ...], dtype[_ScalarType_co]], pd: float | ndarray[tuple[int, ...], dtype[_ScalarType_co]], npulses: int = 1, stype: str = 'Coherent') float | ndarray[tuple[int, ...], dtype[_ScalarType_co]] | None[source]

Calculate the minimal SNR for certain probability of detection (Pd) and probability of false alarm (Pfa) in receiver operating characteristic (ROC) with Secant method

Parameters:
  • pfa (float or numpy.1darray) – Probability of false alarm (Pfa)

  • pd (float or numpy.1darray) – Probability of detection (Pd)

  • npulses (int) – Number of pulses for integration (default is 1)

  • stype (str) –

    Signal type (default is Coherent)

    • Coherent : Non-fluctuating coherent

    • Real : Non-fluctuating real signal

    • Swerling 0 : Non-fluctuating non-coherent

    • Swerling 1 : Non-coherent Swerling 1

    • Swerling 2 : Non-coherent Swerling 2

    • Swerling 3 : Non-coherent Swerling 3

    • Swerling 4 : Non-coherent Swerling 4

    • Swerling 5 : Same as Swerling 0

Returns:

Minimal signal to noise ratio in decibel (dB) if both pfa and pd are floats, SNR is a float if pfa or pd is a 1-D array, SNR is a 1-D array if both pfa and pd are 1-D arrays, SNR is a 2-D array

Return type:

float or 1-D array or 2-D array

Reference

Secant method:

The x intercept of the secant line on the the Nth interval

\[m_n = a_n - f(a_n)*(b_n - a_n)/(f(b_n) - f(a_n))\]

The initial interval [a_0,b_0] is given by [a,b]. If f(m_n) == 0 for some intercept m_n then the function returns this solution. If all signs of values f(a_n), f(b_n) and f(m_n) are the same at any iterations, the secant method fails and return None.