Psychopy EGI interaction not working

Hello everybody,

I’m trying to connect the computer that will run the Psychopy experiment with an EGI computer that runs Net Station Acquisition. Right now I am trying to connect both computer using a Ethernet cable (with a switch in between). The setup is the following:

I’ve installed the egi package using the following link: egi (pynetstation) — PsychoPy v2021.2

And I am currently trying the following tests:

But when I run this code I get the following error message:

(translated: Timeouterror: a connection attempt has failed because the connected party has not answered correcly after a certain time, or the connection mase failed because the connected host has not answered)

Does anybody have any experience with this? Do I need to change some settings on one or both computers with regard to ethernet connection before this can work? I think the psychopy computer (windows) finds the EGI computer, as can be seen in the following image, but I’m not sure about this:

image

Thanks in advance!

It should be noted that I am trying to run this with python 3. I’ve found the following post: Pynetstation (egi) with python 3

which said it does not work with python 3 yet. I’ve changed some lines of code in the files until I got no errors anymore regarding import errors and so on. I’ll try to install python 2 and see if this works.

Have you managed to make it work? I’m trying the same setup at the moment. I’ve found a pynetstation repository that works with python 3: GitHub - gstothart/EGI-Psychopy-Python3: EGI Psychopy library - Python 3 compatibility update

I’ve replaced the “egi” folder in my psychopy distribution with the one you can download from the link. Then my python 3 script runs. I connected the computer running psychopy (windows) and the EGI computer (mac) both to the Netgear router with an ethernet cable. Netstation aquisition is running on the mac computer, it is connected to the amplifier (NetAmps 400).

However, when I want to connect the windows computer by running the psychopy script, it returns:

File “…/EGITrigger\EGI.py”, line 31, in
ns.connect(‘10.10.10.43’, 55513) # Sample address and port – change according to your network settings
File “C:\Program Files\PsychoPy3\lib\site-packages\egi\simple.py”, line 727, in connect
self._socket.connect( str_address, port_no )
File “C:\Program Files\PsychoPy3\lib\site-packages\egi\socket_wrapper.py”, line 32, in connect
self._socket.connect( ( str_address, port_no ) )
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

I’ve tried changing the IP address from the windows computer from 10.10.10.42 to 10.10.10.43, both in the ethernet setting and in the script (as stated somewhere else) but that did not help. I’m lost.

Dear @SvennoNito ,

Yes I have managed to get things working in the meantime. It was a lot of thinkering however (with placing maps in specific locations and such). I think it might be easiest if we have a zoom call or something to set everything up. I need to warn you beforehand that the timing of the triggers is not optimal. If you want to do ERP studies, I would suggest you use psychtoolbox instead since they have superior trigger timing. I’ve heard this from the people of MagStim.

Dear @gvh ,

that’s great to hear!! I will text you a private message then to organize a zoom call.

Hi @gvh and @SvennoNito,

I’m also having this same issue with my PsychoPy not being able to connect to NetStation. Would love to hear more about what one or both of you did to troubleshoot/fix it. Happy to also organize a zoom if that would be more convenient.

Edit: Note also that my setup was previously working, but the stimulus computer died and had to be replaced, and this problem emerged after moving my previously working task over to the new machine and reinstalling PsychoPy.

Hi ,

I am new to psychopy, and I am facing the exact same problem. can you please help me out regarding this?

Hello,
did you manage to solve the issue?

Since this original thread, much has changed in the EGI/MagStimEGI dynamic for sending triggers in PsychoPy. You can checkout the help page for some basic information.

You can also download a demo experiment to see if it works with your setup (which hopefully will soon be included in PsychoPy by default): GitHub - nimh-cmn/stroopEGI: Demo PsychoPy experiment with EGI EEG amplifier events for Stroop Experiment

The nuance key is that I’ve tested the new packages with 400 series amplifiers considerably more. And only received word of mouth that it works for 300-series (the firewire connector) amplifiers.

I have followed this Sending triggers via EGI NetStation — PsychoPy v2023.1.2 for the setup, and also have tried to run the stroopEGI experiment. However I get the same error, which has been posted here. I am using the latest psychopy version in windows and the amp is 400.

Can you post pictures of your setup? Both hardware and software? NetAmps setup screen too when you open Firefox on the Mac?

This may be faster to debug on zoom. And I’m happy to make time tomorrow or later in the week. But having photos of your setup and network control panels on each system would help me prepare.



these two are from the system connected with the NetAmps 400.


configuration of windows where psychopy is installed

Thanks for the info. In Net Station Acquisition: on the right side under “ECI Events”, do you have port 55513 setup to receive events?

Can you also paste your error message?

Assuming that didn’t fix it, would you be free Friday for a zoom?

Ah - that might be the issue. Click the checkbox next to 55513. And then try to run the StroopEGI experiment again?

File “C:\Users\CIP\Downloads\stroopEGI-main (1)\stroopEGI-main\stroop_lastrun.py”, line 156, in
eci_client.connect(ntp_ip = IP_amp)
File “C:\Program Files\PsychoPy\lib\site-packages\egi_pynetstation\NetStation.py”, line 138, in connect
self._socket.connect()
File “C:\Program Files\PsychoPy\lib\site-packages\egi_pynetstation\socket_wrapper.py”, line 38, in connect
self._socket.connect(self._address)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

This is the error message I got. Okay let me try once with clicking the port checkbox.

Thank you so much. clicking on the checkbox of port 55513 solves the issue.

Excellent! Let us know if you have any other issues.

Hello!

I had the same problem, and now I solved errors with this thread.

I appreciate for it!

However, I cannot find markers in EGI Netstation and in mff format EEG file.

It seems like that the method to send the marker is wrong or that I just can’t find event marker data in mff file.

I attached the code for sending market below.

serverIp = ‘10.10.10.41’
tcpPort = 55513
MyPort = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
MyPort.connect((serverIp, tcpPort))


msg = str(‘0’)
self.MyPort.send(msg.encode())
print(“Sending marker No:” f’{msg}')