Hello,
I’ve been struggling to figure out using PsychoPy with PyNetstation module to connect with EGI’s Netstation. I figured out the past problems, and am encountered with one question with that could be possibly linked with synchronization issue.
Issue that I am having is that the egi.ms_localtime() shown on PsychoPy computer is significantly different from the TCP/IP log’s egi.ms_localtime(). See screenshots of the last three events sent:
This is last three custom events of ‘beep’ that I named, shown on the PsychoPy computer. The local time of “Beep sent at 585301043” should be reflected in below TCP/IP log’s last item.
However, at the very bottom item, ‘beep’ here the local time is 91770.
The times here are really off with 585301043 vs. 91770, like the units are totally different. I used both egi.ms_localtime() when sending the time, and made sure that system clock for both machines are very similar (off by around 4 ms). So I am wondering what the problem is.
Below is the really basic python code that I used for this.
#################################################################
# #
# Barebone code for sending signal to Netstation #
# #
#################################################################
from __future__ import absolute_import, division
import os # handy system and path functions
import sys # to get file system encoding
import time
import logging
import egi.simple as egi
ms_localtime = egi.ms_localtime
ns = egi.Netstation()
ns.connect('10.0.0.42', 55513)
ns.BeginSession()
ns.StartRecording()
ns.sync()
def beep():
ns.sync()
log_time=egi.ms_localtime()
print "Beep logged at " + str(log_time)
ns.sync()
sent_time=egi.ms_localtime()
ns.send_event(key='beep', timestamp=egi.ms_localtime(), description='below is sample table', table={'abcd' : 1, 'efgh' : 2}, pad=False)
print "Beep sent at " + str(sent_time)
diff = log_time - sent_time
return diff
Thank you! @imnotamember