sccn / lsl_archived

Multi-modal time-synched data transmission over local network

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EGIAmpServer app connects to EGI but retrieves empty data (on MATLAB)

JmauLeonetti opened this issue · comments

Hello,

I am working on an experiment on sleep and I need to record and analyse EEG data in realtime from the EGI. I have asked a somewhat similar question on Slack one month ago but I didn't have much time to progress on the experiment. I have now installed most of the code/software needed but EGIAmpServer can't seem to retrieve EEG data correctly. Here is my setup so far.

  • The recording machine connected to the EGI is a Mac (under version Snow Leopard).
  • I would like to retrieve EEG data on a Windows laptop (under Windows 10) connected to the former machine through ethernet, by using Matlab code, so I can process it in realtime

I downloaded the EGIAmpServer app for Windows and put it on the Windows laptop. The app seems to work appropriately. To illustrate this, if I put the wrong ip address (the ip address of the Mac machine), the app won't connect (see image below).

error1

By setting all parameters to their appropriate value, the application is able to link to the Mac (see image below).

ampserver2

I have tried to run the "RecieveData.m" example code in \LSL\liblsl-Matlab\examples. Here is the output.

ReceiveData
Loading the library...
Resolving an EEG stream...
Opening an inlet...
Now receiving data...

I have modified line 18 to "[vec,ts] = inlet.pull_sample(2)" so it would timeout after 2 seconds.
Every 2 seconds though the "pull_sample" set variables 'vec' and 'ts' to empty. The "fprintf('%.2f\t',vec);" command from line 20 displays an empty line.

I have verified that the EGI is collecting EEG data with the EGI acquisition software NetStation on the Mac Machine (that only allows recording and not realtime processing). If the EGI is on, I can see the eeg data. I also happen to possess the EGI Amp Server Pro SDK so the problem doesn't come from there.

Thank you very much.

Jean-maurice

Here are the different values of the workspace that I get when running the "RecieveData.m" example code :

lib

lib_value

result

result_value

inlet

inlet_value

ts = []
vec = []

Full workspace

workspace

Where did you get the app?

I've uploaded a version with more debug output, could you start that from the command line and paste the output here?

Hi,

I got the app from ftp://sccn.ucsd.edu/pub/software/LSL/ and downloaded the "EGI AmpServer-1.10.zip" zip file. I'll test your version and report what i got.

Jean-maurice

I have uploaded and unzipped your version (EGI AmpServer App 1.12.0) on my Windows laptop.
I ran "EGIAmpServer.exe" on the command line and it launched the EGI AmpServer Connector. Then in Matlab I ran the "RecieveData.m" code and got the same output as before with returned data being empty.

ReceiveData
Loading the library...
Resolving an EEG stream...
Opening an inlet...
Now receiving data...

There was no output in the command line either. I may have misunderstood your message...

I also tried to read in realtime EEG data with a Biosemi and the Biosemi application from LSL with the same procedure. This time I was able to read recorded data with the "RecieveData.m" code ("fprintf" command displayed vectors of numbers on the Matlab command window).

ReceiveData.m is just an example and is not guaranteed to work with all streams. Before we can determine that the source of the problem is not in Matlab, we need to be sure that ReceiveData.m is doing everything it needs to. The fact that you are getting past the Resolving an EEG stream... line suggests that it is finding a stream with type='EEG', but is that definitely the correct stream in this case? (I could look at the EGI AmpServer source code to determine this, but this is a good lesson/practice for you anyway...)

In Matlab, try lib = lsl_loadlib(); streaminfos = lsl_resolve_all(lib); Go through the resulting streaminfos to see if there are multiple streams, what their names are, what their types are, etc. Try fetching data from each stream to see what you get.

ReceiveData
Loading the library...
Resolving an EEG stream...
Opening an inlet...
Now receiving data...

There was no output in the command line either. I may have misunderstood your message...

When there's no output on the command line, something goes wrong very early. I've uploaded a new build that opens the command line window by default and prints messages before each of the 3 needed connections is established.

As far as I can see, the EGIAmp app was (for lack of an amplifier) never really tested and our amplifier is still somewhere between our lab and the EGI office in Oregon, so I can't test it either right now.

Thank you for your responses.
Where can I find your new build?

Same link, since it was only two minor changes I didn't increment the version.

I tried your new build. I got the following output in the command line (but still empty data in Matlab).

outputcommandwindow

I also ran "lib = lsl_loadlib(); streaminfos = lsl_resolve_all(lib);" in Matlab.
Only one stream was detected, but the informations contained in streaminfos{1} were not very relevant. It contained variables that looked like pointers.

streaminfo

I couldn't see any particular field containing name or sampling frequency. I'll investigate more on that.

It seems to me the amplifier / NetStation app doesn't send any data, otherwise you would see a lot of entries like Waiting for XY bytes. I'll take a look at it as soon as our amplifier is back.

So I tried to pull EEG samples with Python and it didn't work either though I was able to create a StreamInlet. The returned EEG data (from the pull_chunk and pull_sample functions) were empty (NoneType). I ran the following line to see if the detected stream had the correct properties.

streams = resolve_stream(wait_time=1.0)

The object streams[0] contained an instance of class StreamInfo (the streams list was of length 1). The properties were correct :
streams[0].name() --> 'EGI NetAmp 0'
streams[0].type() --> 'EEG'
streams[0].channel_count() --> 64
and so on...

So maybe as you said the problem comes from the recieving Mac machine connected to the EGI not transmitting EEG data to the laptop...

Hi,

We finally managed to make it stream data. The issue was coming from the EGI acquisition machine. We had to unplug and plug again some dongles given by EGI and update EGI firmware (though the update alone was not sufficient). Thank very much for your help.