Ejemplo n.º 1
0
    def __init__(self, settings_yaml, texts_yaml):
        with open(settings_yaml, 'r') as f:
            exp_info = yaml.load(f)

        self.waits = exp_info.pop('waits')
        self.response_keys = exp_info.pop('response_keys')
        self.survey_url = exp_info.pop('survey_url')

        with open(texts_yaml, 'r') as f:
            self.texts = yaml.load(f)

        self.win = visual.Window(fullscr=True, units='pix')

        text_kwargs = dict(height=60, font='Consolas', color='black')
        self.fix = visual.TextStim(self.win, text='+', **text_kwargs)
        self.prompt = visual.TextStim(self.win,
                                      text='Yes or No?',
                                      **text_kwargs)

        self.questions = load_sounds(Path(self.STIM_DIR, 'questions'))
        self.cues = load_sounds(Path(self.STIM_DIR, 'cues'))

        size = [400, 400]
        image_kwargs = dict(win=self.win, size=size)
        self.mask = DynamicMask(Path(self.STIM_DIR, 'dynamic_mask'),
                                **image_kwargs)
        self.pics = load_images(Path(self.STIM_DIR, 'pics'), **image_kwargs)
        frame_buffer = 20
        self.frame = visual.Rect(self.win,
                                 width=size[0] + 20,
                                 height=size[1] + 20,
                                 lineColor='black')

        feedback_dir = Path(self.STIM_DIR, 'feedback')
        self.feedback = {}
        self.feedback[0] = sound.Sound(Path(feedback_dir, 'buzz.wav'))
        self.feedback[1] = sound.Sound(Path(feedback_dir, 'bleep.wav'))

        self.timer = core.Clock()
Ejemplo n.º 2
0
    def __init__(self, settings_yaml, texts_yaml):
        with open(settings_yaml, 'r') as f:
            exp_info = yaml.load(f)

        self.waits = exp_info.pop('waits')
        self.response_keys = exp_info.pop('response_keys')
        self.survey_url = exp_info.pop('survey_url')

        with open(texts_yaml, 'r') as f:
            self.texts = yaml.load(f)

        self.win = visual.Window(fullscr=True, units='pix')

        text_kwargs = dict(height=60, font='Consolas', color='black')
        self.fix = visual.TextStim(self.win, text='+', **text_kwargs)
        self.prompt = visual.TextStim(self.win, text='Yes or No?',
                                      **text_kwargs)

        self.questions = load_sounds(Path(self.STIM_DIR, 'questions'))
        self.cues = load_sounds(Path(self.STIM_DIR, 'cues'))

        size = [400, 400]
        image_kwargs = dict(win=self.win, size=size)
        self.mask = DynamicMask(Path(self.STIM_DIR, 'dynamic_mask'),
                                **image_kwargs)
        self.pics = load_images(Path(self.STIM_DIR, 'pics'), **image_kwargs)
        frame_buffer = 20
        self.frame = visual.Rect(self.win, width=size[0]+20, height=size[1]+20,
                                 lineColor='black')

        feedback_dir = Path(self.STIM_DIR, 'feedback')
        self.feedback = {}
        self.feedback[0] = sound.Sound(Path(feedback_dir, 'buzz.wav'))
        self.feedback[1] = sound.Sound(Path(feedback_dir, 'bleep.wav'))

        self.timer = core.Clock()
Ejemplo n.º 3
0
    def __init__(self, settings_yaml='settings.yaml', texts_yaml='texts.yaml'):
        with open(settings_yaml) as f:
            settings = yaml.load(f)
        self.layout = settings.pop('layout')
        self.positions = self.layout.pop('positions')
        self.waits = settings.pop('waits')
        self.response_keys = settings.pop('response_keys')
        self.all_response_keys = self.response_keys['pic'].keys() +\
                                 self.response_keys['word'].keys()
        self.survey_url = settings.pop('survey_url')

        with open(texts_yaml) as f:
            self.texts = yaml.load(f)

        self.win = visual.Window(fullscr=True, allowGUI=False, units='pix')

        text_kwargs = dict(
            win=self.win,
            font='Consolas',
            height=60,
            color='black'
        )
        self.fix = visual.TextStim(text='+', **text_kwargs)
        self.prompt = visual.TextStim(text='?', **text_kwargs)

        pic_size = self.layout['pic_size']
        frame_kwargs = dict(
            win=self.win,
            lineColor='black',
            lineWidth=2.0,
            fillColor=None,
            width=pic_size[0] + 10,
            height=pic_size[0] + 10,
        )
        self.frames = [visual.Rect(pos=pos, **frame_kwargs)
                       for pos in self.positions.values()]

        self.cues = load_sounds(unipath.Path(self.STIM_DIR, 'cues'))


        mask_kwargs = dict(
            win=self.win,
            size=pic_size,
        )
        self.masks = [DynamicMask(pos=pos, **mask_kwargs)
                      for pos in self.positions.values()]

        # Targets
        # NOTE: Probably inefficient to load images twice, but
        # I was having problems trying to copy the image
        # to each location.
        image_kwargs = dict(win=self.win, size=pic_size)
        self.left_pics = load_images(unipath.Path(self.STIM_DIR, 'pics'),
                                     pos=self.positions['left'],
                                     **image_kwargs)
        self.right_pics = load_images(unipath.Path(self.STIM_DIR, 'pics'),
                                      pos=self.positions['right'],
                                      **image_kwargs)

        self.word = visual.TextStim(**text_kwargs)

        self.timer = core.Clock()

        feedback_dir = unipath.Path(self.STIM_DIR, 'feedback')
        self.feedback = {}
        self.feedback[0] = sound.Sound(unipath.Path(feedback_dir, 'buzz.wav'))
        self.feedback[1] = sound.Sound(unipath.Path(feedback_dir, 'bleep.wav'))