Пример #1
0
def presentStimulus(win, stimulus, param, info, do_mask=True):
    import time
    if (param.condition == 1):
        pe = ParameterSet({'N_X' : info[NS_X]/2, 'N_Y' : info[NS_Y]/2, 'figpath':'.', 'matpath':'.'})
    else: pe = ParameterSet({'N_X' : info[NS_X], 'N_Y' : info[NS_Y], 'figpath':'.', 'matpath':'.'})
    im = Image(pe)
    if (stimulus.ndim == 3):
        img1 = stim(stimulus[:, :, 0])
        img2 = stim(im.translate(stimulus[:, :, 0], [param.shift, 0]))
    else:
        img1 = stim(stimulus)
        img2 = stim(im.translate(stimulus, [param.shift, 0]))

    if param.flip == -1:
        img2 = 255 - img2

    if do_mask:
        if (param.condition == 1):
            im = Image(ParameterSet({'N_X' : info[NS_X]/2, 'N_Y' : info[NS_Y]/2, 'figpath':'.', 'matpath':'.'}))
        else: im = Image(ParameterSet({'N_X' : info[NS_X], 'N_Y' : info[NS_Y], 'figpath':'.', 'matpath':'.'}))
        mask = im.mask[:, :, np.newaxis]
        img1 = ((img1 - 127)*mask + 127).astype(int)
        img2 = ((img2 - 127)*mask + 127).astype(int)

    win.background.fill(RGB.Gray)
    win.screen.blit(win.background, (0, 0))
    winblit(img1, win, info)
    winblit(img2, win, info)