コード例 #1
0
ファイル: ExpA.py プロジェクト: ksk-S/DynamicChangeBlindness
def ResetTrial():
    
    global central_pos, stim, clock, status, keep_going
    
    central_pos = [gabor_ball.total_diameter/2, ScreenSize[1] - (gabor_ball.total_diameter/2)]
    stim = gabor_ball.init(central_pos, ScreenSize, win, n_patches)
    clock = psychopy.core.Clock()
    status = 0
    keep_going = True
コード例 #2
0
def ResetTrial():

    global central_pos, stim, clock, status, keep_going, ScreenSize, tmp_t

    central_pos = [ScreenSize[0] / 2, ScreenSize[1] / 2]
    stim = gabor_ball.init(central_pos, ScreenSize, win, n_patches)
    clock = psychopy.core.Clock()
    status = 0
    tmp_t = 0
    keep_going = True
コード例 #3
0
def InitialisePos():

    global stim, waiting_indice, moving_indice

    waiting_indice = []
    moving_indice = []

    for i in range(stim.n_patches):
        moving_indice.append(i)

    for i in range(num_waiting_patch):

        index = random.randrange(0, stim.n_patches)
        while index in waiting_indice:
            index = random.randrange(0, stim.n_patches)
        waiting_indice.append(index)
        moving_indice.remove(index)

    #print(waiting_indice)
    #print(moving_indice)

    # set the corner position
    central_pos = [
        gabor_ball.total_diameter / 2, gabor_ball.total_diameter / 2
    ]
    stim = gabor_ball.init(central_pos, ScreenSize, win, n_patches)

    # store the patch positions at the corner
    target_pos = []
    for i in range(len(waiting_indice)):
        target_pos.append(stim.gratings[waiting_indice[i]].pos)

    # rest to the initial pos
    central_pos = [
        gabor_ball.total_diameter / 2,
        ScreenSize[1] - (gabor_ball.total_diameter / 2)
    ]
    stim = gabor_ball.init(central_pos, ScreenSize, win, n_patches)

    # restore the patches position for 'waiting' patches
    for i in range(len(waiting_indice)):
        stim.gratings[waiting_indice[i]].pos = target_pos[i]
コード例 #4
0
ファイル: ExpD.py プロジェクト: ksk-S/DynamicChangeBlindness
def ResetTrial():
    
    global central_pos, stim, clock, status, keep_going, beta_idx
    
    central_pos = [gabor_ball.total_diameter/2, ScreenSize[1] - (gabor_ball.total_diameter/2)]
    stim = gabor_ball.init(central_pos, ScreenSize, win, n_patches)
    clock = psychopy.core.Clock()
    status = 0
    keep_going = True

    for index in range(stim.n_patches):
        stim.gratings[index].ori = 0
    beta_idx = random.randrange(0, stim.n_patches-1)
    stim.gratings[beta_idx].ori = random.randrange(30, 150)
    stim.gratings[beta_idx+1].ori = random.randrange(30, 150)
コード例 #5
0
def ResetTrial():

    global central_pos, stim, clock, status, keep_going

    #target pos
    central_pos = [gabor_ball.total_diameter, gabor_ball.total_diameter]

    stim = gabor_ball.init(central_pos, ScreenSize, win, n_patches)

    InitialisePos()

    #initial pos
    central_pos = [gabor_ball.total_diameter, ScreenSize[1]]

    clock = psychopy.core.Clock()
    status = 0
    keep_going = True
コード例 #6
0
def ResetTrial():

    global central_pos, stim, clock, status, keep_going, background, start_time, background_stim

    central_pos = [ScreenSize[0] / 2, ScreenSize[1] / 2]
    stim = gabor_ball.init(central_pos, ScreenSize, win, n_patches)
    clock = psychopy.core.Clock()
    status = 0
    keep_going = True

    start_time = clock.getTime()

    if background_type == BackgroundType.Grating:
        background_stim = CreateBGGrating()
    elif background_type == BackgroundType.Dots:
        background_stim = CreateDots()
    elif background_type == BackgroundType.Grid:
        background_stim = CreateGrid()

    if change_type == ChangeType.BackgroundColor:
        window.color = [1, 0, 0]

    elif change_type == ChangeType.GratingColor:
        background.color = [1, 0, 0]
コード例 #7
0
shift_size = 2.5
change_angle = 15

# init position
#central_pos = [gabor_ball.total_diameter/2, ScreenSize[1] - (gabor_ball.total_diameter/2)]

central_pos = [ScreenSize[0] / 2, ScreenSize[1] / 2]

win = psychopy.visual.Window(
    size=ScreenSize,
    units="pix",
    color=[.5, .5, .5],
    fullscr=False,
)

stim = gabor_ball.init(central_pos, ScreenSize, win)
gratings = stim["gratings"]
fixation_dot = stim["fixation_dot"]
x_pos = stim["x_pos"]
y_pos = stim["y_pos"]


def Change():
    index = random.randrange(0, int(gabor_ball.n_patches / 2))
    gratings[index].ori = gratings[index].ori - 10
    # x_pos[index] = x_pos[index] + shift_size
    # y_pos[index] = y_pos[index] + shift_size


clock = psychopy.core.Clock()
keep_going = True
コード例 #8
0
if causality_type == CausalityType.PassThrough:
    space_A_and_B = -r_total * 2

# define shape
cos60 = math.sqrt(3) / 2
sin60 = 0.5

r_total = gabor_ball.total_diameter / 2

# init position
central_pos_A = [r_total, ScreenSize[1] / 2]
central_pos_B = [ScreenSize[0] / 2, ScreenSize[1] / 2]

win = psychopy.visual.Window(size=ScreenSize, units="pix", fullscr=False)

stimA = gabor_ball.init(central_pos_A, ScreenSize, win)
gratings_A = stimA["gratings"]
fixation_dot_A = stimA["fixation_dot"]

stimB = gabor_ball.init(central_pos_B, ScreenSize, win)
gratings_B = stimB["gratings"]
fixation_dot_B = stimB["fixation_dot"]

x_pos = stimA["x_pos"]
y_pos = stimA["y_pos"]


def Change():
    index = random.randrange(0, gabor_ball.n_patches)

    gratings_B[index].ori = gratings_B[index].ori + change_angle