| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
""" |
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
import os, sys, numpy, shelve |
|---|
| 20 |
|
|---|
| 21 |
N, N_exp_noise = 1000, 22 |
|---|
| 22 |
from NeuroTools.parameters import * |
|---|
| 23 |
p = ParameterSpace({'noise_std' : ParameterRange(list(10.**(numpy.linspace(-.50,1.,N_exp_noise))))}) |
|---|
| 24 |
|
|---|
| 25 |
name = sys.argv[0].split('.')[0] |
|---|
| 26 |
results = shelve.open('results/mat-' + name) |
|---|
| 27 |
try: |
|---|
| 28 |
CRF = results['CRF'] |
|---|
| 29 |
except: |
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
import progressbar |
|---|
| 33 |
import retina as model |
|---|
| 34 |
retina = model.Retina(N) |
|---|
| 35 |
retina.params['snr'] = 0 |
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
results_dim, results_label = p.parameter_space_dimension_labels() |
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
CRF = numpy.empty(results_dim) |
|---|
| 42 |
|
|---|
| 43 |
pbar=progressbar.ProgressBar(widgets=[name, " ", progressbar.Percentage(), ' ', |
|---|
| 44 |
progressbar.Bar(), ' ', progressbar.ETA()], maxval=numpy.prod(results_dim)) |
|---|
| 45 |
for i_exp,experiment in enumerate(p.iter_inner()): |
|---|
| 46 |
params = retina.params |
|---|
| 47 |
params.update(experiment) |
|---|
| 48 |
|
|---|
| 49 |
data = retina.run(params,verbose=False) |
|---|
| 50 |
|
|---|
| 51 |
index = p.parameter_space_index(experiment) |
|---|
| 52 |
|
|---|
| 53 |
CRF[index] = data['out_ON_DATA'].mean_rate() |
|---|
| 54 |
pbar.update(i_exp) |
|---|
| 55 |
|
|---|
| 56 |
results['CRF'] = CRF |
|---|
| 57 |
|
|---|
| 58 |
pbar.finish() |
|---|
| 59 |
|
|---|
| 60 |
results.close() |
|---|
| 61 |
|
|---|
| 62 |
from NeuroTools.plotting import pylab_params |
|---|
| 63 |
|
|---|
| 64 |
""" Figure 1 |
|---|
| 65 |
|
|---|
| 66 |
Prints to a figure the mean firing rate for the output (ON and OFF) as a function of the different parameter values. It's similar to a CRF function. |
|---|
| 67 |
|
|---|
| 68 |
TODO put standard deviation of activity, print CV |
|---|
| 69 |
|
|---|
| 70 |
""" |
|---|
| 71 |
|
|---|
| 72 |
import pylab |
|---|
| 73 |
|
|---|
| 74 |
pylab.figure(num = 1) |
|---|
| 75 |
|
|---|
| 76 |
pylab.plot(p.noise_std._values,CRF,'go-', label='line 1', linewidth=2) |
|---|
| 77 |
pylab.ylabel('Firing Frequency (Hz)') |
|---|
| 78 |
pylab.xlabel('Noise amplitude') |
|---|
| 79 |
|
|---|
| 80 |
|
|---|
| 81 |
if 0: |
|---|
| 82 |
pylab.show() |
|---|
| 83 |
else: |
|---|
| 84 |
pylab.savefig('results/fig-' + name + '.pdf') |
|---|
| 85 |
pylab.savefig('results/fig-' + name + '.png', dpi = 300) |
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
|
|---|