12
12
colors = plt .rcParams ['axes.prop_cycle' ].by_key ()['color' ]
13
13
14
14
def plot_freq (ax , ctx , thl , gpi , stn , str , i0 , i1 , duration , dt , title , xlabel , ylabel ):
15
+
16
+ start , stop = duration
17
+ duration = stop - start
15
18
timesteps = np .linspace (0 , duration , duration / dt )
16
- stn = stn [:duration :dt ]
17
- str = str [:duration :dt ]
18
- ctx = ctx [:duration :dt ]
19
- gpi = gpi [:duration :dt ]
20
- thl = thl [:duration :dt ]
19
+ #stn = stn[:duration:dt]
20
+ #str = str[:duration:dt]
21
+ #ctx = ctx[:duration:dt]
22
+ #gpi = gpi[:duration:dt]
23
+ #thl = thl[:duration:dt]
24
+
25
+ stn = stn [start :stop :dt ]
26
+ str = str [start :stop :dt ]
27
+ ctx = ctx [start :stop :dt ]
28
+ gpi = gpi [start :stop :dt ]
29
+ thl = thl [start :stop :dt ]
21
30
22
31
fontsize = 8
23
32
@@ -28,7 +37,7 @@ def plot_freq(ax, ctx, thl, gpi, stn, str, i0, i1, duration, dt, title, xlabel,
28
37
29
38
x = np .argwhere ((ctx [:,i0 ] - ctx [:,i1 ]) > 40 )[0 ] * dt
30
39
ax .text (x , - 6 , "↑\n Decision" , fontsize = 8 , va = "top" , ha = "center" )
31
- ax .text (500 , - 6 , "↑\n Trial start" , fontsize = 8 , va = "top" , ha = "center" )
40
+ ax .text (0 , - 6 , "↑\n Trial start" , fontsize = 8 , va = "top" , ha = "center" )
32
41
33
42
ax .plot (timesteps , ctx [:,i1 ], c = colors [0 ], ls = "--" )
34
43
ax .plot (timesteps , ctx [:,i0 ], c = colors [0 ])
@@ -64,7 +73,8 @@ def plot_freq(ax, ctx, thl, gpi, stn, str, i0, i1, duration, dt, title, xlabel,
64
73
ax .set_xlabel ("Time (ms)" )
65
74
if ylabel :
66
75
ax .set_ylabel ("Firing rate (spikes/s)" )
67
- ax .set_xticks ([0 ,2000 ])
76
+ ax .set_xticks ([0 ,duration ])
77
+ ax .set_xticklabels (["" ,"%d" % duration ])
68
78
ax .set_ylim (- 5 ,145 )
69
79
ax .set_yticks ([0 ,40 ,80 ,120 ])
70
80
@@ -81,12 +91,27 @@ def plot_scatter(X, y, color):
81
91
Y = y * np .ones (len (X ))
82
92
ax .scatter (X , Y , s = .5 , marker = '|' , facecolor = color , edgecolor = "none" )
83
93
94
+ start , stop = duration
95
+ duration = stop - start
84
96
timesteps = np .linspace (0 , duration , duration / dt )
85
- stn = stn [:duration :dt ]
86
- str = str [:duration :dt ]
87
- ctx = ctx [:duration :dt ]
88
- gpi = gpi [:duration :dt ]
89
- thl = thl [:duration :dt ]
97
+ #stn = stn[:duration:dt]
98
+ #str = str[:duration:dt]
99
+ #ctx = ctx[:duration:dt]
100
+ #gpi = gpi[:duration:dt]
101
+ #thl = thl[:duration:dt]
102
+
103
+ stn = stn [start :stop :dt ]
104
+ str = str [start :stop :dt ]
105
+ ctx = ctx [start :stop :dt ]
106
+ gpi = gpi [start :stop :dt ]
107
+ thl = thl [start :stop :dt ]
108
+
109
+ # timesteps = np.linspace(0, duration, duration/dt)
110
+ # stn = stn[:duration:dt]
111
+ # str = str[:duration:dt]
112
+ # ctx = ctx[:duration:dt]
113
+ # gpi = gpi[:duration:dt]
114
+ # thl = thl[:duration:dt]
90
115
91
116
n = 10
92
117
y = 100
@@ -133,7 +158,7 @@ def plot_scatter(X, y, color):
133
158
134
159
135
160
def setup (task_filename = "task.json" , model_filename = "model.json" ):
136
- seed = 123
161
+ seed = 12345
137
162
np .random .seed (seed )
138
163
random .seed (seed )
139
164
model = Model (model_filename )
@@ -164,12 +189,15 @@ def simulate(task, model, loop, gpi=0):
164
189
return ctx , thl , gpi , stn , str , i0 , i1
165
190
166
191
167
-
168
192
dt = 10
169
- duration = 2000
193
+
194
+ duration = (500 , 2000 )
195
+ # duration = (0, 4000)
196
+ # duration = 4000
170
197
171
198
fig = plt .figure (figsize = (6 ,10 ))
172
199
200
+ #task, model = setup("task.json", "model-guthrie-no-warmup.json")
173
201
task , model = setup ("task.json" , "model-guthrie.json" )
174
202
175
203
ax = plt .subplot (3 ,1 ,1 )
@@ -178,6 +206,7 @@ def simulate(task, model, loop, gpi=0):
178
206
"A Motor channel (no cortical competition)" , 0 , 1 )
179
207
plot_raster (ax , ctx , thl , gpi , stn , str , i0 , i1 , duration , dt , "" )
180
208
209
+ # task, model = setup("task.json", "model-noisy-no-warmup.json")
181
210
task , model = setup ("task.json" , "model-noisy.json" )
182
211
183
212
ax = plt .subplot (3 ,1 ,3 )
0 commit comments