User Tools

Site Tools


start

What is QLSA

QLSA stands for Quasi Logarithmic Spectrum Analyzer, and it is meant as a tool for the multi-channel implementation of the approach introduced in:

C.Ciofi, G. Scandurra, G. Giusi, G. Cannatà, “Quasi-logarithmic frequency resolution approach in DFT based spectral estimation”, IEEE International Instrumentation and Measurement Technology Conference (I2MTC), doi:10.1109/I2MTC.2017.7969739.

QLSA is a C library aimed at the implementation, in real time, of spectral analysis over a wide frequency range (several decades) while operating on relatively short records (typically $2^{12}$ samples).

QLSA is capable of operating with multiple channels for cross correlation applications.

QLSA is heavily based on the FFTW library for efficient DFT calculation.

QLSA relies on the pthread library for multithreading in windows (first working implementation: july 2017).

QLSA expected first debugged release: December 2018.

A video illustrating the operation of QLSA in an actual measurement application will be soon added here to provide an idea of the performances to be expected.

New features:

Now QLSA, while allowing noise analysis as discussed in the referenced paper, can also perform, in parallel, Narrow Band (or High Resolution) frequency estimation in a user selected bandwidth. See section at the end of the page.

How do I get QLSA

While I enjoy writing pieces of software for applications in my research activity, I am not an expert on licensing. Since QLSA relies on FFTW and pthread for windows, at this moment I am not sure what I can release and how. People interested in obtaining a copy of QLSA will have to send a request at the address that will be published soon before the first official release. Distribution will be in the form of a DLL for windows (most professional acquisition boards have reliable drivers only for windows); a linux release will be prepared as well. Source code will be released as soon as I will be able to figure out the licensing issue.

QLSA basics

Suppose you have an N channel acquisition board (with anti aliasing filters) for signal acquisition. QLSA allows the easy implementation of an N channel spectrum analyzer. When QLSA is used with an N channels board and spectrum analysis is started, it evaluates (and averages) the power spectra of the N channels and the N(N-1)/2 cross spectra among all channels. QLSA can also be used to continuously store the acquired data into a binary file for post processing. Spectrum analysis and data storage work independently of one another. That is, one can start storing data and at a later time start and stop spectrum analysis and vice-versa.

Starting QLSA and transferring data from acquisition to QLSA engine

the relevant functions are:

  • QLSA_Init;
  • QLSA_New_Data;
  • QLSA_Close;

QLSA_Init

The function QLSA_Init creates the required structures and sets the QLSA elaboration parameters. QLSA is defined as follows:

int QLSA_Init(int ch_num, int rec_len_log2, int buf_rec_num, int dec_stages_num );
  • ch_num is the number of channels;
  • rec_len_log2 is the integer exponent to the number “2” for obtaining the elaboration record length (number of samples for each channel). For instance for a record of 4096 samples rec_len_log2=12. This parameter sets the record length RECLEN for FFT calculation.
  • buf_rec_num: there is an internal buffer used for temporarily storing incoming data prior to elaboration. Since data must be sent to the QLSA engine with QLSA_New_Data in records with a length (samples per channel) exactly equal to the elaboration length set by rec_len_log2, if data become available in longer records (i.e. a half buffer acquisition is implemented with a longer buffer length), QLSA_New_Data will have to be called several times in succession. Make sure that you account for this factor when setting the buffer length. The buffer length is set in number of records. Therefore with rec_len_log2=12 and buf_rec_num=16, we set a buffer length of 65536 samples per channel. The length of the buffer is only limited by the available memory.
  • dec_stage_num: number of stages for quai-log approach. Each stage but the first will correspond to a stream of data decimated by 4 with respect to the previous one. Typically 10 stages are more than enough in most cases. If the acquistion frequency is 200kHz, with a record length=4096, the last stage will provide for a resolution bandwidth of about 0.2 mHz. Since the computation weight corresponding to adding one stage is 1/4 that the weight of the previous stage, using dec_stage_num=100, although meningless, has a computational cost almost equivalent to, say, dec_stage_num=5. The value of dec_stage_num is only limited by the available memory.

Note that the acquistion frequency does not appear in QLSA_init. The knowledge of the acquisition frequency is only required for correct scaling spectral data and this parameter is passed by the function starting spectral estimation (see below).

Returned value is 0 upon success; a negative number otherwise.

QLSA_New_Data

In a typical application, a callback function is used to transfer data from the acquisition board into some array. Within such a callback, one must use QLSA_New_Data to transfer acquired data to the QLSA engine.

QLSA_New_Data is defined as follows:

int QLSA_New_Data(double * pdata);
  • pdata is a pointer to the array of doubles containing the data coming from the acquisition board. in pdata are assumed to represent the voltages at the inputs of the board. If data need to be scaled (or data are in any other format but doubles), data conversion and /or data casting must be performed before calling QLSA_New_Data. The Function transfers exactly RECLEN*ch_num doubles to QLSA. One can program the callback for data transfer from the board using a longer record lengths. However, in this case the record length of the incoming data should be an integer multiple (M) of RECLEN and QLSA_New_Data must be called exactly M times, each time with the appropriate pointer. Data must be organized in channel-scan fashion (interleaved data: for three channels CH1,CH2,CH3,CH1,CH2,CH3,CH1…).

The function returns 0 upon success; a negative number upon error;

QLSA_Close

QLSA_Close is defined as follows.

int QLSA_Close(void);

QLSA_Close destroys all data structures cerated with QLSA_Init and frees the memory. QLSA_Close. Before callong QLSA_Close, all other QLSA operations must be stopped (data saving on disk and spectral analysis). Obviously, also the callback, if any, used for data transfer must be stopped (as it uses QLSA_New_Data).

The function returns 0 upon success; a negative number upon error;

Saving acquired data into a file

Assuming QLSA_Init has been done, user can use the functions

  • QLSA_Start_Save (deprecated)
  • QLSA_Start_Save_Set
  • QLSA_Stop_Save

to start and stop continuous transfer of acquired data to a file. Actual saving is managed by QLSA threads, the user only need to specify when to start (and where) to save data and when to stop. Data saving works independently of spectra calculation.

QLSA_Start_Save

(Usage of this function is deprecated. Use QLSA_Start_Save_Set instead.)

QLSA_Start_Save is defined as follows:

int QLSA_Start_Save(char * filename);

filename is a pointer to a char[] that contains the name (including the path) of the binary file into which the acquired data must be saved. The incoming data from the board (actually from the QLSA_New_Data) are continuously transferred to the file with no elaboration. Note that no information is stored besides the bare stream of data. Hence, one may want to provide for saving an auxiliary text file with information about number of channels and acquisition frequency.

Be careful not to call QLSA_Start_Save when saving is already in progress.

The function returns 0 upon success; a negative number upon error;

QLSA_Start_Save_Set

QLSA_Start_Save_Set should be used instead of QLSA_Start_Save if playback functions (see below) are to be used.

int QLSA_Start_Save_Set(char * filename, double fsample);

filename is a pointer to a char[] that contains the base-name (including the path) of the files that will be used for storing data (file with extension “.dat”) and acquisition parameters (file with extension “.spe”). The incoming data from the board (actually from the QLSA_New_Data) are continuously transferred to the file “.dat” with no elaboration. The file “.dat” is a binary file. Aquired data are stored as doubles. In the case of more than one channel, data are interleaved. A text file “.set” is created in which the number of channels being used and the acquisition frequency are stored. The file “.set” is used by the playback funtions (see below).

Be careful not to call QLSA_Start_Save_Set when saving is already in progress.

The function returns 0 upon success; a negative number upon error;

QLSA_Stop_Save

QLSA_Stop_Save is defined as follows:

int QLSA_Stop_Save(void);

The function stops data saving started by QLSA_Start_Save or by QLSA_Start_Save_Set.

The function returns 0 upon success; a negative number upon error;

Spectral analysis and real time monitoring

Assuming QLSA_Init was successful, one can instruct QLSA to start performing spectral analysis on the incoming data. Analysis then proceeds in a separate thread. In order to allow functionalities such as real time monitoring of the evolution of the spectra and real time monitoring of the incoming data in the time domain with minimum interference between the main program and the QLSA FFT and decimation engine, QLSA contains a duplicate set of arrays for the spectral data and the data in the time domain (for each and any decimation level). Whenever the user require access to the data in the frequency domain (power spectra), QLSA is instructed to make a copy of all the spectra array. The user can then use functions to access the copied data that represents a frozen picture of the situation at the time the copy was made. The same occurs when the user want to access data in the time domain: data from the real time and decimation buffers are copied into a secondary set of arrays. The user can then use functions to access the copied data that represents a frozen picture of the situation at the time the copy was made. In this way, data integrity can be preserved and real time display can be automatically adjusted to accommodate for slow graphical user interfaces or lengthy data elaboration before display.

Starting and stopping spectral analysis

The following functions are used for starting and stopping spectral analysis:

  • QLSA_Set_Spec_Par
  • QLSA_Set_User_Window
  • QLSA_Start_Elab
  • QLSA_Stop_Elab
Very Important note

QLSA_Set_Spec_Par CAN be called BEFORE acquisition is started, whereas QLSA_Start_Elab MUST be called AFTER acquisition is started. It is important to note that to speed up spectrum starting when acquisition is running, it is QLSA_Set_Spec_Par that inits the data structure required for spectra storage and averaging. In other words, once QLSA_Stop_Elab is called, one must necessarily call QLSA_Set_Spec_Par before calling QLSA_Start_Elab once again.

QLSA_Set_Spec_Par (and QLSA_Set_User_Window)

Assuming QLSA_Init was successful, one must call QLSA_Set_Spec_Par before starting actual spectrum analysis. QLSA_Set_Spec_Par is defined as follows:

int QLSA_Set_Spec_Par(int wt, int equiv_N, int adv_by0, int adv_by1, double fs);
  • wt: is an integer specifying the windwow tipe. '0' is uniform window; '1' is Hanning window; '2' is user defined window. See below how to use QLSA_Set_User_Window to set a custom user window.
  • equiv_N: QLSA uses exponential spectra averaging to improve spectra estimate. The exponential averaging factors are set in such a way as to result in residual variance ( in the case of AWGN) equal to that obtained averaging (with constant weight) equiv_N spectra.
  • adv_by0: is an integer parameter [possible values are 1,2,3,4] that sets time overlap for the decimation level 0 (i.e.: data not decimated). The value 1,2,3,4 correspond to 75%, 50%,25% and 0% time overlap, respectively. For a rationale about the use of adv_by0 and adv_by1, see below).
  • adv_by1: same as adv_by0, but for the data at the output of the first decimation block. For a rationale about the use of adv_by0 and adv_by1, see below).
  • fs: is the sampling frequency. We need to know the sampling frequency for spectra normalization.

If one is willing to use a custom window, this can be done by using QLSA_Set_User_Window. QLSA_Set_User_Window is defined as follows:

int QLSA_Set_User_Window (double *uwp)
  • uwp is a pointer to an array of doubles containing the impulse resposnse (window) with a length equal to the elaboration length set with QLSA_Init.

QLSA_Set_User_Window must be used BEFORE QLSA_Set_Spec_Par is called. QLSA_Set_Spec_Par uses the user window data to obtain a normalized window (no need for window normalization: it is managed by QLSA).

About the adv_by0 and adv_by1 parameters To improve convergence in spectral averaging, a time overlap of 75% is used for all decimation levels above 1. In the case of the decimation level 0 and 1, that are the ones requiring the most computational power, it might not be really necessary to employ overlap, since, if the acquisition frequency is high, records are coming in at a fast rate. In these cases, adv_by0 and adv_by1 can be set both to 4. However, if one uses low acquisition frequencies, one may be willing to set different degrees of overlapping for both the incoming data (decimation level 0) and the data at the output of the first decimation stage (decimation level 1).

The functions return 0 if successful; the functions returns a negative integer otherwise.

QLSA_Start_Elab and QLSA_Stop_Elab

These functions are defined as follows:

int QLSA_Start_Elab(void);
int QLSA_Stop_Elab(void);

Provided that QLSA_Init and QLSA_Set_Spec_Par were successful, actual elaboration (decimation and spectral estimation) is started by QLSA_Start_Elab(). Elaboration is stopped by QLSA_Stop_Elab(). Each time a new elaboration starts, all previous accumulated results (decimated signals and averaged spectra) are discared and elaboration and spectral estimation starts again.

The functions return 0 if successful; the functions returns a negative integer otherwise.

Accessing time domain and spectral data

While data elaboration is running, user can access data in the time domain using the following functions:

  • QLSA_Req_Time;
  • QLSA_Get_Time;
QLSA_Req_Time

The function is defined as follows:

int QLSA_Req_Time(void);

The function instructs the QLSA engine to produce an exact copy of the time buffers (incoming data and decimated data) at the earliest time consistent with maintaining data integrity. The function does not wait for the operation to be complete. Checking for data availability is managed as part of QLSA_Get_Time usage.

The function returns 0 if successful; the functions returns a negative integer otherwise.

QLSA_Get_Time

The function is defined as follows:

int QLSA_Get_Time(int ch1, int dec_lvl, double **re);
  • ch1: channel we are interested in (from 0 to num_chan-1)
  • dec_lvl: decimation level (0: no decimation, i>0 output of the ith decimation block).
  • re: the address of the pointer to the buffer where requested data will be read in. The size is the elaboration length set with QLSA_Init.

The first time the function is called after QLSA_Get_Time, attention must be paid to the fact that data may still not be ready (see above). If data are not ready, the function returns a negative value. This fact cn be exploited to wait for the availability of new data. For instance

QLSA_Req_Time();
while (QLSA_Get_Time(channel, dec_lvl, &dati)<0)
{
}
//when we exit the while, data are ready;

Once the first call is successful, QLSA_Req_Time can be used as many times as required to access all available data in the time domain. Remember that we will be accessing the data “frozen” at the time the copy was made as a consequence of QLSA_Req_Time.

Accessing spectra can be done much in the same way as in the case of accessing data in the time domain by using the functions:

  • QLSA_Req_Power
  • QLSA_Get_Spec
QLSA_Req_Power

The function is defined as follows:

int QLSA_Req_Power(void);

The function instructs the QLSA engine to produce an exact copy of the averaged spectra (autospectra and cross spectra) at the earliest time consistent with maintaining data integrity. The function does not wait for the operation to be complete. Checking for data availability is managed as part of QLSA_Get_Spec usage.

The function returns 0 if successful; the functions returns a negative integer otherwise.

QLSA_Get_Spec

The function is defined as follows:

int QLSA_Get_Spec(int ch1, int ch2, int dec_lvl, double **re, double **im, int * num_ave);
  • ch1,ch2: channels defining the spectrum to be read. ch1=ch2 is autospectrum, ch1!=ch2 is a cross spectrum. Note that QLSA only calculates cross spectra with ch2>ch1.
  • dec_lvl: decimation level (0: no decimation, i>0 output of the ith decimation block).
  • re,im: the address of the pointer to the buffers where the real part and the imaginary part of the spectrum will be stored. only frequencies f for which (0⇐f<fs/2) are actually stored (the length of the buffers can be half of the elaboration length set by QLSA_Init).
  • num_ave: the current number of averages done for the selected decimation level are returned in this variable.

The first time the function is called after QLSA_Req_Power, attention must be paid to the fact that data may still not be ready (see above). If data are not ready, the function returns a negative value. This fact can be exploited to wait for the availability of new data. For instance

QLSA_Req_Power();
while (QLSA_Get_Spec(1,2, 3, &dati_r,&dati_i,&numave)<0)
{
}
//when we exit the while, data are ready;

Once the first call is successful, QLSA_Get_Spec can be used as many times as required to access all available data in the frequency domain. Remember that we will be accessing the data “frozen” at the time the copy was made as a consequence of the QLSA_Req_Power.

Extended features: high resolution DFT

We have just added a new feature to QLSA, that is the ability to perform spectral estimation with high resolution within a bandwidth selected by the user. This feature can have a number of useful applications that will be discussed at a later time. What the extension does, when activated, is the analisys in a frequency range selected by the user with a “calculated frequency resolution” (cfr) equal to the frequency range divided by the record length selected in QLSA_Init and with the ability to employ a set of predefined “resolution bandwidts” (rbw). Before entering into the details of the functions used to obtain this functionality, a premise is mandatory

Resolution Band-Width (RBW) and Calculated Frequency Resolution (CFR)

We define Calculated Frequency Resolution (CFR) the minimum frequency interval between successive frequency bins in spectral estimation. Therefore, in a situation in which we are estimating a spectrum between 1000 Hz and 2000 Hz in steps of 1 Hz, we are working with a CFR of 1 Hz. Performing spectral estimation with DFT is equivalent, for each calculated frequency, in estimating the total power at the output of a narrow pass band filter centered at that frequency. The bandwidth of such filter (or, more precisely, its equivalent noise bandwidth) is what we call Resolution Band-Width (RBW). Often RBW and CFR are confused since in ordinary spectral estimation by means of FFT the RBW is very close to the CFR. In a way, QLSA works on this principle: by decimating the input signal we obtain, for the same record length, a lower CFR (CFR is equal to the decimated sampling frequency divided by the record length) and a narrower RBW (RBW is inversely proportional to the time duration of the record). In general, in conventional FFT spectral estimation, both CFR and RBW are essentially equal to the sampling frequency divided by the record length. There is, however, no reason why, in principle, these two quantities should be coupled to one another. For instance, zero padding a sequence to obtain a longer sequence allows to obtain a higher frequency resolution (lower CFR) but with an essentially unchanged RBW. On the other end, the QLSA in its original form is a demonstration of the fact that it is possible, by operating on contiguous records with constant (small) length, to obtain RBW as small as desired. The only limitation in the approach that resorts to pure decimation is that we obtain a RBW that is inversely proportional to the maximum frequency we can calculate.

The QLSA HR resorts to the Chirp Zeta Transform and to an original elaboration approach to remove such limitation, thus allowing high resolution (in terms of both CFR and RBW) in a narrow band spectra located anywhere in the entire bandwidth of the system.

We will not enter into the detail of the numerical algorithm we developed. Suffices to say that QLSA (HR) allows the user to specify a minimum and a maximum frequency and a number of different RBWs while maintaining the same CFR in the bandwidth. The CFR is given by the resulting frequency inteval divided by the record length set in QLSA_Init.

The reason why one may be willing to employ more than one RBW at once is that the smaller the RBW, the longer the spectrum averaging time required to reduce the variance of the estimated spectrum points. An application example can provide an insight in the motivations that led to the developement of QLSA (HR).

Suppose we want to measure (by means of cross correlation) the response of a system characterized by a strong resonance that we expect to be located at about 32700 kHz. Suppose tha acquisition frequency is 204.8 kHz and we restrict ourselves to a record length N=4096. The frequency resolution in “regular” DFT would be 50 Hz, that can be completely insufficient for estimating a high Q response coming, say, from a quartz microbalance based on a tuning fork (quality factors in the range of several thousands). However, with an approach such as the one we propose, we can make the following choice: set f minimum to, say, 32000 Hz; set fmaximum to, say, 33000 Hz. The CFR in our approach would be 1000/4096 Hz (0.25 Hz) that is much smaller than the expected bandwidth of the system even assuming a quality factor of 10000. Since we may not be sure of the actual value of the quality factor (suppose we only know that is somewhere between 1000 and 10000), we can select a number of RBWs, say form 10 Hz down to 0.5 Hz to manage all possible outcomes. Indeed, with a too large RBW with respect to the bandwidth of the system we would obtain an unacceptable distorsion of the frequency response (due to leakage) while with an unnecessary narrow RBW, the time required for spectral averaging would be unconveniently long. Our system allows to calculate the outcomes with a number of RBW (all at the same time) and a proper GUI may allow to monitor and compare the results in real time thus allowing to select the best combiantion in terms of low systematic error (low leakage) and low statistical error (variance in the spectral data).

QLSA (HR) introduction

The part of QLSA that manages high resolution spectra works independently of the other elaboration sections (Quasi-Log Spectral Analysis and data saving). One can activate all three functions at any given time or can only activate the ones that are required. As in the other cases, function calls can occur only after QLSA_Init and the function QLSA_New_Data must be used to transfer acquired data to the internal QLSA data buffer.

In the case of QLSA (HR) the record length for elaboration (set with QLSA_Init) is the number of frequency bins for high resolution spectral estimation.

Operations of QLSA (HR) occur in the same fashion as in the case of quasi log spectral estimation. The relevant functions are:

int QLSA_HR_Init(int max_rbw_number);
//creates data structures and thread for QLSA (HR). The max number of resolution bandwidths that will be used must be specified. 
 
int QLSA_HR_Close(void);
//stops the thread and destroys the data structures used by QLSA (HR);
 
int QLSA_HR_Set_Par(double f_start, double f_stop, double f_sample, int equiv_N, int rbw_num, double * rbw_values);
//sets parameters for spectral analysis: minimum frequency (f_start), maximum frequency (f_stop), sampling 
//frequency of the incoming data (f_sample), exponential spectra averaging parameter (equiv_N; see QLSA_Set_Par); 
//actual number of resolution bandwidths to use (must be less or equal to the parameter in QLSA_HR_Init), an array 
//containing the resolution bandwidth to be used in calculation (rbw_values). 
 
int QLSA_HR_Set_Autorbw(double f_start, double f_stop, double f_sample, int equiv_N);
// a simplified version of the previous function. The number of resolution bandwidths is set to the maximum number 
//(defined in QLSA_HR_Init) and the values of the resolution bandwidths are 2^{-1}MRBW, 2^{-2}MRBW, 2^{-3}MRBW,....  
//where MRBW is the sampling frequency divided by the elaboration record length. 
// DO NOT CALL BOTH QLSA_HR_Set_Autorbw and QLSA_HR_Set_Par.
 
int QLSA_HR_Start_Elab(void);
//analogous to QLSA_Start_Elab;
//N.B.: as in the case of QLSA_Start_Elab, after a stop, QLSA_HR_Set must be called to reset arrays even if
//parameters have not changed before restarting analysis. 
 
 
int QLSA_HR_Stop_Elab(void );
//analogous to QLSA_Sop_Elab;
 
int QLSA_Req_HR_Power(void);
//analogous to QLSA_Req_Power
 
int QLSA_HR_Get_Spec(int ch1, int ch2, int rbw_index, double **re, double **im, int * num_ave);
//analogous to QLSA_Get_Spec; rbw_index is the index individuating the resolution bandwidth among the avaliable 
//ones

Off line analisys

(added jan 2019)

Off line analysis consist in playing back data saved into a file. QLSA provides funtions for easily managing playback, provided that data were saved uing the QLSA_Start_Save_set function.

Functions for managing playback are the following:

  • QLSA_Fopen_Rec;
  • QLSA_Fclose_Rec;
  • QLSA_Get_Recorded_Time;
  • QLSA_Get_Ch_Num;
  • QLSA_Get_Frequency;
  • QLSA_Transfer_From_File;
  • QLSA_Set_Start_Time;

In order to analyze data stored in a file, we need to know the number of channels used during acquisition and the acquisition frequency. More importantly, the number of channles is part of QLSA initialization. If data have been stored using QLSA_Start_Save_Set (see above) the number of channels and the acquisition frequency are stored in the file with extension “.spe”. With these premises, we can discuss the role and operation of all the functions devoted to playback.

QLSA_Fopen_Rec

The function QLSA_Fopen_Rec is used before a call to QLSA_Init to retrive information about the stored data.

QLSA_Fopen_Rec is defined as follows:

int QLSA_Fopen_Rec(char * fname);
  • filename is a pointer to a char[] that contains the complete name (including the path and the extension) of the file “.spe” created with a call to QLSA_Start_Save_Rec. Information about the saved data are retrived and stored internally (number of channels, acquisition frequency, overall duration of the acquisition). Functions QLSA_Get_Ch_Num, QLSA_Get_Frequency, QLSA_Get_Recorded_Time are used to access these data for QLSA engine initialization and for spectral analisys setting.

QLSA_Fopen_Rec

The function QLSA_Fopen_Rec is used before a call to QLSA_Init to retrive information about the stored data.

QLSA_Fopen_Rec is defined as follows:

int QLSA_Fopen_Rec(char * fname);
  • filename is a pointer to a char[] that contains the complete name (including the path and the extension) of the file “.spe” created with a call to QLSA_Start_Save_Rec. Information about the saved data are retrived and stored internally (number of channels, acquisition frequency, overall duration of the acquisition). Functions QLSA_Get_Ch_Num, QLSA_Get_Frequency, QLSA_Get_Recorded_Time are used to access these data for QLSA engine initialization and for spectral analisys setting.

QLSA_Get_Recorded_Time

QLSA_Get_Recorded_Time is defined as follows:

int QLSA_Get_Recorded_Time( double* recordtime)
  • recordtime is a poimnter to a double that will contain the overall duration (in seconds) of the recorded data .

A call to QLSA_Get_Recorded_Time makes sense only if the recorded data set has been open (a call to QLSA_Fopen_Rec was succesfull). At the present stage of the release, no safeguard is in place against incorrect use of QLSA_Get_Recorded_Time (the function always returns 0).

QLSA_Get_Ch_Num

QLSA_Get_Ch_Num is defined as follows:

int QLSA_Get_Ch_Num(int * channum);
  • channum is a poimnter to an integer that will contain the number of channels used in data acquisition.

A call to QLSA_Get_Ch_Num makes sense only if the recorded data set has been open (a call to QLSA_Fopen_Rec was succesfull). At the present stage of the release, no safeguard are in place against incorrect use of QLSA_Get_Ch_Num (the function always returns 0).

QLSA_Get_Frequency

QLSA_Get_Frequencyis defined as follows:

int QLSA_Get_Frequency(double * frequency);
  • frequency is a poimnter to a double that will contain the acquisition frequency used in data acquisition

A call to QLSA_Get_Frequency makes sense only if the recorded data set has been open (a call to QLSA_Fopen_Rec was succesfull). At the present stage of the release, no safeguard are in place against incorrect use of QLSA_Get_Frequency (the function always returns 0).

QLSA_Set_Start_Time

QLSA_Set_Start_Time is used to move the internal data pointer for data retrival and analysis to any position withing the entire duration of the recording. Typically, this is used to start the analysis from times other than time 0 (the beginning of the file). The user specifies the desired starting point in seconds, and the function provides to move the pointer to the closest position maintaining data consistency as far as data interleaving is concerned).

QLSA_Set_Start_Time is defined as follows:

int QLSA_Set_Start_Time (double time_start);
  • time_start is a double that containing the desired start time in seconds. A call to QLSA_Set_Start_Time makes sense only if the recorded data set is open (a call to QLSA_Fopen_Rec was succesfull). At the present stage of the release, the function only cheks that the specified time is within 0 and the maximum time (the function returns -1 if the specified time is oustide this interval, 0 otherwise).

QLSA_Transfer_From_File

QLSA_Transfer_From_File is used to move data from file to the QLSA engine.

QLSA_Transfer_From_File is defined as follows:

int QLSA_Transfer_From_File(int recnum)
  • recnum is the number of records to be sent to the QLSA engine. The length of each record is that specified in QLSA_Init. The function returns when all records have been transferred or when the end-of-file (EOF) is reached. A call to QLSA_Transfer_From_File makes sense only if the recorded data set is open (a call to QLSA_Fopen_Rec was succesfull) and a QLSA is started (a call to QLSA_Init is succesfull). At the present stage of the release, the function does not check for incorrect use. Assuming no other problem is present, the function returns 0 if all the specified records have been transferred, a positive number (number of records that were not transferred) if EOF is reached.

QLSA_Fclose_Rec

QLSA_Fclose_Rec closes the files with the recorded data.

QLSA_Fclose_Rec is defined as follows:

int QLSA_Fclose_Rec (void)

QLSA Reference

QLSA in Windows

start.txt · Last modified: 2019/01/26 21:06 by admin