def setupExperiment(): from psychopy import gui """ Setup the experimental variables with a dialog box """ dlgMonitor, monitorInfo = setup_monitor() expInfo = { 'Partecipant': 'Subj', 'Block': ['Unilateral', 'Bilateral', 'Uni+Bi'], 'Subject code': '00', 'NumBalls': 4, 'RectWidth': 6, 'RectHeight': 6, 'BallRadius': 0.25, 'Duration': 2, 'BlinkTime': 1, 'TrainingTrials': 0, 'SimulationMode': False, 'DrawRectangles': False, 'SaveVideo': False } dlg = gui.DlgFromDict( dictionary=expInfo, title='Tracking Experiment', order=[ 'Partecipant', 'Subject code', 'Block', 'RectWidth', 'RectHeight', 'BallRadius', 'Duration', 'BlinkTime', 'TrainingTrials', 'NumBalls', 'SimulationMode' ], tip={ 'Partecipant Name': 'Name of the participant', 'Subject code': 'Code of the subject', 'RectWidth': 'Width in cm of the left or right rectangle', 'RectHeight': 'Height in cm of the left or right rectangle', 'BallRadius': 'Radius of the balls in cm', 'Duration': 'Duration of the stimulus in seconds', 'BlinkTime': 'Time of white/black ball blinking in seconds', 'TrainingTrials': 'Number of preparation training trials', 'SimulationMode': 'Run the experiment with a perfect cumulative normal observer' }) if not dlg.OK: core.quit() # user pressed cancel # nUp is the number of incorrect (or 0) responses before the staircase level increases. # nDown is the number of correct (or 1) responses before the staircase # level decreases. staircaseInfo = { 'StepType': ['lin', 'db', 'log'], 'Selection': ['random', 'sequential'], 'MinReversals': 6, 'MinTrials': 10, 'SpeedUniLeft': 5.0, 'SpeedUniRight': 5.0, 'SpeedBiLeft': 2.5, 'SpeedBiRight': 2.5, 'StepSizes': '[0.5,0.25]', 'nUpUniLeft': 1, 'nUpUniRight': 1, 'nUpBiLeft': 1, 'nUpBiRight': 1, 'nDownUniLeft': 1, 'nDownUniRight': 1, 'nDownBiLeft': 1, 'nDownBiRight': 1, 'AverageReversals': 3 } dlgStaircase = gui.DlgFromDict(dictionary=staircaseInfo, title='Staircase procedure') if not dlgStaircase.OK: core.quit() outputfile = set_output_file(expInfo, 'tracking_') save_experimental_settings(outputfile + '_info.pickle', expInfo, staircaseInfo, monitorInfo) return expInfo, staircaseInfo, outputfile, monitorInfo
from psychopy import core, gui from psychopy import visual, event from psychopy import prefs prefs.general['audioLib'] = ['pygame'] from psychopy import sound from U39_reverseJPN_revised import * from os.path import expanduser '''get participant's info''' info = {"Participant's ID": ''} #,"Code Condition":''} infoDlg = gui.DlgFromDict(dictionary=info, title='U39', fixed=['ExpVersion1']) if infoDlg.OK: print info else: print 'User Cancelled' ID = info["Participant's ID"] #code = info["Code Condition"] code = ID[0] condition_paramaters = get_condition(code) condition = condition_paramaters[0] condition_order = condition_paramaters[1] noun_position = condition_paramaters[2] home = expanduser("~") #path = home+"/Desktop/U39Lab/" path = "/Users/Oseki/Documents/U39LabJPN/" '''set up csv to store data''' set_outputCSV(path, ID) ''' get meanings and signals ''' dict_signals = dict_sentences(noun_position) dict_sentences = dict_signals[0] dict_words = dict_signals[1]
import sys # to get file system encoding #for button box import serial import serial.tools.list_ports import time, sys, os #, pylab useButtonBox = True triggerTest = False # Ensure that relative paths start from the same directory as this script _thisDir = os.path.dirname(os.path.abspath(__file__)).decode( sys.getfilesystemencoding()) os.chdir(_thisDir) # Store info about the experiment session expName = 'LDT2' # from the Builder filename that created this script expInfo = {u'session': u'01', u'participant': u''} dlg = gui.DlgFromDict(dictionary=expInfo, title=expName) if dlg.OK == False: core.quit() # user pressed cancel expInfo['date'] = data.getDateStr() # add a simple timestamp expInfo['expName'] = expName # Data file name stem = absolute path + name; later add .psyexp, .csv, .log, etc filename = _thisDir + os.sep + u'data' + os.sep + '%s_%s' % ( expInfo['participant'], expInfo['date']) # An ExperimentHandler isn't essential but helps with data saving thisExp = data.ExperimentHandler( name=expName, version='', extraInfo=expInfo, runtimeInfo=None,
if __name__ == '__main__': # Ensure that relative paths start from the same directory as this script try: script_dir = op.dirname(op.abspath(__file__)).decode( sys.getfilesystemencoding()) except AttributeError: script_dir = op.dirname(op.abspath(__file__)) # Collect user input # ------------------ # Remember to turn fullscr to True for the real deal. exp_info = {'Subject': '', 'Session': '', 'BioPac': ['Yes', 'No']} dlg = gui.DlgFromDict(exp_info, title='Arithmetic task', order=['Subject', 'Session', 'BioPac']) window = visual.Window(fullscr=True, size=(800, 600), monitor='testMonitor', units='norm', allowStencil=False, allowGUI=False, color='black', colorSpace='rgb', blendMode='avg', useFBO=True) if not dlg.OK: core.quit() # user pressed cancel if exp_info['BioPac'] == 'Yes':
Nresp=2 Nfeedback=2 Nrules=2 Nparts=10 mean_switch=40 std_switch=20 #range around mean switch Nreversals=Nparts-1 Ntrials=mean_switch*Nparts #make data file info= {"ppnr": 0, "Name":"", "Session": 0} # Data file already_exists = True while already_exists: myDlg = gui.DlgFromDict(dictionary = info, title = "Probabilistic reversal learning task") directory_to_write_to = "/Users/Pieter/Documents/psychopy_exercices" + "/" + str(info["ppnr"]) if not os.path.isdir(directory_to_write_to): os.mkdir(directory_to_write_to) file_name = directory_to_write_to + "/Prob_reversal_learning_task_subject_" + str(info["ppnr"]) + "_Session_" + str(info["Session"]) + "_data" if not os.path.isfile(file_name+".tsv"): already_exists = False else: myDlg2 = gui.Dlg(title = "Error") myDlg2.addText("Try another participant number") myDlg2.show() print("OK, let's get started!") thisExp = data.ExperimentHandler(dataFileName = file_name, extraInfo = info) my_clock= core.Clock() #make window
rad2deg, linspace, asarray) from numpy.random import random, randint, normal, shuffle import os # handy system and path functions import sys # to get file system encoding from psychopy.hardware import keyboard # Ensure that relative paths start from the same directory as this script _thisDir = os.path.dirname(os.path.abspath(__file__)) os.chdir(_thisDir) # Store info about the experiment session psychopyVersion = '3.1.1' expName = 'untitled.py' expInfo = {'participant': '', 'session': '001'} dlg = gui.DlgFromDict(dictionary=expInfo, sortKeys=False, title=expName) if dlg.OK == False: core.quit() # user pressed cancel expInfo['date'] = data.getDateStr() # add a simple timestamp expInfo['expName'] = expName expInfo['psychopyVersion'] = psychopyVersion # Data file name stem = absolute path + name; later add .psyexp, .csv, .log, etc filename = _thisDir + os.sep + u'data/%s_%s_%s' % (expInfo['participant'], expName, expInfo['date']) # An ExperimentHandler isn't essential but helps with data saving thisExp = data.ExperimentHandler(name=expName, version='', extraInfo=expInfo, runtimeInfo=None,
from psychopy import visual, core, event, gui from sys import exit import csv, random #print subj info exp_name = '鳥類名稱配對測驗' info = { '編號': '', '姓名': '', '年齡': '', '性別': ('男', '女'), '賞鳥年齡': '', '專業度自評': (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) } infoDlg = gui.DlgFromDict(dictionary=info, title=exp_name, order=['編號', '姓名', '性別', '年齡', '賞鳥年齡', '專業度自評']) if infoDlg.OK == False: core.quit() #open new files to record dataFile = open("%s.csv" % (info['編號'] + '_' + info['姓名']), 'a') dataFile.write(info['姓名'] + ',' + info['年齡'] + ',' + info['編號'] + '\n') win = visual.Window(size=(1000, 600), color=(1, 1, 1), fullscr=False) #實驗準備 text_1 = visual.TextStim(win, text=u'', height=40, pos=(0.0, 0.0), color='black',
def setupExperiment(): from psychopy import gui """ Setup the experimental variables with a dialog box """ dlgMonitor, monitorInfo = setup_monitor() expInfo = { 'Partecipant': 'Subj', 'Subject code': '00', 'SquareEdge': 6, 'BallRadius': 0.5, 'BlinkTime': 3, 'TrainingTrials': 0, 'SaveVideo': False } dlg = gui.DlgFromDict(dictionary=expInfo, title='Flicker Experiment', order=[ 'Partecipant', 'Subject code', 'SquareEdge', 'BallRadius', 'BlinkTime', 'TrainingTrials', ], tip={ 'Partecipant Name': 'Name of the participant', 'Subject code': 'Code of the subject', 'SquareEdge': 'Length of the virtual square edge', 'BallRadius': 'Radius of the balls in cm', 'BlinkTime': 'Time of white/black ball blinking in seconds', 'TrainingTrials': 'Number of preparation training trials', }) if not dlg.OK: core.quit() # user pressed cancel # nUp is the number of incorrect (or 0) responses before the staircase level increases. # nDown is the number of correct (or 1) responses before the staircase # level decreases. staircaseInfo = { 'StepType': ['lin', 'db', 'log'], 'Selection': ['random', 'sequential'], 'MinReversals': 6, 'MinTrials': 10, 'FlickerFreqLeft': 10.0, 'FlickerFreqRight': 10.0, 'StepSizes': '[0.5,0.25]', 'nUpLeft': 1, 'nUpRight': 1, 'nDownLeft': 1, 'nDownRight': 1, 'AverageReversals': 3 } dlgStaircase = gui.DlgFromDict(dictionary=staircaseInfo, title='Staircase procedure') if not dlgStaircase.OK: core.quit() outputfile = set_output_file(expInfo, 'flicker_') save_experimental_settings(outputfile + '_info.pickle', expInfo, staircaseInfo, monitorInfo) return expInfo, staircaseInfo, outputfile, monitorInfo
config['ExpVersion'] = '3.0.0' #create a DlgFromDict GUI configDlg = gui.DlgFromDict( dictionary=config, title='Colorflash Experiment', order=[ 'ExpVersion', 'Observer', 'SubjectID', 'SessionNr', 'RunNr', 'Gender', 'Date', 'attTask', 'stimSize', 'stimPosX', 'trialDur', 'restDur', 'flickFreq', 'letterDur', 'letterSize', 'offsetDur' ], tip={ 'SubjectID': 'Please fill in with CAPITAL letters and a number, eg:"SUBJECT01".', 'SessionNr': 'Session number.', 'RunNr': 'Write the run number.', 'attTask': 'has no use for now', 'stimSize': 'degrees of visual angle', 'stimPosX': 'distance from a center of stimulus to the center of screen, in degrees of visual angle', 'trialDur': 'seconds', 'restDur': 'seconds', 'flickFreq': 'hertz', 'letterDur': 'seconds', 'letterSize': 'degrees of visual angle', 'offsetDur': 'second. initial delay after scanner signal' }, fixed=['ExpVersion', 'Date'] #this attribute can't be changed by the user ) #configurations (safeguard to override GUI values) stimSize = config['stimSize'] #degrees of visual angle
import numpy from psychopy import sound params = { 'ID number': '1', 'frameRate': 120, 'w1': 0.2, 'ISI1': 0.3, 'w2': 0.2, 'blank': 0.3, 'fp': 0.3, 'task': 'wordPrimingTask', 'computer': 'raylan' } dlg = gui.DlgFromDict(params, title='SameDiffTask', fixed=['dateStr']) if dlg.OK: toFile('lastParams.pickle', params) #save params to file for next time else: core.quit() #the user hit cancel so exit fileName = params['ID number'] + '_SDTArb4' dataFile = open('/home/zahrahussain/Documents/psychopy/data/wordSDT/' + fileName + '.txt', 'a') #a simple text file with 'comma-separated-values' #dataFile = open(fileName+'.txt', 'a') dataFile.write( 'word, cue, condition, distractorType, corresp, subjectResp, accuracy, RT\n' ) # Create a visual window:
## You can explicitly choose one of the qt/wx backends like this: ## from psychopy.gui import wxgui as gui ## from psychopy.gui import qtgui as gui # Specify fields for dlg as a dict info = { 'Observer': 'jwp', 'Condition': ['A', 'B'], 'Grating Orientation': 45, 'PsychoPy Version': __version__, 'Debug Mode': True } # Use this dict to create the dlg infoDlg = gui.DlgFromDict( dictionary=info, title='TestExperiment', order=['PsychoPy Version', 'Observer'], tip={'Observer': 'trained visual observer, initials'}, fixed=['PsychoPy Version']) # This attribute can't be changed by the user # Script will now wait for the dlg to close... if infoDlg.OK: # This will be True if user hit OK... print(info) else: # ...or False, if they hit Cancel print('User Cancelled') ## You could also use a gui.Dlg and you manually extract the data, this approach gives more ## control, eg, text color. # Create dlg dlg = gui.Dlg(title="My experiment", pos=(200, 400)) # Add each field manually
logging_info = param[ 'logging_info'] # information on files and variables for logging trigger_info = param[ 'trigger_info'] # information on all the MEG trigger values and names n_trials = param['n_trials'] # number trials per block n_blocks = param['n_blocks'] # number total blocks coherence_lvls = param['coherence_lvl'] # coherence levels rdk = stim_info['cloud_specs'] # info on RDK ########################################### ### HANDLE INPUT DIALOG #### ########################################### # dialog with participants: Retrieve Subject number, session number input_dict = dict(sub_id=0, ses_id=param['ses_id']) inputGUI = gui.DlgFromDict(input_dict, title='Experiment Info', order=['sub_id', 'ses_id'], show=False) while True: inputGUI.show() if inputGUI.OK == False: logging.warning("Experiment aborted by user") core.quit() if input_dict['ses_id'] in [ '{:02d}'.format(i) for i in range(1, param['n_ses'] + 1) ] + ['scr', 'prac', 'pilot', 'intake']: break else: logging.warning('WARNING: {} is not a valid ses_id'.format( input_dict['ses_id'])) ########################################### ### SET UP OVERHEAD ####
#Place where you want to save the results (set your path) depending on the computer orde='C:\\Users\\torkelslabb\\Desktop\\David\\fMRI_tasks\\' orde='/home/david/Desktop' os.chdir(orde) pos_channels=list(load('position_channels.npy')) #ordenador=os.getcwd() ordenador='C:\\Users\\torkelslabb\\Desktop\\behaviour\\' if __name__ == "__main__": info = {'Subject':'name'} infoDlg = gui.DlgFromDict(dictionary=info, title='Encoding mapping fMRI') if infoDlg.OK: subject_name=info['Subject'] if infoDlg.OK==False: core.quit() #user pressed cancel name=subject_name #### PRELIMINARY STUFF #Parameters Frames_sec_screen = 60 Hz_stim=4 radius= [14, 16, 18] delay=3
respKeys = ['z', 'm'] arrowNames = ['Left', 'Right'] arrowChars = ["\u2190","\u2192"] expName = 'Flanker Task' msg = '' instructions = "Focus on the fixation cross (+) sign in the middle of the screen at the start of each trial.\n\ \nWhen the fixation cross (+) disappears and the arrow appears, press the key that matches the arrow direction. \n\ \n Press on z if the arrow points to the left.\n\ \n Press on m if the arrow points to the right.\n\ \n Press the SPACEBAR to start the test." dateStr = time.strftime("%b_%d_%H%M", time.localtime()) fixedExpInfo = {'Subject ID': '','group': ''} fixedDlg = gui.DlgFromDict( dictionary=fixedExpInfo, title = expName, order = ['Subject ID', 'group'] ) if fixedDlg.OK: print('ok') else: core.quit() expInfo = {'age': '', 'gender': ''} dlg = gui.DlgFromDict( dictionary=expInfo, title = expName, order = ['age', 'gender']) if dlg.OK: #save params to file for next time #toFile('lastParams.pickle', expInfo) print('ok')
# debug things debug_testsubject = 1 debug_usedummytriggers = 1 debug_windowedmode = 1 debug_save_screenshots = 1 objectstimuli = sorted(glob('stimuli/*.png')) letterstimuli = 'ABCDEFGJKLQRTUVY' if debug_testsubject: subjectnr = 0 else: # Get subject info subject_info = {'Subject number': ''} if not gui.DlgFromDict(subject_info, title='Enter subject info:').OK: print('User hit cancel at subject information') exit() try: subjectnr = int(subject_info['Subject number']) except: raise nstimuli = 16 nsequence = 48 #number of sequences per condition (letter vs object 2back) nrepeats = 2 #repeats per sequence random.seed(subjectnr) refreshrate = 60 feedbackduration = .5 - .5 / refreshrate
# # # # # # ######################################################################################## # Draw a box to get experiment and participant information ######################################################################################## expName = u'zsb_task' # Name the experiment expInfo = { u'Session': u'001', u'Participant': u'001' } # What the box should ask for dlg = gui.DlgFromDict(dictionary=expInfo, title=expName) # Draw the bloody box! if dlg.OK == False: core.quit() # If "cancel" is clicked end the whole thing expInfo['date'] = data.getDateStr() # add a simple timestamp expInfo['expName'] = expName ######################################################################################## ######################################################################################## ######################################################################################## # Where To Write File ######################################################################################## # Setup files for saving if not os.path.isdir( 'ZSB_results'): # Create this folder wherever this script is saved os.makedirs( 'ZSB_results') # If this fails (e.g. permissions) we will get error filename = 'ZSB_Experiment_' + '%s_%s' % (expInfo['Participant'],
import string, time import random, copy, scipy, pygame import numpy from psychopy import sound params = { 'ID number': '1', 'frameRate': 60, 'duration': 0.3, 'ISI1': 0.2, 'ISI2': 0.5, 'fp': 0.5, 'task': 'wordComposite' } dlg = gui.DlgFromDict(params, title='wordComposite', fixed=['dateStr']) if dlg.OK: toFile('lastParams.pickle', params) #save params to file for next time else: core.quit() #the user hit cancel so exit fileName = params['ID number'] + '_s1' dataFile = open(fileName + '.txt', 'a') #a simple text file with 'comma-separated-values' dataFile.write('word, sameTop, congruent, response, accuracy, RT\n') # Create a visual window: win = visual.Window(fullscr=True, allowGUI=True, monitor='testMonitor', units='deg')
'adapt_side': ['left', 'right'], 'belief_side': ['left', 'right'], 'adaptation': ['long', 'short', 'none'], 'belief': ['upright', 'tilted'], 'stress_cond': 'speed', 'accuracy', 'task': ['gravity', 'ego'], 'estimation_method': ['adjustment'], # 'estimation_method': ['adjustment', 'staircase'], 'display': ['oculus', 'laptop'], 'Moog': ['yes', 'no'], 'n_adjust': 1} dlg = gui.DlgFromDict(dictionary=V, title=exp_name, order=['participant_number', 'participant_name', 'age', 'hand', 'gender', 'xpos', 'session', 'adaptation', 'belief_side', 'tilt_position', 'belief', 'task', 'reps', 'Moog', 'display', 'n_adjust', 'estimation_method']) if not dlg.OK: core.quit() V['date'] = data.getDateStr() V['exp_name'] = exp_name """ workaround for dropdown selection error: https://groups.google.com/forum/#!topic/psychopy-users/jV8JBSwIUWk """ from psychopy import visual
# 概念X(写真を使用) X_concept = "自己" X_words = ["eg.png", "eg2.png"] # 概念Y(写真を使用) Y_concept = "他者" Y_words = ["eg3.png", "eg4.png"] # 参加者情報 param_dict = { "subj_num": "", "gender": ["female", "male"], "age": "", "counter_balance": ["CB1", "CB2"] } dlg = gui.DlgFromDict(param_dict, title=".. + * * INFORMATION * * + ..") if dlg.OK == False: core.quit() # 画面情報・時間情報 win = visual.Window(fullscr=True, monitor="testMonitor", units="deg", color="gray") clock = core.Clock() # カーソルを消す event.Mouse(visible=False) # サウンド sound = sound.Sound("A", secs=0.5)
import serial import numpy as N import sys, os, pickle import datetime import exptutils from exptutils import * monSize = [800, 600] info = {} info['fullscr'] = False info['port'] = '/dev/tty.USA19H142P1.1' info['participant'] = 'test' info['run'] = '' info['color'] = '' dlg = gui.DlgFromDict(info) if not dlg.OK: core.quit() ####################################### subdata = {} #subdata['subcode']='test' subdata['completed'] = 0 subdata['cwd'] = os.getcwd() clock = core.Clock() datestamp = datetime.datetime.now().strftime("%Y-%m-%d-%H_%M_%S") subdata['datestamp'] = datestamp subdata['expt_title'] = 'tampico_probabilistic' subdata['response'] = {}
"""measure your JND in orientation using a staircase method""" from psychopy import core, visual, gui, data, misc, event, monitors import time, numpy try: #try to get a previous parameters file expInfo = misc.fromFile('lastParams.pickle') except: #if not there then use a default set expInfo = {'observer': 'jwp', 'refOrientation': 0} expInfo['dateStr'] = time.strftime("%b_%d_%H%M", time.localtime()) #add the current time #present a dialogue to change params dlg = gui.DlgFromDict(expInfo, title='simple JND Exp', fixed=['dateStr']) #if dlg.OK: #misc.toFile('lastParams.pickle', expInfo)#save params to file for next time #else: #core.quit()#the user hit cancel so exit #make a text file to save data fileName = expInfo['observer'] + expInfo['dateStr'] dataFile = open(fileName + '.csv', 'w') #a simple text file with 'comma-separated-values' dataFile.write('targetSide,oriIncrement,correct\n') #create the staircase handler staircase = data.StairHandler( startVal=20.0, stepType='db', stepSizes=[8, 4, 4, 2, 2, 1, 1], nUp=1, nDown=3, #will home in on the 80% threshold
task = 'Recog' expInfo = {u'session': u'01', u'Participant ID': u'9999999'} expInfo['date'] = data.getDateStr() # add a simple timestamp expInfo['expName'] = expName if len(sys.argv) > 1: #tempFile.write("Entered if clause\n") #tempFile.write('%s\n'%(sys.argv[2])) expInfo['Participant ID'] = sys.argv[1] #tempFile.write('%s\n'%(sys.argv[1])) #tempFile.write('%s\n'%(sys.argv[2])) PartDataFolder = sys.argv[2] Tag = '1' else: dlg = gui.DlgFromDict(dictionary=expInfo) if dlg.OK == False: core.quit() # user pressed cancel DataFolder = "../../data" PartDataFolder = 'unorganized' OutDir = os.path.join(DataFolder, PartDataFolder) if not os.path.exists(OutDir): os.mkdir(OutDir) Tag = '1' PartDataFolder = OutDir # Data file name stem = absolute path + name; later add .psyexp, .csv, .log, etc filename = os.path.join( PartDataFolder, '%s_%s_%s_%s_%s' % (expInfo['Participant ID'], expName, task, Tag, expInfo['date'])) #BGColor = 'grey'
def main(configurationDirectory): """ Creates an instance of the ExperimentRuntime class, gets the eye tracker the user wants to use for the demo, and launches the experiment logic. """ import os from psychopy import gui # The following code merges a iohub_config file called iohub_config.yaml.part, # that has all the iohub_config settings, other than those for the eye tracker. # the eye tracker configs are in the yaml files in the eyetracker_configs dir. # # This code lets a person select an eye tracker, and then merges the main iohub_config.yaml.part # with the contents of the eyetracker config yaml in eyetracker_configs # associated with the selected tracker. # # The merged result is saved as iohub_config.yaml so it can be picked up # by the Experiment _runtime # as normal. eye_tracker_config_files = { 'LC Technologies EyeGaze': 'eyetracker_configs/eyegaze_config.yaml', 'SMI iViewX': 'eyetracker_configs/iviewx_config.yaml', 'SR Research EyeLink': 'eyetracker_configs/eyelink_config.yaml', 'Tobii Technologies Eye Trackers': 'eyetracker_configs/tobii_config.yaml' } info = { 'Eye Tracker Type': [ 'Select', 'LC Technologies EyeGaze', 'SMI iViewX', 'SR Research EyeLink', 'Tobii Technologies Eye Trackers' ] } dlg_info = dict(info) infoDlg = gui.DlgFromDict(dictionary=dlg_info, title='Select Eye Tracker') if not infoDlg.OK: return -1 while dlg_info.values()[0] == u'Select' and infoDlg.OK: dlg_info = dict(info) infoDlg = gui.DlgFromDict( dictionary=dlg_info, title='SELECT Eye Tracker To Continue...') if not infoDlg.OK: return -1 base_config_file = os.path.normcase( os.path.join(configurationDirectory, 'iohub_config.yaml.part')) eyetrack_config_file = os.path.normcase( os.path.join(configurationDirectory, eye_tracker_config_files[dlg_info.values()[0]])) combined_config_file_name = os.path.normcase( os.path.join(configurationDirectory, 'iohub_config.yaml')) ExperimentRuntime.mergeConfigurationFiles(base_config_file, eyetrack_config_file, combined_config_file_name) runtime = ExperimentRuntime(configurationDirectory, "experiment_config.yaml") runtime.start((dlg_info.values()[0], ))
print('pixelperdegree=', pixelperdegree) # create a dialog from dictionary infoFirst = { 'Do staircase (only)': False, 'Check refresh etc': False, 'Fullscreen (timing errors if not)': False, 'Screen refresh rate': 60 } OK = gui.DlgFromDict( dictionary=infoFirst, title='Time Subjective Expansion', order=[ 'Do staircase (only)', 'Check refresh etc', 'Fullscreen (timing errors if not)' ], tip={ 'Check refresh etc': 'To confirm refresh rate and that can keep up, at least when drawing a grating' }, # fixed=['Check refresh etc'])#this attribute can't be changed by the user ) if not OK.OK: print('User cancelled from dialog box') core.quit() doStaircase = infoFirst['Do staircase (only)'] checkRefreshEtc = infoFirst['Check refresh etc'] fullscr = infoFirst['Fullscreen (timing errors if not)'] refreshRate = infoFirst['Screen refresh rate'] if checkRefreshEtc: quitFinder = True
'09. Number of trials per staircase': 40, '10. Practice ISOIs': '200', '11. Min ISOI (ms)': 3, '12. Max ISOI (ms)': 200, '13. Use GO button': True, '14. Provide feedback': False, '15. Folder for saving data': 'Data', '16. Device orientation (0 or 1)': 0, '17. Arduino serial port': '/dev/cu.usbmodem1411', '18. Print arduino messages': False } exptInfo['19. Date and time'] = data.getDateStr( format='%Y-%m-%d_%H-%M-%S') #add the current time dlg = gui.DlgFromDict(exptInfo, title='Experiment details', fixed=['19. Date and time']) if dlg.OK: toFile(parameterFile, exptInfo) # save params to file for next time else: core.quit() # the user hit cancel so exit stimToUse = [int(i) for i in exptInfo['03. Probes to use (1-4)'].split(',')] try: preISOI = [int(i) for i in exptInfo['10. Practice ISOIs'].split(',')] except: preISOI = [] ## ---- ## -- make folder/files to save data -- if exptInfo['09. Number of trials per staircase'] > 0: