What format of data this socket client requires? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

What format of data this socket client requires?

#!/usr/bin/env python # import necessary libraries from Psychopy and buffer_bci-master from psychopy import visual, core, event, gui, sound, data, monitors from random import shuffle import numpy as np import struct, sys, time, os # use the buffer helper for seting up the connrection, sending/waiting for events bufhelppath=os.path.join("..","signalProc"); sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)),bufhelppath)) from bufhelp import * # ************** Set up buffer connection ************** # set hostname and port of the computer running the fieldtrip buffer. hostname='localhost' port=1972 ftc,hdr=connect(hostname,port) getFeedbackCounter = 0 current_block = 1 # ************** Define some handy functions for experiment ************** # Show instruction def show_instr(instructionText): instruction = visual.TextStim(mywin, text=instructionText,color=(1,1,1),height = 25) instruction.draw() mywin.flip() # wait for key-press allKeys = event.getKeys() while len(allKeys)==0: allKeys = event.getKeys() # define break def do_break(): breaktext = visual.TextStim(mywin, text="Break\n\nPress <space> to continue...",color=(1,1,1),height = 50) breaktext.draw() mywin.flip() # wait for key-press allKeys = event.getKeys() while len(allKeys)==0: allKeys = event.getKeys() # define run through trials def run_exp(nr_blocks,stimulus_conditions, stimulus_instructions,maxTime,feedback): current_trial = 1 global getFeedbackCounter global current_block timer = core.Clock() for block in range (1,nr_blocks+1): instruction = visual.TextStim(mywin, text="Block "+str(current_block),color=(1,1,1),height = 50) instruction.draw() mywin.flip() sendEvent("experiment.block",current_block) core.wait(2) for trial in range(1,len(stimulus_conditions)): instruction = visual.TextStim(mywin, text=stimulus_instructions[stimul

6th Nov 2022, 5:13 AM
Zhenis Otarbay
Zhenis Otarbay - avatar
1 Answer
+ 1
bytes
8th Dec 2022, 9:58 AM
Chris Jonathan
Chris Jonathan - avatar