コード例 #1
0
 def initializeExperiment(self):
     # Experiment Clocks
     self.expTimer = core.Clock()
     splash = visual.ImageStim(self.experiment.win,
                               image='splash.png',
                               mask=None,
                               interpolate=False)
     splash.draw()
     self.experiment.win.flip()
     generateTrials.main(self.experiment.subjVariables['subjCode'],
                         self.experiment.subjVariables["howMany"],
                         self.experiment.subjVariables['seed'])
     #core.wait(2)
     showText(self.experiment.win,
              "packaging soundfiles, please wait",
              color='black',
              waitForKey=False)
     """This loads all the stimili and initializes the trial sequence"""
     self.fixSpot = visual.TextStim(self.experiment.win,
                                    text="+",
                                    height=30,
                                    color="black")
     self.fixSpotReady = visual.TextStim(self.experiment.win,
                                         text="+",
                                         height=50,
                                         color="red")
     self.fixSpotPlay = visual.TextStim(self.experiment.win,
                                        text="+",
                                        height=30,
                                        color="blue")
     self.pictureMatrix = loadFiles('stimuli', 'png', 'image',
                                    self.experiment.win)
     self.soundMatrix = loadFiles('stimuli', 'wav', fileType="sound")
     self.arrowChars = {'right': u"\u2192", 'left': u"\u2190"}
     #u"\u2192"
     #self.arrowChars = {'left':"<", 'right':">"}
     (self.trialList, self.fieldNames) = importTrials(
         'trials/trialList_Flanker_' +
         self.experiment.subjVariables["subjCode"] + '.csv',
         method="sequential")
     (self.practTrialList, self.fieldNamesPract) = importTrials(
         'trials/trialListFlankerPract.csv', method="sequential")
     self.locations = {
         'top': [0, 275],
         'bottom': [0, -275],
         'left': [-275, 0],
         'right': [275, 0],
         'center': [0, 0]
     }
     if self.experiment.subjVariables['useParallel'] == 'yes':
         parallel.setData(0)
コード例 #2
0
	def initializeExperiment(self):
		# Experiment Clocks
		self.expTimer = core.Clock()
		splash = visual.ImageStim(self.experiment.win, image='splash.png',mask=None,interpolate=False)
		splash.draw()
		self.experiment.win.flip()
		generateTrials.main(self.experiment.subjVariables['subjCode'],self.experiment.subjVariables["howMany"],self.experiment.subjVariables['seed'])
		#core.wait(2)
		showText(self.experiment.win, "packaging soundfiles, please wait",color='black',waitForKey=False)
		"""This loads all the stimili and initializes the trial sequence"""
		self.fixSpot = visual.TextStim(self.experiment.win,text="+",height = 30,color="black")
		self.fixSpotReady = visual.TextStim(self.experiment.win,text="+",height = 50,color="red")
		self.fixSpotPlay = visual.TextStim(self.experiment.win,text="+",height = 30,color="blue")
		self.pictureMatrix = loadFiles('stimuli','png','image',self.experiment.win)
		self.soundMatrix = loadFiles('stimuli','wav',fileType="sound")
		#self.arrowChars = {'right':u"\u2192",'left':u"\u2190"}
		self.arrowChars = {'right':u"\u21E8",'left':u"\u21E6"}
		#u"\u2192"
		#self.arrowChars = {'left':"<", 'right':">"}
		(self.trialList,self.fieldNames) = importTrials('trials/trialList_Flanker_'+self.experiment.subjVariables["subjCode"]+'.csv',method="sequential")
		(self.practTrialList,self.fieldNamesPract) = importTrials('trials/trialListFlankerPract.csv',method="sequential")
		self.locations = {'top':[0,275], 'bottom':[0,-275], 'left':[-275,0], 'right':[275,0], 'center':[0,0]}
		if self.experiment.subjVariables['useParallel']=='yes':
			parallel.setData(0)
コード例 #3
0
	def __init__(self):

		#this is where the subject variables go.  'any' means any value is allowed as long as it's the correct type (str, int, etc.) the numbers 1 and 2 control the order in which the prompts are displayed (dicts have no natural order)

		self.expName = 'oddballSoundFile'
		self.optionList = {	'1':  {	'name' : 'screenMode',
									'prompt' : 'debug or fs',
									'options': ('debug','fs'),
									'default':'fs',
									'type' : str},
							'2' : { 'name' : 'seed',
									'prompt' : 'random Number',
									'options' : 'any',
									'default' : 10,
									'type' : int},
							'3' : { 'name' : 'numTrials',
									'prompt' : 'number of trials',
									'options' : 'any',
									'default' : 50,
									'type' : int},
							'4' : { 'name' : 'subjCode',
									'prompt' : 'subject Code',
									'options' : 'any',
									'default' : 's1',
									'type' : str},
							'5' : { 'name' : 'breakEvery',
									'prompt' : 'Trials per block?',
									'options' : 'any',
									'default' : 15,
									'type' : int}
								}
		optionsReceived=False
		fileOpened=False

		while not optionsReceived or not fileOpened:
			[optionsReceived,self.subjVariables] = enterSubjInfo(self.expName,self.optionList)
			if not optionsReceived:
				popupError(self.subjVariables)
			#try:
			if os.path.isfile('data/'+self.subjVariables['subjCode']+'_eventTracker.txt'):
				print 'Error: That subject code already exists'
				fileOpened=False
			else:
				self.eventTracker = open('data/'+self.subjVariables['subjCode']+'_eventTracker.txt','w')

				fileOpened=True
			#except:
				#pass

		self.inputDevice = "keyboard"

		if self.subjVariables['screenMode']=='fs':
			self.win = visual.Window(fullscr=True, color='gray', allowGUI=False, monitor='testMonitor',units='pix')
		else:
			self.win = visual.Window([800,800], color='gray', allowGUI=False, monitor='testMonitor',units='pix')

		self.presRate = .096

		self.instructions = "In this task, you will hear a series of 'beeps'.\nYour task is to try and catch the 'high' pitched beeps as fast as you can by pressing the SPACE bar.\n\nIt's that simple!\n\nWhen you are ready press any key to Start."
		self.finalText = "This is the end of experiment :) Thank you for your participation!"
		self.takeBreakEveryXTrials=self.subjVariables['breakEvery']
		self.takeBreak = "Please take a short break.  Press one of the response keys to continue"

		generateTrials.main(self.subjVariables['subjCode'],self.subjVariables['seed'],self.subjVariables['numTrials'])
コード例 #4
0
ファイル: accPred.py プロジェクト: bastienboutonnet/AccPred
	def __init__(self):

		self.expName = 'accPred'
		self.optionList = {	'1':  {	'name' : 'screenMode',
									'prompt' : 'debug or fs',
									'options': ('debug','fs'),
									'default':'fs',
									'type' : str},
							'2' : { 'name' : 'seed',
									'prompt' : 'random Number',
									'options' : 'any',
									'default' : 10,
									'type' : int},
							'3' : { 'name' : 'subjCode',
									'prompt' : 'subject Code',
									'options' : 'any',
									'default' : 's1',
									'type' : str},
							'4' : { 'name' : 'breakEvery',
									'prompt' : 'Trials per block?',
									'options' : 'any',
									'default' : 15,
									'type' : int},
							'5' : { 'name' : 'useParallel',
									'prompt' : 'paralel port use',
									'options' : 'any',
									'default' : 'no',
									'type' : str},
								}
		optionsReceived=False
		fileOpened=False

		##Wait & Listen for User info and set up datafiles
		while not optionsReceived or not fileOpened:
			[optionsReceived,self.subjVariables] = enterSubjInfo(self.expName,self.optionList)
			if not optionsReceived:
				popupError(self.subjVariables)
			#try:
			if os.path.isfile('data/'+self.expName+'_'+self.subjVariables['subjCode']+'_eventTracker.txt'):
				print 'Error: That subject code already exists'
				fileOpened=False
			else:
				self.eventTracker = open('data/'+self.expName+'_'+self.subjVariables['subjCode']+'_eventTracker.txt','w')
				self.practFile = open('data/practTrials'+self.expName+'_'+self.subjVariables['subjCode']+'.txt','w')
				self.testFile = open('data/'+self.expName+'_'+self.subjVariables['subjCode']+'.txt','w')

				fileOpened=True
			#except:
				#pass
		self.inputDevice = "keyboard"
		self.validResponses = {'z':0,'slash':1}

		if self.subjVariables['screenMode']=='fs':
			self.win = visual.Window(fullscr=True, color='gray', allowGUI=False, monitor='testMonitor',units='pix',screen=1)
		else:
			self.win = visual.Window([800,800], color='gray', allowGUI=False, monitor='testMonitor',units='pix',screen=1)

		self.presRate = .096 ########### Might be un-necessary for this particular procedure.

		self.instructions = "In this task, you will hear a series of 'beeps'.\nYour task is to try and catch the 'high' pitched beeps as fast as you can by pressing the SPACE bar.\n\nIt's that simple!\n\nWhen you are ready press any key to Start."
		self.practiceTrials = "The next part is practice.\n\nPress the space-bar to start."
		self.realTrials = "Now for the real trials.\n\nReady?\n\nPress the space-bar to continue."
		self.finalText = "This is the end of experiment :) Thank you for your participation!"
		self.takeBreakEveryXTrials=self.subjVariables['breakEvery']
		self.takeBreak = "Please take a short break.  Press one of the response keys to continue"
		self.afterSentenceDelay=3
		self.afterQuestionDelay=3
		self.responseInfoReminder = "z = No    / = Yes"

		generateTrials.main(self.subjVariables['subjCode'],self.expName,self.subjVariables['seed'])
コード例 #5
0
	def __init__(self):

		self.expName = 'lexRecall'
		self.optionList = {	'1':  {	'name' : 'screenMode',
									'prompt' : 'debug or fs',
									'options': ('debug','fs'),
									'default':'fs',
									'type' : str},
							'2' : { 'name' : 'seed',
									'prompt' : 'random Number',
									'options' : 'any',
									'default' : 10,
									'type' : int},
							'3' : { 'name' : 'subjCode',
									'prompt' : 'subject Code',
									'options' : 'any',
									'default' : 's1',
									'type' : str},
							'4' : { 'name' : 'breakEvery',
									'prompt' : 'Trials per block?',
									'options' : 'any',
									'default' : 15,
									'type' : int},
							'5' : { 'name' : 'useParallel',
									'prompt' : 'paralel port use',
									'options' : 'any',
									'default' : 'no',
									'type' : str},
								}
		optionsReceived=False
		fileOpened=False

		##Wait & Listen for User info and set up datafiles
		while not optionsReceived or not fileOpened:
			[optionsReceived,self.subjVariables] = enterSubjInfo(self.expName,self.optionList)
			if not optionsReceived:
				popupError(self.subjVariables)
			#try:
			if os.path.isfile('data/'+self.expName+'_'+self.subjVariables['subjCode']+'.txt'):
				print 'Error: That subject code already exists'
				fileOpened=False
			else:
				#self.eventTracker = open('data/'+self.subjVariables['subjCode']+'_eventTracker.txt','w')
				#self.practFile = open('data/practTrials'+self.expName+self.subjVariables['subjCode']+'.txt','w')
				self.testFile = open('data/'+self.expName+'_'+self.subjVariables['subjCode']+'.txt','w')

				fileOpened=True
			#except:
				#pass
		self.inputDevice = "keyboard"
		self.validResponses = {'z':0,'slash':1}

		if self.subjVariables['screenMode']=='fs':
			self.win = visual.Window(fullscr=True, color='gray', allowGUI=False, monitor='testMonitor',units='pix',screen=1)
		else:
			self.win = visual.Window([800,800], color='gray', allowGUI=False, monitor='testMonitor',units='pix',screen=1)

		self.presRate = .096 ########### Might be un-necessary for this particular procedure.

		self.instructions = "Tijdens deze taak zul je een aantal woorden te zien krijgen op het scherm. Je taak is om ons te vertellen of je je kunt herinneren dat je ze gehoord hebt tijdens het vorige deel van het experiment, of niet.\n\nProbeer zo snel maar ook nauwkeurig mogelijk te antwoorden.\n\nDe z-toets is Nee, en de /-toets is Ja."
		#self.practiceTrials = "The next part is practice.\n\nPress the space-bar to start."
		#self.realTrials = "Now for the real trials.\n\nReady?\n\nPress the space-bar to continue."
		self.finalText = "Je bent klaar met deze taak! Wacht nu even op de experimentbegeleider."
		self.takeBreakEveryXTrials=self.subjVariables['breakEvery']
		self.takeBreak = "Het is nu tijd voor een korte pauze. De experimentbegeleider zal even langskomen om te checken of alles goed gaat, dus wacht alsjeblieft even voordat je verdergaat."
		self.afterSentenceDelay=3
		self.afterQuestionDelay=3
		self.responseInfoReminder = "z = No    / = Yes"

		generateTrials.main(self.subjVariables['subjCode'],self.expName,self.subjVariables['seed'])
		if self.subjVariables['useParallel']=='yes':
			parallel.setPortAddress(address=0xD010)
コード例 #6
0
    def __init__(self):

        self.expName = 'lexRecall'
        self.optionList = {
            '1': {
                'name': 'screenMode',
                'prompt': 'debug or fs',
                'options': ('debug', 'fs'),
                'default': 'fs',
                'type': str
            },
            '2': {
                'name': 'seed',
                'prompt': 'random Number',
                'options': 'any',
                'default': 10,
                'type': int
            },
            '3': {
                'name': 'subjCode',
                'prompt': 'subject Code',
                'options': 'any',
                'default': 's1',
                'type': str
            },
            '4': {
                'name': 'breakEvery',
                'prompt': 'Trials per block?',
                'options': 'any',
                'default': 15,
                'type': int
            },
            '5': {
                'name': 'useParallel',
                'prompt': 'paralel port use',
                'options': 'any',
                'default': 'no',
                'type': str
            },
        }
        optionsReceived = False
        fileOpened = False

        ##Wait & Listen for User info and set up datafiles
        while not optionsReceived or not fileOpened:
            [optionsReceived,
             self.subjVariables] = enterSubjInfo(self.expName, self.optionList)
            if not optionsReceived:
                popupError(self.subjVariables)
            #try:
            if os.path.isfile('data/' + self.expName + '_' +
                              self.subjVariables['subjCode'] + '.txt'):
                print 'Error: That subject code already exists'
                fileOpened = False
            else:
                #self.eventTracker = open('data/'+self.subjVariables['subjCode']+'_eventTracker.txt','w')
                #self.practFile = open('data/practTrials'+self.expName+self.subjVariables['subjCode']+'.txt','w')
                self.testFile = open(
                    'data/' + self.expName + '_' +
                    self.subjVariables['subjCode'] + '.txt', 'w')

                fileOpened = True
            #except:
            #pass
        self.inputDevice = "keyboard"
        self.validResponses = {'z': 0, 'slash': 1}

        if self.subjVariables['screenMode'] == 'fs':
            self.win = visual.Window(fullscr=True,
                                     color='gray',
                                     allowGUI=False,
                                     monitor='testMonitor',
                                     units='pix',
                                     screen=1)
        else:
            self.win = visual.Window([800, 800],
                                     color='gray',
                                     allowGUI=False,
                                     monitor='testMonitor',
                                     units='pix',
                                     screen=1)

        self.presRate = .096  ########### Might be un-necessary for this particular procedure.

        self.instructions = "In this task, you see a series of words.\nYour task is to indicate as quickly as possible whether you remember hearing that word in the previous task.\n\nIt's that simple!\n\nWhen you are ready press any key to Start."
        #self.practiceTrials = "The next part is practice.\n\nPress the space-bar to start."
        #self.realTrials = "Now for the real trials.\n\nReady?\n\nPress the space-bar to continue."
        self.finalText = "This is the end of experiment :) Thank you for your participation!"
        self.takeBreakEveryXTrials = self.subjVariables['breakEvery']
        self.takeBreak = "Please take a short break.  Press one of the response keys to continue"
        self.afterSentenceDelay = 3
        self.afterQuestionDelay = 3
        self.responseInfoReminder = "z = Nee    / = Ja"

        generateTrials.main(self.subjVariables['subjCode'], self.expName,
                            self.subjVariables['seed'])
        if self.subjVariables['useParallel'] == 'yes':
            parallel.setPortAddress(address=0xD010)
コード例 #7
0
    def __init__(self):

        self.expName = 'lexRecall'
        self.optionList = {
            '1': {
                'name': 'screenMode',
                'prompt': 'debug or fs',
                'options': ('debug', 'fs'),
                'default': 'fs',
                'type': str
            },
            '2': {
                'name': 'seed',
                'prompt': 'random Number',
                'options': 'any',
                'default': 10,
                'type': int
            },
            '3': {
                'name': 'subjCode',
                'prompt': 'subject Code',
                'options': 'any',
                'default': 's1',
                'type': str
            },
            '4': {
                'name': 'breakEvery',
                'prompt': 'Trials per block?',
                'options': 'any',
                'default': 15,
                'type': int
            },
            '5': {
                'name': 'useParallel',
                'prompt': 'paralel port use',
                'options': 'any',
                'default': 'no',
                'type': str
            },
        }
        optionsReceived = False
        fileOpened = False

        ##Wait & Listen for User info and set up datafiles
        while not optionsReceived or not fileOpened:
            [optionsReceived,
             self.subjVariables] = enterSubjInfo(self.expName, self.optionList)
            if not optionsReceived:
                popupError(self.subjVariables)
            #try:
            if os.path.isfile('data/' + self.expName + '_' +
                              self.subjVariables['subjCode'] + '.txt'):
                print 'Error: That subject code already exists'
                fileOpened = False
            else:
                #self.eventTracker = open('data/'+self.subjVariables['subjCode']+'_eventTracker.txt','w')
                #self.practFile = open('data/practTrials'+self.expName+self.subjVariables['subjCode']+'.txt','w')
                self.testFile = open(
                    'data/' + self.expName + '_' +
                    self.subjVariables['subjCode'] + '.txt', 'w')

                fileOpened = True
            #except:
            #pass
        self.inputDevice = "keyboard"
        self.validResponses = {'z': 0, 'slash': 1}

        if self.subjVariables['screenMode'] == 'fs':
            self.win = visual.Window(fullscr=True,
                                     color='gray',
                                     allowGUI=False,
                                     monitor='testMonitor',
                                     units='pix',
                                     screen=1)
        else:
            self.win = visual.Window([800, 800],
                                     color='gray',
                                     allowGUI=False,
                                     monitor='testMonitor',
                                     units='pix',
                                     screen=1)

        self.presRate = .096  ########### Might be un-necessary for this particular procedure.

        self.instructions = "Tijdens deze taak zul je een aantal woorden te zien krijgen op het scherm. Je taak is om ons te vertellen of je je kunt herinneren dat je ze gehoord hebt tijdens het vorige deel van het experiment, of niet.\n\nProbeer zo snel maar ook nauwkeurig mogelijk te antwoorden.\n\nDe z-toets is Nee, en de /-toets is Ja."
        #self.practiceTrials = "The next part is practice.\n\nPress the space-bar to start."
        #self.realTrials = "Now for the real trials.\n\nReady?\n\nPress the space-bar to continue."
        self.finalText = "Je bent klaar met deze taak! Wacht nu even op de experimentbegeleider."
        self.takeBreakEveryXTrials = self.subjVariables['breakEvery']
        self.takeBreak = "Het is nu tijd voor een korte pauze. De experimentbegeleider zal even langskomen om te checken of alles goed gaat, dus wacht alsjeblieft even voordat je verdergaat."
        self.afterSentenceDelay = 3
        self.afterQuestionDelay = 3
        self.responseInfoReminder = "z = No    / = Yes"

        generateTrials.main(self.subjVariables['subjCode'], self.expName,
                            self.subjVariables['seed'])
        if self.subjVariables['useParallel'] == 'yes':
            parallel.setPortAddress(address=0xD010)
コード例 #8
0
    def __init__(self):

        #this is where the subject variables go.  'any' means any value is allowed as long as it's the correct type (str, int, etc.) the numbers 1 and 2 control the order in which the prompts are displayed (dicts have no natural order)
        self.optionList = {    '1':  {    'name' : 'subjCode',
                                    'prompt' : 'Subject Code: ',
                                    'options': 'any',
                                    'default':'MRS101',
                                    'type' : str},
                            '2' : {    'name' : 'gender',
                                    'prompt' : 'Subject Gender m/f: ',
                                    'options' : ("m","f"),
                                    'default':'',
                                    'type' : str},
                            '3' : {    'name' : 'responseDevice',
                                    'prompt' : 'Response device: keyboard/gamepad: ',
                                    'options' : ("keyboard","gamepad"),
                                    'default':'gamepad',
                                    'type' : str},
                            '4' : {    'name' : 'seed',
                                    'prompt' : 'Enter seed: ',
                                    'options' : 'any',
                                    'default':100,
                                    'type' : int},
                            '5' : {    'name' : 'expInitials',
                                    'prompt' : 'Experiment Initials: ',
                                    'options' : 'any',
                                    'default' : '',
                                    'type' : str}
                                }

        optionsReceived=False
        fileOpened=False
        while not optionsReceived or not fileOpened:
            [optionsReceived,self.subjVariables] = enterSubjInfo('rsvp',self.optionList)
            if not optionsReceived:
                popupError(self.subjVariables)
            try:
                if  os.path.isfile(self.subjVariables['subjCode']+'_test.txt'):
                    fileOpened=False
                    popupError('Error: That subject code already exists')
                else:
                    self.outputFileTest = file('test_'+self.subjVariables['subjCode']+'.txt','w')
                    fileOpened=True
            except:
                pass
        generateTrials.main(self.subjVariables['subjCode'],self.subjVariables['seed'])

        if self.subjVariables['responseDevice']=='gamepad':
            try:
                self.stick=initGamepad()
                pygame.init()
                self.inputDevice = "gamepad"
                self.responseInfo = " Press the GREEN key for 'Yes' and the RED' button for 'No'."
                self.validResponses = {'1':0,'0':3}
                assert False, 'Left right responses not implemented for gamepad. Try keyboard'
                self.leftRightResponses = dict()
                self.leftRightResponseInfo = ""
            except SystemExit:
                self.subjVariables['responseDevice']='keyboard'

        if self.subjVariables['responseDevice']=='keyboard':
            print "Using keyboard"
            self.inputDevice = "keyboard"
            self.validResponses = {'1':'up','0':'down'} #change n/o to whatever keys you want to use
            self.leftRightResponses = {'left': 'left', 'right': 'right'}
            self.responseInfo = "Press the up arrow if you saw the target and the down arrow if you didn't see the target."
            self.leftRightResponseInfo = "Press the left arrow if you saw the left image or the right arrow if you saw the right image."

        self.win = visual.Window(fullscr=True, color=[.3,.3,.3], allowGUI=False, monitor='testMonitor',units='pix',winType='pyglet')

        self.takeBreakEveryXTrials = 32  # number of trials in a block
        self.finalText = "You've come to the end of the experiment. Thank you for participating."
        self.instructions = \
        ("Welcome to the MRS study!\n\n"
        "In this experiment you will see a sequence of pictures that "
        "will flash very quickly on the screen. Your job is to look for "
        "a particular picture within each sequence. "
        "For example, you might see a sequence of pictures and then "
        "have to decide, yes or no, did you see a picture of a dog anywhere in "
        "the sequence.\n\n"
        "Sometimes you will know what to look for before you see the "
        "pictures. Other times you will be asked if you saw a particular "
        "picture after you see the pictures.\n\n"
        "Afterwards we will ask you a question about the target you were looking for. For example, "
        "you might see two pictures of dogs and have to pick "
        "which dog picture you saw. Other times you will "
        "be asked to type in the name of the picture you were looking for.\n\n"
        "Please let the experimenter know when you have completed reading "
        "these instructions.\n\n")

        self.instructions += self.responseInfo

        self.takeBreak = "Please take a short break. Press 'Enter' when you are ready to continue"
        self.practiceTrials = "The next part is practice"
        self.realTrials = "Now for the real trials"
コード例 #9
0
ファイル: 1.accPred.py プロジェクト: bastienboutonnet/AccPred
	def __init__(self):

		self.expName = 'accPred'
		self.optionList = {	'1':  {	'name' : 'screenMode',
									'prompt' : 'debug or fs',
									'options': ('debug','fs'),
									'default':'fs',
									'type' : str},
							'2' : { 'name' : 'seed',
									'prompt' : 'random Number',
									'options' : 'any',
									'default' : 10,
									'type' : int},
							'3' : { 'name' : 'subjCode',
									'prompt' : 'subject Code',
									'options' : 'any',
									'default' : 's1',
									'type' : str},
							'4' : { 'name' : 'breakEvery',
									'prompt' : 'Trials per block?',
									'options' : 'any',
									'default' : 15,
									'type' : int},
							'5' : { 'name' : 'useParallel',
									'prompt' : 'paralel port use',
									'options' : 'any',
									'default' : 'no',
									'type' : str},
								}
		optionsReceived=False
		fileOpened=False

		##Wait & Listen for User info and set up datafiles
		while not optionsReceived or not fileOpened:
			[optionsReceived,self.subjVariables] = enterSubjInfo(self.expName,self.optionList)
			if not optionsReceived:
				popupError(self.subjVariables)
			#try:
			if os.path.isfile('data/'+self.expName+'_'+self.subjVariables['subjCode']+'_eventTracker.txt'):
				print 'Error: That subject code already exists'
				fileOpened=False
			else:
				self.eventTracker = open('data/'+self.expName+'_'+self.subjVariables['subjCode']+'_eventTracker.txt','w')
				self.practFile = open('data/practTrials'+self.expName+'_'+self.subjVariables['subjCode']+'.txt','w')
				self.testFile = open('data/'+self.expName+'_'+self.subjVariables['subjCode']+'.txt','w')

				fileOpened=True
			#except:
				#pass
		self.inputDevice = "keyboard"
		self.validResponses = {'z':0,'slash':1}

		if self.subjVariables['screenMode']=='fs':
			self.win = visual.Window(fullscr=True, color='gray', allowGUI=False, monitor='testMonitor',units='pix',screen=1)
		else:
			self.win = visual.Window([800,800], color='gray', allowGUI=False, monitor='testMonitor',units='pix',screen=1)

		self.presRate = .096 ########### Might be un-necessary for this particular procedure.

		self.instructions = 'Tijdens deze taak zul je een aantal zinnen horen die zijn opgenomen van een telefoongesprek of de radio. Jouw taak is om goed te luisteren naar elke zin, want na sommige zinnen zul je een vraag over die zin moeten beantwoorden!\n\nUit alle zinnen missen steeds woorden, dus let goed op.\n\nBeantwoord de vraag zo snel maar ook nauwkeurig mogelijk.\n\nMet de z-toets kun je Nee antwoorden, en de  /-toets is voor Ja.\n\nDruk op de spatiebalk om door te gaan als je deze instructies goed hebt begrepen.'
		self.practiceTrials = "Er volgt nu een oefendeel. Ben je er klaar voor?\n\nDruk dan op de spatiebalk om verder te gaan."
		self.realTrials = "Nu volgt het echte onderzoek. Klaar?\n\nDruk dan op de spatiebalk om verder te gaan.\n\nOnthoud: de z-toets is Nee en de  /-toets is Ja."
		self.finalText = "Je bent klaar met deze taak! Wacht nu even op de experimentbegeleider."
		self.takeBreakEveryXTrials=self.subjVariables['breakEvery']
		self.takeBreak = "Het is nu tijd voor een korte pauze. De experimentbegeleider zal even langskomen om te checken of alles goed gaat, dus wacht alsjeblieft even voordat je verdergaat."
		self.afterSentenceDelay=3
		self.afterQuestionDelay=3
		self.responseInfoReminder = "z = Nee    / = Ja"

		generateTrials.main(self.subjVariables['subjCode'],self.expName,self.subjVariables['seed'])
コード例 #10
0
    def __init__(self):

        #this is where the subject variables go.  'any' means any value is allowed as long as it's the correct type (str, int, etc.) the numbers 1 and 2 control the order in which the prompts are displayed (dicts have no natural order)

        self.expName = 'oddballSoundFile'
        self.optionList = {
            '1': {
                'name': 'screenMode',
                'prompt': 'debug or fs',
                'options': ('debug', 'fs'),
                'default': 'fs',
                'type': str
            },
            '2': {
                'name': 'seed',
                'prompt': 'random Number',
                'options': 'any',
                'default': 10,
                'type': int
            },
            '3': {
                'name': 'numTrials',
                'prompt': 'number of trials',
                'options': 'any',
                'default': 50,
                'type': int
            },
            '4': {
                'name': 'subjCode',
                'prompt': 'subject Code',
                'options': 'any',
                'default': 's1',
                'type': str
            },
            '5': {
                'name': 'breakEvery',
                'prompt': 'Trials per block?',
                'options': 'any',
                'default': 15,
                'type': int
            }
        }
        optionsReceived = False
        fileOpened = False

        while not optionsReceived or not fileOpened:
            [optionsReceived,
             self.subjVariables] = enterSubjInfo(self.expName, self.optionList)
            if not optionsReceived:
                popupError(self.subjVariables)
            #try:
            if os.path.isfile('data/' + self.subjVariables['subjCode'] +
                              '_eventTracker.txt'):
                print 'Error: That subject code already exists'
                fileOpened = False
            else:
                self.eventTracker = open(
                    'data/' + self.subjVariables['subjCode'] +
                    '_eventTracker.txt', 'w')

                fileOpened = True
            #except:
            #pass

        self.inputDevice = "keyboard"

        if self.subjVariables['screenMode'] == 'fs':
            self.win = visual.Window(fullscr=True,
                                     color='gray',
                                     allowGUI=False,
                                     monitor='testMonitor',
                                     units='pix')
        else:
            self.win = visual.Window([800, 800],
                                     color='gray',
                                     allowGUI=False,
                                     monitor='testMonitor',
                                     units='pix')

        self.presRate = .096

        self.instructions = "In this task, you will hear a series of 'beeps'.\nYour task is to try and catch the 'high' pitched beeps as fast as you can by pressing the SPACE bar.\n\nIt's that simple!\n\nWhen you are ready press any key to Start."
        self.finalText = "This is the end of experiment :) Thank you for your participation!"
        self.takeBreakEveryXTrials = self.subjVariables['breakEvery']
        self.takeBreak = "Please take a short break.  Press one of the response keys to continue"

        generateTrials.main(self.subjVariables['subjCode'],
                            self.subjVariables['seed'],
                            self.subjVariables['numTrials'])