![]() |
|
|
|
#1
|
|||
|
|||
|
data lose
I have an EEG system I'd like to use to send data to vizard over our network.
EEG System --> BCI Software ---> Network (UDP) ---> Vizard so, when i send to data from BCI software to vizard, the data lose is induced. my BCI software data sampling rate is 256hz, how can i get all data from BCI software to Vizard ? |
|
#2
|
|||
|
|||
|
You could try using the Python socket module to receive the data.
If you can send data via the parallel port you could try getting that in Vizard using the vizparallel.read command. |
|
#3
|
|||
|
|||
|
HI.
i don't know how can use vizparallel.read . where can i search this example ?? if possible, i want to example code. |
|
#4
|
|||
|
|||
|
attach my code
Code:
import viz
import vizmat
import vizinfo
import socket
import struct
viz.go()
viz.mouse.setVisible(viz.OFF)
#The maximum amount of data to receive at a time
MAX_DATA_SIZE = 1024
#The port to send/receive data on
PORT = 8000
#Get the name of this computer
COMPUTER_NAME = socket.gethostname()
#Get the IP address of this computer
COMPUTER_IP_ADDRESS = socket.gethostbyname('localhost')
#Create a socket to send data over
OutSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
OutSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
#Create a socket to receive data from
InSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
InSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
InSocket.bind(('', PORT))
InSocket.setblocking(0)
viz.directormode(viz.DIRECTOR_FAST)
def SendData(data):
OutSocket.sendto(data,(COMPUTER_IP_ADDRESS,PORT))
def ReceiveData():
try:
return InSocket.recvfrom(MAX_DATA_SIZE)
except:
pass
def onkeydown(key):
if key == ' ':
#Send data over the socket
SendData('hello there')
viz.callback(viz.KEYDOWN_EVENT,onkeydown)
def ontimer(num):
#Try to receive data from socket
data = ReceiveData()
if data:
udp = struct.unpack(">d", data[0][:8])[0]
right = open('c:\\new\\new.txt', 'a+')
right.write(str(udp)+'\n')
print 'Received Message:',udp
viz.callback(viz.TIMER_EVENT,ontimer)
viz.starttimer(0,0,viz.FOREVER)
|
![]() |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Use saved text file data as replay sources problem | mizutani_jun | Vizard | 4 | 10-14-2010 04:49 PM |
| Using 5DT plug-in with the data coming through network... | mcicek | Vizard | 1 | 05-18-2009 05:17 PM |
| Flagging the Data | Elittdogg | Vizard | 5 | 04-11-2008 11:40 AM |
| Data Files | betancourtb82 | Vizard | 6 | 05-04-2006 02:43 PM |
| tracking using quaternarion data | jfreeman | Vizard | 2 | 06-01-2005 08:48 AM |