Spectral periodogram object for computing power spectral density estimates of various signals
Public Functions
spgramf | spgramf_create( |
spgramf | spgramf_create_default( |
spgramf | spgramf_copy( |
int | spgramf_destroy( |
int | spgramf_clear( |
int | spgramf_reset( |
int | spgramf_print( |
int | spgramf_set_alpha( |
float | spgramf_get_alpha( |
int | spgramf_set_freq( |
int | spgramf_set_rate( |
unsigned int | spgramf_get_nfft( |
unsigned int | spgramf_get_window_len( |
unsigned int | spgramf_get_delay( |
int | spgramf_get_wtype( |
unsigned long long int | spgramf_get_num_samples( |
unsigned long long int | spgramf_get_num_samples_total( |
unsigned long long int | spgramf_get_num_transforms( |
unsigned long long int | spgramf_get_num_transforms_total( |
int | spgramf_push( |
int | spgramf_write( |
int | spgramf_get_psd_mag( |
int | spgramf_get_psd( |
int | spgramf_export_gnuplot( |
int | spgramf_estimate_psd( |
Interfaces
spgramf spgramf_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
spgramf spgramf_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
spgramf spgramf_copy(
Copy object including all internal objects and state
int spgramf_destroy(
Destroy spgram object, freeing all internally-allocated memory
int spgramf_clear(
Clears the internal state of the object, but not the internal buffer
int spgramf_reset(
Reset the object to its original state completely. This effectively executes the clear() method and then resets the internal buffer
int spgramf_print(
Print internal state of the object to stdout
int spgramf_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 spgramf_get_alpha(
Get the filter bandwidth for accumulating independent transform squared magnitude outputs.
int spgramf_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 spgramf_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 spgramf_get_nfft(
Get transform (FFT) size
unsigned int spgramf_get_window_len(
Get window length
unsigned int spgramf_get_delay(
Get delay between transforms
int spgramf_get_wtype(
Get window type used for spectral estimation
unsigned long long int spgramf_get_num_samples(
Get number of samples processed since reset
unsigned long long int spgramf_get_num_samples_total(
Get number of samples processed since object was created
unsigned long long int spgramf_get_num_transforms(
Get number of transforms processed since reset
unsigned long long int spgramf_get_num_transforms_total(
Get number of transforms processed since object was created
int spgramf_push(
Push a single sample into the object, executing internal transform as necessary.
- _q : spgram object
- _x : input sample
int spgramf_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 spgramf_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 spgramf_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 spgramf_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 spgramf_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)