-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjaanalysis.py
490 lines (400 loc) · 29.4 KB
/
jaanalysis.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
import numpy
import __main__
def t_function():
"""
Basic example of an analysis command for run_batch; users are
likely to need something similar but highly customized.
"""
print 'Called complex_analysis_function'
import topo
from topo.command.analysis import save_plotgroup
from topo.base.projection import ProjectionSheet
from topo.sheet import GeneratorSheet
from topo.analysis.featureresponses import SinusoidalMeasureResponseCommand,FeatureCurveCommand
import contrib.jacommands
exec "from topo.analysis.vision import analyze_complexity" in __main__.__dict__
print 'Analysing'
import matplotlib
matplotlib.rc('xtick', labelsize=17)
matplotlib.rc('ytick', labelsize=17)
print 'Build a list of all sheets worth measuring'
f = lambda x: hasattr(x,'measure_maps') and x.measure_maps
measured_sheets = filter(f,topo.sim.objects(ProjectionSheet).values())
input_sheets = topo.sim.objects(GeneratorSheet).values()
print 'Set potentially reasonable defaults; not necessarily useful'
topo.command.analysis.coordinate=(0.0,0.0)
if input_sheets: topo.command.analysis.input_sheet_name=input_sheets[0].name
if measured_sheets: topo.command.analysis.sheet_name=measured_sheets[0].name
FeatureCurveCommand.curve_parameters=[{"contrast":30},{"contrast":50},{"contrast":70},{"contrast":90}]
import numpy
# reset treshold and desable noise before measuring maps
#m = numpy.mean(topo.sim["V1Simple"].output_fns[2].t)
#topo.sim["V1Simple"].output_fns[2].t*=0
#topo.sim["V1Simple"].output_fns[2].t+=m
#sc = topo.sim["V1Simple"].output_fns[1].generator.scale
#topo.sim["V1Simple"].output_fns[1].generator.scale=0.0
#save_plotgroup("Orientation Preference and Complexity")
save_plotgroup("Orientation Preference")
def complex_analysis_function():
"""
Basic example of an analysis command for run_batch; users are
likely to need something similar but highly customized.
"""
print 'Called complex_analysis_function'
import topo
from topo.command.analysis import save_plotgroup
from topo.base.projection import ProjectionSheet
from topo.sheet import GeneratorSheet
from topo.analysis.featureresponses import SinusoidalMeasureResponseCommand,FeatureCurveCommand
import contrib.jacommands
exec "from topo.analysis.vision import analyze_complexity" in __main__.__dict__
print 'Analysing'
import matplotlib
matplotlib.rc('xtick', labelsize=17)
matplotlib.rc('ytick', labelsize=17)
print 'Build a list of all sheets worth measuring'
f = lambda x: hasattr(x,'measure_maps') and x.measure_maps
measured_sheets = filter(f,topo.sim.objects(ProjectionSheet).values())
input_sheets = topo.sim.objects(GeneratorSheet).values()
print 'Set potentially reasonable defaults; not necessarily useful'
topo.command.analysis.coordinate=(0.0,0.0)
if input_sheets: topo.command.analysis.input_sheet_name=input_sheets[0].name
if measured_sheets: topo.command.analysis.sheet_name=measured_sheets[0].name
FeatureCurveCommand.curve_parameters=[{"contrast":30},{"contrast":50},{"contrast":70},{"contrast":90}]
import numpy
# reset treshold and desable noise before measuring maps
#m = numpy.mean(topo.sim["V1Simple"].output_fns[2].t)
#topo.sim["V1Simple"].output_fns[2].t*=0
#topo.sim["V1Simple"].output_fns[2].t+=m
#sc = topo.sim["V1Simple"].output_fns[1].generator.scale
#topo.sim["V1Simple"].output_fns[1].generator.scale=0.0
a = topo.sim["V1Complex"].in_connections[0].strength
SinusoidalMeasureResponseCommand.scale=__main__.__dict__.get("analysis_scale",0.35)
MeasureResponseCommand.scale=__main__.__dict__.get("analysis_scale",0.35)
#if((float(topo.sim.time()) >= 5003.0) and (float(topo.sim.time()) < 5004.0)):
# topo.sim["V1Complex"].in_connections[0].strength=0
# SinusoidalMeasureResponseCommand.frequencies=[3.0]
# if((float(topo.sim.time()) >= 5005.0) and (float(topo.sim.time()) < 5006.0)):
# SinusoidalMeasureResponseCommand.frequencies=[3.0]
# if((float(topo.sim.time()) >= 5006.0) and (float(topo.sim.time()) < 5007.0)):
# topo.sim["V1Complex"].in_connections[0].strength=0
# SinusoidalMeasureResponseCommand.frequencies=[2.4]
# if((float(topo.sim.time()) >= 5007.0) and (float(topo.sim.time()) < 5008.0)):
# SinusoidalMeasureResponseCommand.frequencies=[2.4]
# if((float(topo.sim.time()) >= 10002.0) and (float(topo.sim.time()) < 10003.0)):
# topo.sim["V1Complex"].in_connections[0].strength=0
# SinusoidalMeasureResponseCommand.frequencies=[2.4]
# if((float(topo.sim.time()) >= 10003.0) and (float(topo.sim.time()) < 10004.0)):
# topo.sim["V1Complex"].in_connections[0].strength=0
# SinusoidalMeasureResponseCommand.frequencies=[3.0]
# if((float(topo.sim.time()) >= 10004.0) and (float(topo.sim.time()) < 10005.0)):
# SinusoidalMeasureResponseCommand.frequencies=[2.4]
# if((float(topo.sim.time()) >= 10005.0) and (float(topo.sim.time()) < 10006.0)):
# SinusoidalMeasureResponseCommand.frequencies=[3.0]
save_plotgroup("Orientation Preference and Complexity")
save_plotgroup("Activity")
# Plot all projections for all measured_sheets
for s in measured_sheets:
for p in s.projections().values():
save_plotgroup("Projection",projection=p)
if(float(topo.sim.time()) >= 10005.0):
print 'Measuring orientations'
SinusoidalMeasureResponseCommand.frequencies=[2.4]
topo.command.pylabplot.measure_or_tuning_fullfield.instance(sheet=topo.sim["V1Complex"])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0,0]",sheet=topo.sim["V1Complex"],coords=[(0,0)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0.1,0.1]",sheet=topo.sim["V1Complex"],coords=[(0.1,0.1)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0.1,-0.1]",sheet=topo.sim["V1Complex"],coords=[(0.1,-0.1)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[-0.1,0.1]",sheet=topo.sim["V1Complex"],coords=[(-0.1,0.1)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[-0.1,-0.1]",sheet=topo.sim["V1Complex"],coords=[(-0.1,-0.1)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0.2,0.2]",sheet=topo.sim["V1Complex"],coords=[(0.2,0.2)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0.2,-0.2]",sheet=topo.sim["V1Complex"],coords=[(0.2,-0.2)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[-0.2,0.2]",sheet=topo.sim["V1Complex"],coords=[(-0.2,0.2)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[-0.2,-0.2]",sheet=topo.sim["V1Complex"],coords=[(-0.2,-0.2)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0,0.1]",sheet=topo.sim["V1Complex"],coords=[(0.0,0.1)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0,-0.1]",sheet=topo.sim["V1Complex"],coords=[(0.0,-0.1)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[-0.1,0]",sheet=topo.sim["V1Complex"],coords=[(-0.1,0.0)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0.1,0]",sheet=topo.sim["V1Complex"],coords=[(0.1,-0.0)])()
topo.command.pylabplot.measure_or_tuning_fullfield.instance(sheet=topo.sim["V1Simple"])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="SimpleORTC[0,0]",sheet=topo.sim["V1Simple"],coords=[(0,0)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="SimpleORTC[0.1,0.1]",sheet=topo.sim["V1Simple"],coords=[(0.1,0.1)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="SimpleORTC[0.1,-0.1]",sheet=topo.sim["V1Simple"],coords=[(0.1,-0.1)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="SimpleORTC[-0.1,0.1]",sheet=topo.sim["V1Simple"],coords=[(-0.1,0.1)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="SimpleORTC[-0.1,-0.1]",sheet=topo.sim["V1Simple"],coords=[(-0.1,-0.1)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="SimpleORTC[0.2,0.2]",sheet=topo.sim["V1Simple"],coords=[(0.2,0.2)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="SimpleORTC[0.2,-0.2]",sheet=topo.sim["V1Simple"],coords=[(0.2,-0.2)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="SimpleORTC[-0.2,0.2]",sheet=topo.sim["V1Simple"],coords=[(-0.2,0.2)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="SimpleORTC[-0.2,-0.2]",sheet=topo.sim["V1Simple"],coords=[(-0.2,-0.2)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="SimpleORTC[0,0.1]",sheet=topo.sim["V1Simple"],coords=[(0.0,0.1)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="SimpleORTC[0,-0.1]",sheet=topo.sim["V1Simple"],coords=[(0.0,-0.1)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="SimpleORTC[-0.1,0]",sheet=topo.sim["V1Simple"],coords=[(-0.1,0.0)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="SimpleORTC[0.1,0]",sheet=topo.sim["V1Simple"],coords=[(0.1,-0.0)])()
#topo.sim["V1Simple"].output_fns[1].generator.scale=sc
topo.sim["V1Complex"].in_connections[0].strength = a
#topo.sim["V1Complex"].in_connections[0].strength=st
def push_pull_analysis_function():
print 'Push pull complex_analysis_function'
import topo
import numpy
from topo.command.analysis import save_plotgroup
from topo.base.projection import ProjectionSheet
from topo.sheet import GeneratorSheet
from topo.analysis.featureresponses import SinusoidalMeasureResponseCommand,FeatureCurveCommand
import contrib.jacommands
from contrib.push_pull.CCLISSOM_push_pull_extra import check_RF_corrleation_vs_connection_weights_correlation
from param import normalize_path
exec "from topo.analysis.vision import analyze_complexity" in __main__.__dict__
SinusoidalMeasureResponseCommand.frequencies=[2.4]
SinusoidalMeasureResponseCommand.scale=__main__.__dict__.get("analysis_scale",1.0)
print 'Analysing'
import matplotlib
matplotlib.rc('xtick', labelsize=17)
matplotlib.rc('ytick', labelsize=17)
print 'Build a list of all sheets worth measuring'
f = lambda x: hasattr(x,'measure_maps') and x.measure_maps
measured_sheets = filter(f,topo.sim.objects(ProjectionSheet).values())
input_sheets = topo.sim.objects(GeneratorSheet).values()
print 'Set potentially reasonable defaults; not necessarily useful'
topo.command.analysis.coordinate=(0.0,0.0)
if input_sheets: topo.command.analysis.input_sheet_name=input_sheets[0].name
if measured_sheets: topo.command.analysis.sheet_name=measured_sheets[0].name
FeatureCurveCommand.curve_parameters=[{"contrast":30},{"contrast":50},{"contrast":70},{"contrast":90}]
save_plotgroup("Orientation Preference and Complexity")
save_plotgroup("Activity",normalize="Individually")
# Plot all projections for all measured_sheets
for s in measured_sheets:
for p in s.projections().values():
save_plotgroup("Projection",projection=p,density=3.0)
print 'Starting push pull analysis'
#analyse_push_pull_connectivity()
check_RF_corrleation_vs_connection_weights_correlation()
print 'Finished push pull analysis'
return
if(float(topo.sim.time()) >= 10005.0):
print 'Measuring orientations'
SinusoidalMeasureResponseCommand.frequencies=[2.4]
topo.command.pylabplot.measure_or_tuning_fullfield.instance(sheet=topo.sim["V1Simple"])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0,0]",sheet=topo.sim["V1Simple"],coords=[(0,0)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0.1,0.1]",sheet=topo.sim["V1Simple"],coords=[(0.1,0.1)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0.1,-0.1]",sheet=topo.sim["V1Simple"],coords=[(0.1,-0.1)])()
def complex_surround_analysis_function():
"""
Basic example of an analysis command for run_batch; users are
likely to need something similar but highly customized.
"""
import topo
from topo.command.analysis import save_plotgroup
from topo.analysis.featureresponses import SinusoidalMeasureResponseCommand,FeatureCurveCommand
from topo.base.projection import ProjectionSheet
from topo.sheet import GeneratorSheet
from topo.command import save_snapshot
from param import normalize_path
import contrib.jacommands
import contrib.surround_analysis_new_cleaned
exec "from topo.analysis.vision import analyze_complexity" in __main__.__dict__
import matplotlib
matplotlib.rc('xtick', labelsize=17)
matplotlib.rc('ytick', labelsize=17)
SinusoidalMeasureResponseCommand.frequencies=[2.4]
SinusoidalMeasureResponseCommand.scale=__main__.__dict__.get("analysis_scale",0.3)
from topo.analysis.featureresponses import PatternPresenter
PatternPresenter.duration=4.0
import topo.command.pylabplot
reload(topo.command.pylabplot)
# Build a list of all sheets worth measuring
f = lambda x: hasattr(x,'measure_maps') and x.measure_maps
measured_sheets = filter(f,topo.sim.objects(ProjectionSheet).values())
input_sheets = topo.sim.objects(GeneratorSheet).values()
# Set potentially reasonable defaults; not necessarily useful
topo.command.analysis.coordinate=(0.0,0.0)
if input_sheets: topo.command.analysis.input_sheet_name=input_sheets[0].name
if measured_sheets: topo.command.analysis.sheet_name=measured_sheets[0].name
save_plotgroup("Orientation Preference and Complexity")
save_plotgroup("Activity",normalize='Individually')
# Plot all projections for all measured_sheets
for s in measured_sheets:
for p in s.projections().values():
save_plotgroup("Projection",projection=p)
if(float(topo.sim.time()) > 6020.0):
if __main__.__dict__.get("save",False):
save_snapshot(normalize_path('snapshot.typ'))
#contrib.surround_analysis.run_dynamics_analysis(0.0,0.0,0.7,__main__.__dict__.get("analysis_scale",0.3))
#topo.command.pylabplot.measure_or_tuning_fullfield.instance(sheet=topo.sim["V1Complex"])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0,0]",sheet=topo.sim["V1Complex"],coords=[(0,0)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0.1,0.1]",sheet=topo.sim["V1Complex"],coords=[(0.1,0.1)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0.1,-0.1]",sheet=topo.sim["V1Complex"],coords=[(0.1,-0.1)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[-0.1,0.1]",sheet=topo.sim["V1Complex"],coords=[(-0.1,0.1)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[-0.1,-0.1]",sheet=topo.sim["V1Complex"],coords=[(-0.1,-0.1)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0.2,0.2]",sheet=topo.sim["V1Complex"],coords=[(0.2,0.2)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0.2,-0.2]",sheet=topo.sim["V1Complex"],coords=[(0.2,-0.2)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[-0.2,0.2]",sheet=topo.sim["V1Complex"],coords=[(-0.2,0.2)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[-0.2,-0.2]",sheet=topo.sim["V1Complex"],coords=[(-0.2,-0.2)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0,0.1]",sheet=topo.sim["V1Complex"],coords=[(0.0,0.1)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0,-0.1]",sheet=topo.sim["V1Complex"],coords=[(0.0,-0.1)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[-0.1,0]",sheet=topo.sim["V1Complex"],coords=[(-0.1,0.0)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0.1,0]",sheet=topo.sim["V1Complex"],coords=[(0.1,-0.0)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0.3,0.3]",sheet=topo.sim["V1Complex"],coords=[(0.3,0.3)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0.3,-0.3]",sheet=topo.sim["V1Complex"],coords=[(0.3,-0.3)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[-0.3,0.3]",sheet=topo.sim["V1Complex"],coords=[(-0.3,0.3)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[-0.3,-0.3]",sheet=topo.sim["V1Complex"],coords=[(-0.3,-0.3)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0.24,0.24]",sheet=topo.sim["V1Complex"],coords=[(0.24,0.24)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0.24,-0.24]",sheet=topo.sim["V1Complex"],coords=[(0.24,-0.24)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[-0.24,0.24]",sheet=topo.sim["V1Complex"],coords=[(-0.24,0.42)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[-0.24,-0.24]",sheet=topo.sim["V1Complex"],coords=[(-0.24,-0.24)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0,0.24]",sheet=topo.sim["V1Complex"],coords=[(0.0,0.24)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0,-0.24]",sheet=topo.sim["V1Complex"],coords=[(0.0,-0.42)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[-0.24,0]",sheet=topo.sim["V1Complex"],coords=[(-0.24,0.0)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0.24,0]",sheet=topo.sim["V1Complex"],coords=[(0.24,-0.0)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0,0.3]",sheet=topo.sim["V1Complex"],coords=[(0.0,0.3)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0,-0.3]",sheet=topo.sim["V1Complex"],coords=[(0.0,-0.3)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[-0.3,0]",sheet=topo.sim["V1Complex"],coords=[(-0.3,0.0)])()
#topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0.3,0]",sheet=topo.sim["V1Complex"],coords=[(0.3,-0.0)])()
#contrib.surround_analysis_new_cleaned.surround_analysis("V1Complex").run_analysis_with_step_grid(4,4,max_curves=__main__.__dict__.get("max_curves",20))
contrib.surround_analysis_new_cleaned.surround_analysis("V1Complex").run_lhi_informed_analysis(max_curves=__main__.__dict__.get("max_curves",20),center_size=__main__.__dict__.get("center_size",20))
#contrib.surround_analysis_new.surround_analysis("V1Complex").analyse([(0,0),(3,0),(-3,0),(0,3),(0,-3),(3,3),(3,-3),(-3,3),(-3,-3),(6,0),(-6,0),(0,6),(0,-6),(6,6),(6,-6),(-6,6),(-6,-6)],__main__.__dict__.get("number_sizes",10))
#contrib.surround_analysis_new.surround_analysis("V1Complex").analyse([(57,57),(53,67),(57,59),(61,63),(53,49),(67,65),(51,67),(67,61),(55,49),(47,59),(63,51)],__main__.__dict__.get("number_sizes",10))
def v2_analysis_function():
"""
Basic example of an analysis command for run_batch; users are
likely to need something similar but highly customized.
"""
import topo
from topo.command.analysis import save_plotgroup
from topo.base.projection import ProjectionSheet
from topo.sheet import GeneratorSheet
exec "from topo.analysis.vision import analyze_complexity" in __main__.__dict__
from param import normalize_path
topo.sim["V1Simple"].measure_maps = True
topo.sim["V1Complex"].measure_maps = True
topo.sim["V2"].measure_maps = True
topo.sim["V2"].in_connections[0].strength=4
save_plotgroup("Orientation Preference and Complexity")
# Plot all projections for all measured_sheets
measured_sheets = [s for s in topo.sim.objects(ProjectionSheet).values()
if hasattr(s,'measure_maps') and s.measure_maps]
for s in measured_sheets:
for p in s.projections().values():
save_plotgroup("Projection",projection=p)
save_plotgroup("Activity")
# topo.sim["V1Simple"].measure_maps = False
# topo.sim["V1Complex"].measure_maps = False
save_plotgroup("Corner OR Preference")
from topo.command import save_snapshot
# save_snapshot(normalize_path('snapshot.typ'))
activity_history=numpy.array([])
def rf_analysis():
import topo
import pylab
import topo.analysis.vision
import contrib.jacommands
from topo.command.analysis import save_plotgroup
from topo.base.projection import ProjectionSheet
from topo.sheet import GeneratorSheet
from topo.command.analysis import measure_or_tuning_fullfield, measure_or_pref
from topo.command.pylabplot import cyclic_tuning_curve
from param import normalize_path
if(float(topo.sim.time()) <=20010):
save_plotgroup("Orientation Preference")
save_plotgroup("Activity")
# Plot all projections for all measured_sheets
measured_sheets = [s for s in topo.sim.objects(ProjectionSheet).values()
if hasattr(s,'measure_maps') and s.measure_maps]
for s in measured_sheets:
for p in s.projections().values():
save_plotgroup("Projection",projection=p)
prefix="WithGC"
measure_or_tuning_fullfield()
s=topo.sim["V1"]
cyclic_tuning_curve(filename_suffix=prefix,filename="OrientationTC:V1:[0,0]",sheet=s,coords=[(0,0)],x_axis="orientation")
cyclic_tuning_curve(filename_suffix=prefix,filename="OrientationTC:V1:[0.1,0.1]",sheet=s,coords=[(0.1,0.1)],x_axis="orientation")
cyclic_tuning_curve(filename_suffix=prefix,filename="OrientationTC:V1:[-0.1,-0.1]",sheet=s,coords=[(-0.1,-0.1)],x_axis="orientation")
cyclic_tuning_curve(filename_suffix=prefix,filename="OrientationTC:V1:[0.1,-0.1]",sheet=s,coords=[(0.1,-0.1)],x_axis="orientation")
cyclic_tuning_curve(filename_suffix=prefix,filename="OrientationTC:V1:[-0.1,0.1]",sheet=s,coords=[(-0.1,0.1)],x_axis="orientation")
else:
topo.command.activity_history = numpy.concatenate((contrib.jacommands.activity_history,topo.sim["V1"].activity.flatten()),axis=1)
if(float(topo.sim.time()) == 20000):
topo.sim["V1"].plastic=False
contrib.jacommands.homeostatic_analysis_function()
if(float(topo.sim.time()) == 20001):
pylab.figure()
def gc_homeo_af():
import contrib.jsldefs
import topo.command.pylabplot
import contrib.jacommands
from topo.command.analysis import save_plotgroup
from topo.analysis.featureresponses import FeatureResponses , PatternPresenter, FeatureMaps
#FeatureResponses.repetitions=10
FeatureMaps.selectivity_multiplier=20
PatternPresenter.duration=0.2
PatternPresenter.apply_output_fns=False
import topo.command.pylabplot
reload(topo.command.pylabplot)
on = topo.sim["LGNOn"].in_connections[0].strength
off = topo.sim["LGNOff"].in_connections[0].strength
if __main__.__dict__.get("GC",False):
topo.sim["LGNOn"].in_connections[0].strength=0
topo.sim["LGNOff"].in_connections[0].strength=0
contrib.jsldefs.homeostatic_analysis_function()
topo.command.pylabplot.fftplot(topo.sim["V1"].sheet_views["OrientationPreference"].view()[0],filename="V1ORMAPFFT")
from topo.misc.filepath import normalize_path, application_path
from scipy.io import write_array
import numpy
write_array(normalize_path(str(topo.sim.time())+"orprefmap.txt"), topo.sim["V1"].sheet_views["OrientationPreference"].view()[0])
write_array(normalize_path(str(topo.sim.time())+"orselmap.txt"), topo.sim["V1"].sheet_views["OrientationSelectivity"].view()[0])
topo.sim["LGNOn"].in_connections[0].strength = on
topo.sim["LGNOff"].in_connections[0].strength = off
print float(topo.sim.time())
if(float(topo.sim.time()) > 19002.0):
#topo.sim["V1"].output_fns[2].scale=0.0
save_plotgroup("Position Preference")
PatternPresenter.duration=1.0
PatternPresenter.apply_output_fns=True
import topo.command.pylabplot
reload(topo.command.pylabplot)
topo.command.pylabplot.measure_or_tuning_fullfield.instance(sheet=topo.sim["V1"],repetitions=10)(repetitions=10)
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0,0]",sheet=topo.sim["V1"],coords=[(0,0)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0,0]",sheet=topo.sim["V1"],coords=[(0.1,0)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0,0]",sheet=topo.sim["V1"],coords=[(0.1,0.1)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0,0]",sheet=topo.sim["V1"],coords=[(0,0.1)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0.1,0.1]",sheet=topo.sim["V1"],coords=[(0.1,0.1)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0.1,-0.1]",sheet=topo.sim["V1"],coords=[(0.1,-0.1)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[-0.1,0.1]",sheet=topo.sim["V1"],coords=[(-0.1,0.1)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[-0.1,-0.1]",sheet=topo.sim["V1"],coords=[(-0.1,-0.1)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0.2,0.2]",sheet=topo.sim["V1"],coords=[(0.2,0.2)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0.2,-0.2]",sheet=topo.sim["V1"],coords=[(0.2,-0.2)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[-0.2,0.2]",sheet=topo.sim["V1"],coords=[(-0.2,0.2)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[-0.2,-0.2]",sheet=topo.sim["V1"],coords=[(-0.2,-0.2)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0,0.1]",sheet=topo.sim["V1"],coords=[(0.0,0.1)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0,-0.1]",sheet=topo.sim["V1"],coords=[(0.0,-0.1)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[-0.1,0]",sheet=topo.sim["V1"],coords=[(-0.1,0.0)])()
topo.command.pylabplot.cyclic_tuning_curve.instance(x_axis="orientation",filename="ORTC[0.1,0]",sheet=topo.sim["V1"],coords=[(0.1,-0.0)])()
if(float(topo.sim.time()) > 20000.0):
topo.sim["V1"].output_fns[1].plastic=False
contrib.jacommands.measure_histogram(iterations=1000)
def saver_function():
from topo.command import save_snapshot
save_snapshot(normalize_path('snapshot.typ'))
def empty():
a = 1
def sa():
import topo
from topo.command.analysis import save_plotgroup
from param import normalize_path
import contrib.jacommands
import contrib.surround_analysis_new_cleaned
from topo.analysis.featureresponses import SinusoidalMeasureResponseCommand,FeatureCurveCommand
reload(contrib.surround_analysis_new_cleaned)
s = normalize_path.prefix
exec "from topo.analysis.vision import analyze_complexity" in __main__.__dict__
from topo.analysis.featureresponses import FeatureResponses , PatternPresenter, FeatureMaps
PatternPresenter.duration=4.0
normalize_path.prefix = s
SinusoidalMeasureResponseCommand.scale=__main__.__dict__.get("analysis_scale",1.0)
SinusoidalMeasureResponseCommand.frequencies=[2.4]
if __main__.__dict__.get("Max",False):
from topo.misc.distribution import DSF_MaxValue
preference_fn=DSF_MaxValue(value_scale=(0., 1./numpy.pi),selectivity_scale=(0.,17.0))
topo.command.pylabplot.measure_or_tuning_fullfield.instance(sheet=topo.sim["V1Complex"],preference_fn=preference_fn)()
else:
save_plotgroup("Orientation Preference and Complexity")
contrib.surround_analysis_new_cleaned.surround_analysis("V1Complex").run_lhi_informed_analysis(max_curves=__main__.__dict__.get("max_curves",20),center_size=__main__.__dict__.get("center_size",20),index=__main__.__dict__.get("index",0))
#contrib.surround_analysis_new_cleaned.surround_analysis("V1Complex").analyse([__main__.__dict__.get("coords",(0,0))],__main__.__dict__.get("number_sizes",15),absolute=False)