OpenViBE forum

The OpenViBE community
It is currently Sat Aug 24, 2019 7:34 pm

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Tue Mar 12, 2019 10:43 am 
Offline

Joined: Sun Mar 10, 2019 6:30 pm
Posts: 4
Hello,

I have recently started using OpenVibe and plan on developing one or more connectivity algorithms for the connectivity measure box, since with the current ones volume conduction effects might be very large (I'm thinking in the lines of Imaginary Part of Coherency, Granger Causality...). Besides general advice related to this specific task, two essential questions came up:

1) The box is marked as unstable. How much of it can be trusted to work? Or is there a specific inconsistency with the results, errors, or it is a specific algorithm that is not working? This is important for me to know, so that I don't have to test every single step of the calculations.

2) I noticed when creating two equal sine waves in two different channels and measuring the connectivity between them with Magnitude Squared Coherence that it outputs zero always, whereas it should be 1, since the signal is the same (which is what happens with Phase Locking Value). Am I missing something, or is this an error?

Thanks for your attention!
Cristiano


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 13, 2019 12:40 pm 
Offline

Joined: Wed Oct 31, 2018 9:14 am
Posts: 93
Hi,
1) You have the answer Here : http://openvibe.inria.fr/faq/#unstable
2) I do not know this box very well, you have the algorithm used in the folder : Openvibe_Folder\extras\plugins\processing\signal-processing\src\algorithms\connectivity


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 19, 2019 12:31 pm 
Offline

Joined: Sun Mar 10, 2019 6:30 pm
Posts: 4
Thank you for your information!

I have a note/question to make on the Magnitude Squared Coherence algorithm. I do not know if this is the right place for it, but I rather make all my contacts regarding the functional connectivity algorithms in a single place!

In the definition of the Magnitude Squared Coherence there is in the implementation:
Code:
const VectorXd l_vecXdCoherenceNum = (m_vecXcdCrossSpectrum.real().cwiseProduct(m_vecXcdCrossSpectrum.conjugate())).real();
This means we take the real part of the Cross Spectrum Sxy and multiply by the real part of the conjugate of Sxy. However, I think this might not be a good approach since, considering a very simple case of:
  • x being a sine wave (Sx = Ax*e^iPx, where Ax is the amplitude and Px the phase of Spectrum for a given frequency)
  • y the same sine wave shifted by 90 degrees

Then we would expect high coherence (there is only a delay but the signals are the same), but since through the above implementation we obtain Sxy = Ax*Ay*e^i*PI/2 = i*Ax*Ay , when we take the real part the Coherence vanishes.
Instead, we should make something like:
Code:
const VectorXd l_vecXdCoherenceNum = m_vecXcdCrossSpectrum.cwiseProduct((m_vecXcdCrossSpectrum.conjugate()).real();
That is, we take the real part only of the product of Sxy by its conjugate.

Sorry for the long exposure :P Some feedback on this would be great!


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 20, 2019 2:23 pm 
Offline

Joined: Wed Oct 31, 2018 9:14 am
Posts: 93
I dig a little (the one who coded it is no longer there and at the moment there is very little test in OpenViBE for algorithms) and I asked someone who knows a little more these algo , according to him, you're probably right. If you use the OpenViBE version that you compile yourself, test your change on this line. Just as if you want to implement other connectivity algorithm, I'd be happy to add them later in OpenViBE.


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 20, 2019 2:24 pm 
Offline

Joined: Wed Oct 31, 2018 9:14 am
Posts: 93
I dig a little (the one who coded it is no longer there and at the moment there is very little test in OpenViBE for algorithms) and I asked someone who knows a little more these algo, according to him, you're probably right. If you use the OpenViBE version that you compile yourself, test your change on this line. Just as if you want to implement other connectivity algorithm, I'd be happy to add them later in OpenViBE.
Thibaut


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 21, 2019 12:21 pm 
Offline

Joined: Sun Mar 10, 2019 6:30 pm
Posts: 4
Yes I tested it on a very simple example with 2 channels, each with a sine wave, and a different phase shift between them for each trial.
With the current implementation, the value for Magnitude Squared Coherence starts at 1 for a phase shift of 0º and as the shift increases to 90º the Magnitude Squared Coherence decreases (almost uniformly) to 0.
With the little change I described, the value starts at 1 for a 0º phase shift and decreases to 0.4 at a 90º phase shift.
This is still not ideal, but reasonable if we consider a time epoch of 1s, I suppose.
I am, however, really uncertain as to how should I properly test the connectivity algorithms, and would deeply appreciate any suggestions! :?


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 21, 2019 1:44 pm 
Offline

Joined: Wed Oct 31, 2018 9:14 am
Posts: 93
There are two main methods in my opinion:
1) test with typical values of which we know the result (for example for trigonometry examples test the sine / cosine every 45 ° because they are known values, test a 0 divide, a unit multiplication/divide.....)
2) Test an input series and compare the output with a different library that has already been extensively tested and / or used. For example to test classification algorithms by comparing with scikit learn in python


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Americanized by Maël Soucaze.