Commit 4e99d0ab authored by mohammadHossein's avatar mohammadHossein

variable initialized at beggining routine.

parent 710380bd
This diff is collapsed.
This diff is collapsed.
......@@ -170,7 +170,7 @@
<Param name="durationEstim" updates="None" val="" valType="code"/>
<Param name="flipHoriz" updates="constant" val="False" valType="bool"/>
<Param name="flipVert" updates="constant" val="False" valType="bool"/>
<Param name="image" updates="set every repeat" val="training_image_mask" valType="file"/>
<Param name="image" updates="set every repeat" val="$training_image_mask" valType="file"/>
<Param name="interpolate" updates="constant" val="linear" valType="str"/>
<Param name="mask" updates="constant" val="" valType="str"/>
<Param name="name" updates="None" val="image" valType="code"/>
......@@ -1667,8 +1667,28 @@
<Param name="name" updates="None" val="code_7" valType="code"/>
</CodeComponent>
</Routine>
<Routine name="code_JS">
<CodeComponent name="code_js">
<Param name="Before Experiment" updates="constant" val="" valType="extendedCode"/>
<Param name="Before JS Experiment" updates="constant" val="" valType="extendedCode"/>
<Param name="Begin Experiment" updates="constant" val="" valType="extendedCode"/>
<Param name="Begin JS Experiment" updates="constant" val="win=psychoJS.window;&amp;#10;event=psychoJS.eventManager;&amp;#10;thisExp=psychoJS.experiment;&amp;#10;&amp;#10;shuffle = function (a) {&amp;#10; return util.shuffle(a);&amp;#10;}&amp;#10;random = function (a) {&amp;#10; return Math.random();&amp;#10;}&amp;#10;//defining functions for js&amp;#10;&amp;#10;training_list = []&amp;#10;classes_labels = []&amp;#10;masked_images_dir = ''&amp;#10;unmasked_images_dir = ''&amp;#10;range_dict = {}&amp;#10;range_list_str = []&amp;#10;range_list_int = []&amp;#10;flag = False&amp;#10;selected_class = ''&amp;#10;the_range = []&amp;#10;middle_range = ''&amp;#10;trial_number = 0&amp;#10;training_image_mask = ''&amp;#10;unmask_image = ''&amp;#10;the_text = ''&amp;#10;images_dict = {}&amp;#10;catch_trial_list = []&amp;#10;catch_trial_1 = 0&amp;#10;trial_loop_counter = 0&amp;#10;answer = ''&amp;#10;threshold = 0&amp;#10;num_of_catch_trial = 0&amp;#10;num_of_loops_for_block = 0&amp;#10;precision = None&amp;#10;flag_catch_trial = False&amp;#10;range_selected_class = ''&amp;#10;now_index = 0&amp;#10;range_selected_class = []&amp;#10;test_image_mask = ''&amp;#10;acc = 0&amp;#10;&amp;#10;//have to define these variables for js" valType="extendedCode"/>
<Param name="Begin JS Routine" updates="constant" val="" valType="extendedCode"/>
<Param name="Begin Routine" updates="constant" val="" valType="extendedCode"/>
<Param name="Code Type" updates="None" val="Both" valType="str"/>
<Param name="Each Frame" updates="constant" val="" valType="extendedCode"/>
<Param name="Each JS Frame" updates="constant" val="" valType="extendedCode"/>
<Param name="End Experiment" updates="constant" val="" valType="extendedCode"/>
<Param name="End JS Experiment" updates="constant" val="" valType="extendedCode"/>
<Param name="End JS Routine" updates="constant" val="" valType="extendedCode"/>
<Param name="End Routine" updates="constant" val="" valType="extendedCode"/>
<Param name="disabled" updates="None" val="False" valType="bool"/>
<Param name="name" updates="None" val="code_js" valType="code"/>
</CodeComponent>
</Routine>
</Routines>
<Flow>
<Routine name="code_JS"/>
<Routine name="Ack"/>
<Routine name="Training_Intro"/>
<LoopInitiator loopType="TrialHandler" name="training_loop">
......
......@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
"""
This experiment was created using PsychoPy3 Experiment Builder (v2021.2.0),
on August 01, 2021, at 02:08
on September 10, 2021, at 01:08
If you publish work using this script the most relevant publication is:
Peirce J, Gray JR, Simpson S, MacAskill M, Höchenberger R, Sogo H, Kastman E, Lindeløv JK. (2019)
......@@ -101,6 +101,9 @@ ioDevice = ioConfig = ioSession = ioServer = eyetracker = None
# create a default keyboard (e.g. to check for escape)
defaultKeyboard = keyboard.Keyboard()
# Initialize components for Routine "code_JS"
code_JSClock = core.Clock()
# Initialize components for Routine "Ack"
AckClock = core.Clock()
Acknowledgement = visual.TextStim(win=win, name='Acknowledgement',
......@@ -615,6 +618,57 @@ key_resp_3 = keyboard.Keyboard()
globalClock = core.Clock() # to track the time since experiment started
routineTimer = core.CountdownTimer() # to track time remaining of each (non-slip) routine
# ------Prepare to start Routine "code_JS"-------
continueRoutine = True
# update component parameters for each repeat
# keep track of which components have finished
code_JSComponents = []
for thisComponent in code_JSComponents:
thisComponent.tStart = None
thisComponent.tStop = None
thisComponent.tStartRefresh = None
thisComponent.tStopRefresh = None
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
# reset timers
t = 0
_timeToFirstFrame = win.getFutureFlipTime(clock="now")
code_JSClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip
frameN = -1
# -------Run Routine "code_JS"-------
while continueRoutine:
# get current time
t = code_JSClock.getTime()
tThisFlip = win.getFutureFlipTime(clock=code_JSClock)
tThisFlipGlobal = win.getFutureFlipTime(clock=None)
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# check for quit (typically the Esc key)
if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]):
core.quit()
# check if all components have finished
if not continueRoutine: # a component has requested a forced-end of Routine
break
continueRoutine = False # will revert to True if at least one component still running
for thisComponent in code_JSComponents:
if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
continueRoutine = True
break # at least one component has not yet finished
# refresh the screen
if continueRoutine: # don't flip if this routine is over or we'll get a blank screen
win.flip()
# -------Ending Routine "code_JS"-------
for thisComponent in code_JSComponents:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)
# the Routine "code_JS" was not non-slip safe, so reset the non-slip timer
routineTimer.reset()
# ------Prepare to start Routine "Ack"-------
continueRoutine = True
# update component parameters for each repeat
......@@ -826,7 +880,7 @@ for thisTraining_loop in training_loop:
trial_number = random.randint(1,100)
training_image_mask = masked_images_dir + selected_class + '/' + str(middle_range) + '/' + str(trial_number) + '.jpg'
image.setImage('training_image_mask')
image.setImage(training_image_mask)
key_resp_2.keys = []
key_resp_2.rt = []
_key_resp_2_allKeys = []
......
training_loop.thisRepN,training_loop.thisTrialN,training_loop.thisN,training_loop.thisIndex,session,participant,date,expName,psychopyVersion,frameRate,
This diff is collapsed.
training_loop.thisRepN,training_loop.thisTrialN,training_loop.thisN,training_loop.thisIndex,loop_over_blocks.thisRepN,loop_over_blocks.thisTrialN,loop_over_blocks.thisN,loop_over_blocks.thisIndex,loop_over_trials.thisRepN,loop_over_trials.thisTrialN,loop_over_trials.thisN,loop_over_trials.thisIndex,answer,class,range,trail_number,catch_trial,session,participant,date,expName,psychopyVersion,frameRate,
,,,,0,0,0,0,0,0,0,0,idk,iron,7000,48,False,001,001,2021_Sep_09_2114,Object_Segments_CNN,2021.2.0,60.091170290244754,
,,,,0,0,0,0,1,0,1,0,iron,hat,76000,66,False,001,001,2021_Sep_09_2114,Object_Segments_CNN,2021.2.0,60.091170290244754,
,,,,0,0,0,0,2,0,2,0,iron,pot,5000,3,False,001,001,2021_Sep_09_2114,Object_Segments_CNN,2021.2.0,60.091170290244754,
,,,,0,0,0,0,3,0,3,0,iron,pineapple,20000,13,True,001,001,2021_Sep_09_2114,Object_Segments_CNN,2021.2.0,60.091170290244754,
,,,,0,0,0,0,4,0,4,0,iron,car,10000,100,False,001,001,2021_Sep_09_2114,Object_Segments_CNN,2021.2.0,60.091170290244754,
,,,,0,0,0,0,5,0,5,0,iron,sewing_machine,7000,84,False,001,001,2021_Sep_09_2114,Object_Segments_CNN,2021.2.0,60.091170290244754,
This diff is collapsed.
training_loop.thisRepN,training_loop.thisTrialN,training_loop.thisN,training_loop.thisIndex,loop_over_blocks.thisRepN,loop_over_blocks.thisTrialN,loop_over_blocks.thisN,loop_over_blocks.thisIndex,loop_over_trials.thisRepN,loop_over_trials.thisTrialN,loop_over_trials.thisN,loop_over_trials.thisIndex,answer,class,range,trail_number,catch_trial,session,participant,date,expName,psychopyVersion,frameRate,
,,,,0,0,0,0,0,0,0,0,iron,fish,10000,15,False,001,001,2021_Sep_10_0111,Object_Segments_CNN,2021.2.0,60.01273470146233,
,,,,0,0,0,0,1,0,1,0,hand_blower,fish,10000,16,False,001,001,2021_Sep_10_0111,Object_Segments_CNN,2021.2.0,60.01273470146233,
,,,,0,0,0,0,2,0,2,0,hand_blower,pineapple,7000,93,False,001,001,2021_Sep_10_0111,Object_Segments_CNN,2021.2.0,60.01273470146233,
,,,,0,0,0,0,3,0,3,0,hand_blower,pineapple,7000,48,False,001,001,2021_Sep_10_0111,Object_Segments_CNN,2021.2.0,60.01273470146233,
,,,,0,0,0,0,4,0,4,0,hand_blower,ladybug,38000,73,False,001,001,2021_Sep_10_0111,Object_Segments_CNN,2021.2.0,60.01273470146233,
,,,,0,0,0,0,5,0,5,0,hand_blower,sewing_machine,19000,26,True,001,001,2021_Sep_10_0111,Object_Segments_CNN,2021.2.0,60.01273470146233,
,,,,0,0,0,0,6,0,6,0,elephant,elephant,19000,58,False,001,001,2021_Sep_10_0111,Object_Segments_CNN,2021.2.0,60.01273470146233,
,,,,0,0,0,0,7,0,7,0,car,car,10000,52,False,001,001,2021_Sep_10_0111,Object_Segments_CNN,2021.2.0,60.01273470146233,
,,,,0,0,0,0,8,0,8,0,sewing_machine,sewing_machine,7000,11,False,001,001,2021_Sep_10_0111,Object_Segments_CNN,2021.2.0,60.01273470146233,
,,,,0,0,0,0,9,0,9,0,pineapple,pineapple,7000,54,False,001,001,2021_Sep_10_0111,Object_Segments_CNN,2021.2.0,60.01273470146233,
,,,,1,0,1,0,0,0,0,0,fish,fish,10000,2,False,001,001,2021_Sep_10_0111,Object_Segments_CNN,2021.2.0,60.01273470146233,
,,,,1,0,1,0,1,0,1,0,pineapple,pineapple,1000,77,False,001,001,2021_Sep_10_0111,Object_Segments_CNN,2021.2.0,60.01273470146233,
,,,,1,0,1,0,2,0,2,0,pineapple,pineapple,7000,80,False,001,001,2021_Sep_10_0111,Object_Segments_CNN,2021.2.0,60.01273470146233,
,,,,1,0,1,0,3,0,3,0,hand_blower,hand_blower,17000,47,False,001,001,2021_Sep_10_0111,Object_Segments_CNN,2021.2.0,60.01273470146233,
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment