spgramcf

Spectral periodogram object for computing power spectral density estimates of various signals

Variants: spgramcf, spgramf

Public Functions

spgramcf spgramcf_create(unsigned int _nfft, int _wtype, unsigned int _window_len, unsigned int _delay)
spgramcf spgramcf_create_default(unsigned int _nfft)
spgramcf spgramcf_copy(spgramcf _q)
int spgramcf_destroy(spgramcf _q)
int spgramcf_clear(spgramcf _q)
int spgramcf_reset(spgramcf _q)
int spgramcf_print(spgramcf _q)
int spgramcf_set_alpha(spgramcf _q, float _alpha)
float spgramcf_get_alpha(spgramcf _q)
int spgramcf_set_freq(spgramcf _q, float _freq)
int spgramcf_set_rate(spgramcf _q, float _rate)
unsigned int spgramcf_get_nfft(spgramcf _q)
unsigned int spgramcf_get_window_len(spgramcf _q)
unsigned int spgramcf_get_delay(spgramcf _q)
int spgramcf_get_wtype(spgramcf _q)
unsigned long long int spgramcf_get_num_samples(spgramcf _q)
unsigned long long int spgramcf_get_num_samples_total(spgramcf _q)
unsigned long long int spgramcf_get_num_transforms(spgramcf _q)
unsigned long long int spgramcf_get_num_transforms_total(spgramcf _q)
int spgramcf_push(spgramcf _q, float complex _x)
int spgramcf_write(spgramcf _q, float complex * _x, unsigned int _n)
int spgramcf_get_psd_mag(spgramcf _q, float * _psd)
int spgramcf_get_psd(spgramcf _q, float * _psd)
int spgramcf_export_gnuplot(spgramcf _q, const char * _filename)
int spgramcf_estimate_psd(unsigned int _nfft, float complex * _x, unsigned int _n, float * _psd)

Interfaces

spgramcf spgramcf_create(unsigned int _nfft, int _wtype, unsigned int _window_len, unsigned int _delay)

Create spgram object, fully defined

  • _nfft : transform (FFT) size, 2 <= _nfft
  • _wtype : window type, e.g. LIQUID_WINDOW_HAMMING
  • _window_len : window length, 1 <= _window_len <= _nfft
  • _delay : delay between transforms, 0 < _delay

spgramcf spgramcf_create_default(unsigned int _nfft)

Create default spgram object of a particular transform size using the Kaiser-Bessel window (LIQUID_WINDOW_KAISER), a window length equal to _nfft/2, and a delay of _nfft/4

  • _nfft : FFT size, 2 <= _nfft

spgramcf spgramcf_copy(spgramcf _q)

Copy object including all internal objects and state

int spgramcf_destroy(spgramcf _q)

Destroy spgram object, freeing all internally-allocated memory

int spgramcf_clear(spgramcf _q)

Clears the internal state of the object, but not the internal buffer

int spgramcf_reset(spgramcf _q)

Reset the object to its original state completely. This effectively executes the clear() method and then resets the internal buffer

int spgramcf_print(spgramcf _q)

Print internal state of the object to stdout

int spgramcf_set_alpha(spgramcf _q, float _alpha)

Set the filter bandwidth for accumulating independent transform squared magnitude outputs. This is used to compute a running time-average power spectral density output. The value of _alpha determines how the power spectral estimate is accumulated across transforms and can range from 0 to 1 with a special case of -1 to accumulate infinitely. Setting _alpha to 0 minimizes the bandwidth and the PSD estimate will never update. Setting _alpha to 1 forces the object to always use the most recent spectral estimate. Setting _alpha to -1 is a special case to enable infinite spectral accumulation.

  • _q : spectral periodogram object
  • _alpha : forgetting factor, set to -1 for infinite, 0 <= _alpha <= 1

float spgramcf_get_alpha(spgramcf _q)

Get the filter bandwidth for accumulating independent transform squared magnitude outputs.

int spgramcf_set_freq(spgramcf _q, float _freq)

Set the center frequency of the received signal. This is for display purposes only when generating the output image.

  • _q : spectral periodogram object
  • _freq : center frequency [Hz]

int spgramcf_set_rate(spgramcf _q, float _rate)

Set the sample rate (frequency) of the received signal. This is for display purposes only when generating the output image.

  • _q : spectral periodogram object
  • _rate : sample rate [Hz]

unsigned int spgramcf_get_nfft(spgramcf _q)

Get transform (FFT) size

unsigned int spgramcf_get_window_len(spgramcf _q)

Get window length

unsigned int spgramcf_get_delay(spgramcf _q)

Get delay between transforms

int spgramcf_get_wtype(spgramcf _q)

Get window type used for spectral estimation

unsigned long long int spgramcf_get_num_samples(spgramcf _q)

Get number of samples processed since reset

unsigned long long int spgramcf_get_num_samples_total(spgramcf _q)

Get number of samples processed since object was created

unsigned long long int spgramcf_get_num_transforms(spgramcf _q)

Get number of transforms processed since reset

unsigned long long int spgramcf_get_num_transforms_total(spgramcf _q)

Get number of transforms processed since object was created

int spgramcf_push(spgramcf _q, float complex _x)

Push a single sample into the object, executing internal transform as necessary.

  • _q : spgram object
  • _x : input sample

int spgramcf_write(spgramcf _q, float complex * _x, unsigned int _n)

Write a block of samples to the object, executing internal transform as necessary.

  • _q : spgram object
  • _x : input buffer, shape: (_n, 1)
  • _n : input buffer length

int spgramcf_get_psd_mag(spgramcf _q, float * _psd)

Compute spectral periodogram output (fft-shifted values, linear) from current buffer contents

  • _q : spgram object
  • _psd : output spectrum (linear), shape: (_nfft, 1)

int spgramcf_get_psd(spgramcf _q, float * _psd)

Compute spectral periodogram output (fft-shifted values in dB) from current buffer contents

  • _q : spgram object
  • _psd : output spectrum (dB), shape: (_nfft, 1)

int spgramcf_export_gnuplot(spgramcf _q, const char * _filename)

Export stand-alone gnuplot file for plotting output spectrum, returning 0 on sucess, anything other than 0 for failure

  • _q : spgram object
  • _filename : input buffer, shape: (_n, 1)

int spgramcf_estimate_psd(unsigned int _nfft, float complex * _x, unsigned int _n, float * _psd)

Estimate spectrum on input signal (create temporary object for convenience

  • _nfft : FFT size
  • _x : input signal, shape: (_n, 1)
  • _n : input signal length
  • _psd : output spectrum, shape: (_nfft, 1)