Spectral periodogram object for computing power spectral density estimates of various signals
Public Functions
spgramcf | spgramcf_create( |
spgramcf | spgramcf_create_default( |
spgramcf | spgramcf_copy( |
int | spgramcf_destroy( |
int | spgramcf_clear( |
int | spgramcf_reset( |
int | spgramcf_print( |
int | spgramcf_set_alpha( |
float | spgramcf_get_alpha( |
int | spgramcf_set_freq( |
int | spgramcf_set_rate( |
unsigned int | spgramcf_get_nfft( |
unsigned int | spgramcf_get_window_len( |
unsigned int | spgramcf_get_delay( |
int | spgramcf_get_wtype( |
unsigned long long int | spgramcf_get_num_samples( |
unsigned long long int | spgramcf_get_num_samples_total( |
unsigned long long int | spgramcf_get_num_transforms( |
unsigned long long int | spgramcf_get_num_transforms_total( |
int | spgramcf_push( |
int | spgramcf_write( |
int | spgramcf_get_psd_mag( |
int | spgramcf_get_psd( |
int | spgramcf_export_gnuplot( |
int | spgramcf_estimate_psd( |
Interfaces
spgramcf spgramcf_create(
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(
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(
Copy object including all internal objects and state
int spgramcf_destroy(
Destroy spgram object, freeing all internally-allocated memory
int spgramcf_clear(
Clears the internal state of the object, but not the internal buffer
int spgramcf_reset(
Reset the object to its original state completely. This effectively executes the clear() method and then resets the internal buffer
int spgramcf_print(
Print internal state of the object to stdout
int spgramcf_set_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(
Get the filter bandwidth for accumulating independent transform squared magnitude outputs.
int spgramcf_set_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(
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(
Get transform (FFT) size
unsigned int spgramcf_get_window_len(
Get window length
unsigned int spgramcf_get_delay(
Get delay between transforms
int spgramcf_get_wtype(
Get window type used for spectral estimation
unsigned long long int spgramcf_get_num_samples(
Get number of samples processed since reset
unsigned long long int spgramcf_get_num_samples_total(
Get number of samples processed since object was created
unsigned long long int spgramcf_get_num_transforms(
Get number of transforms processed since reset
unsigned long long int spgramcf_get_num_transforms_total(
Get number of transforms processed since object was created
int spgramcf_push(
Push a single sample into the object, executing internal transform as necessary.
- _q : spgram object
- _x : input sample
int spgramcf_write(
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(
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(
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(
Export stand-alone gnuplot file for plotting output spectrum, returning 0 on success, anything other than 0 for failure
- _q : spgram object
- _filename : input buffer, shape: (_n, 1)
int spgramcf_estimate_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)