2018-01-29 15:14:50 +00:00
|
|
|
// ps.h
|
|
|
|
//
|
|
|
|
// Author: J.A. de Jong - ASCEE
|
|
|
|
//
|
|
|
|
// Description: Single sided power and cross-power spectra computation
|
|
|
|
// routines.
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#pragma once
|
|
|
|
#ifndef PS_H
|
|
|
|
#define PS_H
|
|
|
|
#include "window.h"
|
|
|
|
typedef struct PowerSpectra_s PowerSpectra;
|
|
|
|
|
|
|
|
|
2018-02-06 11:01:27 +00:00
|
|
|
/**
|
|
|
|
* Allocate a PowerSpectra computer
|
|
|
|
*
|
|
|
|
* @param nfft fft length
|
|
|
|
* @param nchannels Number of channels
|
|
|
|
* @param wt Windowtype, as defined in window.h
|
|
|
|
*
|
|
|
|
* @return PowerSpectra handle, NULL on error
|
|
|
|
*/
|
2018-01-29 15:14:50 +00:00
|
|
|
PowerSpectra* PowerSpectra_alloc(const us nfft,
|
|
|
|
const us nchannels,
|
|
|
|
const WindowType wt);
|
|
|
|
|
|
|
|
/**
|
2018-02-06 11:01:27 +00:00
|
|
|
* Compute power spectra.
|
|
|
|
*
|
|
|
|
* @param ps[in] PowerSpectra handle
|
|
|
|
* @param[in] timedata Time data. Should have size nfft*nchannels
|
|
|
|
*
|
|
|
|
* @param[out] result Here, the result will be stored. Should have
|
|
|
|
* size (nfft/2+1)*nchannels^2, such that the Cij at frequency index f
|
|
|
|
* can be obtained as result[f,i+j*nchannels]
|
2018-01-29 15:14:50 +00:00
|
|
|
*
|
|
|
|
*/
|
2018-02-06 11:01:27 +00:00
|
|
|
void PowerSpectra_compute(const PowerSpectra* ps,
|
2018-01-29 15:14:50 +00:00
|
|
|
const dmat* timedata,
|
|
|
|
cmat *result);
|
|
|
|
|
|
|
|
/**
|
2018-02-06 11:01:27 +00:00
|
|
|
* Return nfft
|
|
|
|
*
|
|
|
|
* @param ps[in] PowerSpectra handle
|
|
|
|
*
|
|
|
|
* @return nfft
|
2018-01-29 15:14:50 +00:00
|
|
|
*/
|
2018-02-06 11:01:27 +00:00
|
|
|
us PowerSpectra_getnfft(const PowerSpectra* ps);
|
2018-01-29 15:14:50 +00:00
|
|
|
|
|
|
|
/**
|
2018-02-06 11:01:27 +00:00
|
|
|
* Free PowerSpectra
|
2018-01-29 15:14:50 +00:00
|
|
|
*
|
2018-02-06 11:01:27 +00:00
|
|
|
* @param[in] ps PowerSpectra handle
|
2018-01-29 15:14:50 +00:00
|
|
|
*/
|
2018-02-06 11:01:27 +00:00
|
|
|
void PowerSpectra_free(PowerSpectra* ps);
|
2018-01-29 15:14:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // PS_H
|
|
|
|
//////////////////////////////////////////////////////////////////////
|