Changeset 172 for trunk/examples/retina/benchmark_noise.py
- Timestamp:
- 05/12/08 18:49:09 (4 years ago)
- Files:
-
- 1 modified
-
trunk/examples/retina/benchmark_noise.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/retina/benchmark_noise.py
r167 r172 5 5 ================== 6 6 7 Just studying how different background noise current is integrated by the neurons on one fiber. 7 Just studying how different background noise current are integrated by the 8 neurons on the retinal fibers. 9 10 Illustrates how one many use parameters to explore one set of parameters and 11 compute a CRF function. See benchmark_linear to store time varrying values. 8 12 9 13 Laurent Perrinet, INCM, CNRS … … 13 17 """ 14 18 15 import os, datetime, numpy, shelve19 import os, sys, numpy, shelve 16 20 17 21 from NeuroTools.parameters import * … … 25 29 p.noise_std = ParameterRange(list(10.**(numpy.linspace(-.50,1.,N_exp_noise)))) 26 30 27 results = shelve.open('results/benchmark_noise') 31 import retina as model 32 33 34 retina = model.Retina(N) 35 retina.params['snr'] = 0 # no input 36 37 38 name = sys.argv[0].split('.')[0] # name of the current script withpout the '.py' part 39 results = shelve.open('results/mat-' + name) 28 40 try: 29 41 CRF = results['CRF'] 30 params = results['params'] 42 except: 31 43 32 except:33 import retina as model34 35 36 retina = model.Retina(N)37 retina.params['snr'] = 038 44 # calculates the dimension of the parameter space 39 45 results_dim, results_label = p.parameter_space_dimension_labels() 40 46 41 47 # creates results array with size of parameter space dimension 42 43 48 CRF = numpy.empty(results_dim) 44 49 45 pbar=progressbar.ProgressBar(widgets=[ "calculating", " ", progressbar.Percentage(), ' ',50 pbar=progressbar.ProgressBar(widgets=[name, " ", progressbar.Percentage(), ' ', 46 51 progressbar.Bar(), ' ', progressbar.ETA()], maxval=numpy.prod(results_dim)) 47 52 for i_exp,experiment in enumerate(p.iter_inner()): … … 56 61 pbar.update(i_exp) 57 62 63 results['CRF'] = CRF 58 64 59 60 61 results['params'] = params62 results['CRF'] = CRF63 65 pbar.finish() 64 66 … … 75 77 """ 76 78 77 78 #params = retina.params 79 N, simtime = params['N'], params['simtime'] 79 N, simtime = retina.params['N'], retina.params['simtime'] 80 80 81 81 import pylab 82 82 83 #pylab.rcParams.update(pylab_params(fig_width_pt =497.9/5, ratio = 1/1.2)) 84 pylab.figure(num = 1)#, dpi=200, facecolor='w', edgecolor='k') 85 86 #Lmargin, Rmargin, dmargin, umargin = 0.15, 0.05, 0.15, 0.05 87 #pylab.axes([Lmargin, dmargin , 1.0 - Rmargin- Lmargin,1.0-umargin-dmargin]) # [left, bottom, width, height] 83 pylab.figure(num = 1) 88 84 89 85 pylab.plot(p.noise_std._values,CRF,'go-', label='line 1', linewidth=2) 90 86 pylab.ylabel('Firing Frequency (Hz)') 91 87 pylab.xlabel('Noise amplitude') 92 #pylab.axis('tight')93 pylab.savefig('results/benchmark_noise.pdf')#, dpi=300) #94 #command = 'epstopdf "%s" "%s"'% (pdffile, psfile)95 #os.system(command)96 88 97 #TODO: make a plot showing it's the right point process with a histogram 89 pylab.savefig('results/fig-' + name + '.pdf') 90 pylab.savefig('results/fig-' + name + '.png', dpi = 300) 91
