compute_psd()#

InstroSDR.compute_psd(
n_samples: int = 1024,
*,
channel: str = '0',
) → tuple[ndarray, ndarray] | None[source]#

Acquire one block and return one channel’s power spectral density. Publishes nothing.

Uses a Hann-windowed FFT. Frequencies are absolute, offset by the tuned center frequency.

Parameters:
  • n_samples (int) – Samples to acquire, which sets the frequency resolution.

  • channel (str) – Receive channel to analyze.

Returns:

tuple[numpy.ndarray, numpy.ndarray] | None – (frequencies_hz, power_db), frequencies in Hz and power in dB relative to one squared sample unit per Hz. None if the read returned no samples.

Raises:

ValueError – If n_samples is not positive.