Analytic Signals

Forum for software developers to discuss BCI2000 software development
Locked
dsteines
Posts: 16
Joined: 23 Jan 2010, 17:19

Analytic Signals

Post by dsteines » 14 Feb 2010, 16:41

Hello,

We do quadrature downconversion in one of our systems and need to transfer analytic signals between our implementations of the GenericFilter class. Our solution is to add an additional complex channel to the output/input of each module that corresponds to each real channel, which works fine for our purposes.

In order to eliminate the need for paired real and complex channels, is there a way to create complex-valued (use the complex data type in the std library) channels? This would probably pose problems for the visualizations features, but if we added a complex signal type to GenericFilter, how much modification would be needed for that to work?

Thanks,

David

mellinger
Posts: 1341
Joined: 12 Feb 2003, 11:06

Post by mellinger » 15 Feb 2010, 07:33

David,

the BCI2000 specification does not specify complex-valued signals, so full support for complex-valued signals would require an extension to that specification.

From the implementation side, one would need to modify the GenericSignal::ValueType typedef to be std::complex<double> rather than just "double". For full support of complex-valued signals, transmission of complex signals through streams would be required, so you would need to add a complex signal type to the SignalType class, and implement GenericSignal::ReadFromStream/WriteToStream, GenericSignal::ReadBinary/WriteBinary for this type. As far as I can see, the value of such full support would consist in appropriate options for visualizing complex-valued signals (amplitude, power, real, or imaginary part).

Altogether, I guess that simply introducing a convention for how to map real and imaginary parts of complex-valued signals onto channels would be the most efficient solution to the problem. The FFTFilter currently uses the FFTW "halfcomplex" format to store complex-valued FFT coefficients which is not very helpful for general complex signals, so we should probably adopt the chosen complex-to-channels convention for the FFTFilter as well.

Regards,
Juergen

dsteines
Posts: 16
Joined: 23 Jan 2010, 17:19

Post by dsteines » 15 Feb 2010, 10:39

Juergen,

Thanks for the note. I agree that the most efficient solution is to adopt some complex-to-channels convention. For n channels, we simply append n rows to the input and output signals for the imaginary part. I don't know if it is the best convention, but it works for us. This allows us to visualize the real and imaginary parts separately.

What might be useful is if we could define operations on channels in the visualization window--for instance if we could visualize the power of complex valued signals by operating on the real and imaginary channels to create a power channel. This capability might be of wider value to users who wish to combine channels for other purposes. I've only taken a hasty look at the inner-workings of the visualization code, but when I find some time I might take a stab at trying to implement this.

David

Locked

Who is online

Users browsing this forum: No registered users and 0 guests