-
Notifications
You must be signed in to change notification settings - Fork 0
/
stim.py
48 lines (40 loc) · 1.25 KB
/
stim.py
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
import random
import math
from enum import Enum
# class Shape(Enum):
# CIRCLE="circle"
# SQUARE="square"
# def __str__(self):
# return self.value
class Stimulus(object):
shapes = ['circle', 'square']
orientations = [45, 135] # was set to [0, 90] but it seems to give me 45 degrees off
adjust = [-22.5, 22.5]
colors = ['green', 'red']
lineWidth = 3 #px
def __init__(self, distractor=False, shape='', orientation=0, color=''):
self.distractor = distractor
self.shape = 'circle'
self.orientation = random.choice(self.orientations) + random.choice(self.adjust)
self.color = color
@property
def shape(self):
return self._shape
@shape.setter
def shape(self, val):
self._shape = val
self.orientation = random.choice(self.orientations)
@property
def position(self):
return self._position
@position.setter
def position(self, val):
self._position = val
def __str__(self):
return "Distractor: {0}\nShape: {1}\nOrientation: {2}\nColor: {3}\nPosition: {4}\n".format(
self.distractor,
self.shape,
self.orientation,
self.color,
self.position
)