Skip to content

Commit d9a4cba

Browse files
committed
add __init__ in Bar and Dot
in bar move mas_res in trial current conditions and not in experiment parameters in bar add 'axis': 'vertical' in default keys
1 parent e0cccd4 commit d9a4cba

File tree

2 files changed

+27
-22
lines changed

2 files changed

+27
-22
lines changed

src/ethopy/stimuli/bar.py

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,28 +28,31 @@ class Bar(Stimulus, dj.Manual):
2828
max_res : smallint
2929
"""
3030

31-
cond_tables = ['Bar']
32-
default_key = {
33-
"max_res": 1000,
34-
"bar_width": 4, # degrees
35-
"bar_speed": 2, # degrees/sec
36-
"flash_speed": 2,
37-
"grat_width": 10, # degrees
38-
"grat_freq": 1,
39-
"grid_width": 10,
40-
"grit_freq": 0.1,
41-
"style": "checkerboard", # checkerboard, grating
42-
"direction": 1, # 1 for UD LR, -1 for DU RL
43-
"flatness_correction": 1,
44-
"intertrial_duration": 0,
45-
}
31+
def __init__(self):
32+
super().__init__()
33+
self.cond_tables = ['Bar']
34+
self.default_key = {
35+
'axis': 'vertical',
36+
"max_res": 1000,
37+
"bar_width": 4, # degrees
38+
"bar_speed": 2, # degrees/sec
39+
"flash_speed": 2,
40+
"grat_width": 10, # degrees
41+
"grat_freq": 1,
42+
"grid_width": 10,
43+
"grit_freq": 0.1,
44+
"style": "checkerboard", # checkerboard, grating
45+
"direction": 1, # 1 for UD LR, -1 for DU RL
46+
"flatness_correction": 1,
47+
"intertrial_duration": 0,
48+
}
4649

4750
def setup(self):
4851
super().setup()
4952
ymonsize = self.monitor.size * 2.54 / np.sqrt(1 + self.monitor.aspect ** 2) # cm Y monitor size
5053
monSize = [ymonsize * self.monitor.aspect, ymonsize]
51-
y_res = int(self.exp.params['max_res'] / self.monitor.aspect)
52-
self.monRes = [self.exp.params['max_res'], int(y_res + np.ceil(y_res % 2))]
54+
y_res = int(self.exp.curr_cond['max_res'] / self.monitor.aspect)
55+
self.monRes = [self.exp.curr_cond['max_res'], int(y_res + np.ceil(y_res % 2))]
5356
self.FoV = np.arctan(np.array(monSize) / 2 / self.monitor.distance) * 2 * 180 / np.pi # in degrees
5457
self.FoV[1] = self.FoV[0] / self.monitor.aspect
5558

src/ethopy/stimuli/dot.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ class Dot(Stimulus, dj.Manual):
2020
dot_time : float # (sec) time of each dot persists
2121
"""
2222

23-
cond_tables = ['Dot']
24-
required_fields = ['dot_x', 'dot_y', 'dot_xsize', 'dot_ysize', 'dot_time']
25-
default_key = {'bg_level' : 1,
26-
'dot_level' : 0, # degrees
27-
'dot_shape' : 'rect'}
23+
def __init__(self):
24+
super().__init__()
25+
self.cond_tables = ['Dot']
26+
self.required_fields = ['dot_x', 'dot_y', 'dot_xsize', 'dot_ysize', 'dot_time']
27+
self.default_key = {'bg_level': 1,
28+
'dot_level': 0, # degrees
29+
'dot_shape': 'rect'}
2830

2931
def prepare(self, curr_cond):
3032
self.curr_cond = curr_cond

0 commit comments

Comments
 (0)