for i in range(n_channels): q.append([]) i=0 while (True): # get next data block # if format changed then reinit try: data = xin.recvChunked() except EEGFmtChangedException: header = xin.getTransportHeader().getEEGHeader() print 'Header changed, reinitialization ('+str(header.n_channels)+')' reinit_arrays(header.n_channels, header.n_points) frequency = xin.getTransportHeader().getEEGHeader().frequency calc.reset(header.n_channels, header.n_points, n_fft_points, frequency, step) continue # first run - initialization if q == None: header = xin.getTransportHeader().getEEGHeader() print 'Header changed, reinitialization ('+str(header.n_channels)+')' reinit_arrays(header.n_channels, header.n_points) frequency = xin.getTransportHeader().getEEGHeader().frequency calc.reset(header.n_channels, header.n_points, n_fft_points, frequency, step)
import sys sys.path.append('..') from network.EEGTransport import * x = EEGTransport('udp_m_serv', '224.0.0.1', 17000) for i in xrange(4): data = x.recvChunked() header = x.getTransportHeader() #print 'packet: ' + str(header.getNum()) + ' chunks: ' + str(header.getChunks()) + '\n' #print 'header: ' + header.getEEGHeader().get_header() sys.stderr.write('Packet: ' + str(i)) print data x.close()