11from smile .common import *
22from smile .scale import scale as s
3- import config as config
4- from list_gen import gen_fblocks
53
6- from smile .common import *
7- from smile .scale import scale as s
8- import config as config
9- from list_gen import gen_fblocks
104
115@Subroutine
126def Flanker (self , config , center_x , center_y , direction , condition , layers , num_layers = 2 , background = True ):
@@ -27,7 +21,7 @@ def Flanker(self, config, center_x, center_y, direction, condition, layers, num_
2721
2822 with Parallel ():
2923 with Parallel ():
30- Background = Image (source = "ocean_background.png" , size = (self .exp .screen .size [0 ] * 1.1 ,
24+ background_image = Image (source = config . BACKGROUND_IMAGE , size = (self .exp .screen .size [0 ] * 1.1 ,
3125 self .exp .screen .size [1 ] * 1.1 ),
3226 allow_stretch = True , keep_ratio = False )
3327 center_image = Image (source = self .center_image , center = (self .center_x , self .center_y ), size = (s (50 ),s (50 )), allow_stretch = True , keep_ratio = False )
@@ -69,25 +63,27 @@ def Flanker(self, config, center_x, center_y, direction, condition, layers, num_
6963 center = (add_left .center_x , add_left .center_y - s (50 * (mult + 1 ))))
7064 self .layer = self .layer + 1
7165 with If (background == False ):
72- Background .update (color = (1 ,1 ,1 ,0 ))
66+ background_image .update (color = (1 ,1 ,1 ,0 ))
7367 with Serial ():
7468 Wait (until = center_image .appear_time )
7569 self .stim_appear_time = center_image .appear_time
7670 # self.stim_disappear_time = center_image.disappear_time
7771
7872
79- # blocks = gen_fblocks(config)
80- # exp = Experiment()
81- # with Loop(blocks) as block:
82- # with Loop(block.current) as trial:
83- # fl = Flanker(config,
84- # center_x = exp.screen.center_x + trial.current['loc_x']*s(config.FROM_CENTER),
85- # center_y = exp.screen.center_y + trial.current['loc_y']*s(config.FROM_CENTER),
86- # direction = trial.current["dir"],
87- # condition = trial.current['condition'],
88- # layers = config.LAYERS)
89- # with UntilDone():
90- # Wait(until=fl.stim_appear_time)
91- # Wait(3)
92- # exp.run()
93-
73+ if __name__ == "__main__" :
74+ import config as config
75+ from list_gen import gen_fblocks
76+ blocks = gen_fblocks (config )
77+ exp = Experiment ()
78+ with Loop (blocks ) as block :
79+ with Loop (block .current ) as trial :
80+ fl = Flanker (config ,
81+ center_x = exp .screen .center_x + trial .current ['loc_x' ]* s (config .FROM_CENTER ),
82+ center_y = exp .screen .center_y + trial .current ['loc_y' ]* s (config .FROM_CENTER ),
83+ direction = trial .current ["dir" ],
84+ condition = trial .current ['condition' ],
85+ layers = config .LAYERS )
86+ with UntilDone ():
87+ Wait (until = fl .stim_appear_time )
88+ Wait (3 )
89+ exp .run ()
0 commit comments