-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstim.py
More file actions
50 lines (28 loc) · 1.28 KB
/
Copy pathstim.py
File metadata and controls
50 lines (28 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 25 14:07:02 2019
@author: marcoaqil
"""
from psychopy import visual
from psychopy import tools
# creates new PRFStim class, object inheritance redundant I think
class StimulusClass(object):
def __init__(self, session, gabor_size, **kwargs):
# bind parameters to self, so they describe the current instance of the classobject
self.session = session
self.gabor_size = gabor_size
# grating stim
self.grating = visual.GratingStim(
win=self.session.win, name='grating', units='deg',
tex='sin', mask='gauss', anchor='center',
ori=0.0, sf= 5.0 / self.gabor_size, phase=0.0, size = self.gabor_size,
color=[1,1,1], colorSpace='rgb',
opacity=1.0, blendmode='avg',
texRes=512.0, interpolate=True, depth=-1.0)
# Draw a grating depending on the current trials contrast and position, which is passed from session
# Could make it work through duration instead
def draw(self, position_x, position_y, present_time, contrast):
self.grating.contrast = contrast
self.grating.setPos([position_x, position_y])
self.grating.draw()