Changeset 340 for trunk/examples/retina/benchmark_linear.py
- Timestamp:
- 11/14/08 19:17:05 (3 years ago)
- Files:
-
- 1 modified
-
trunk/examples/retina/benchmark_linear.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/retina/benchmark_linear.py
r333 r340 16 16 import os, sys, numpy, pylab, shelve 17 17 18 N, N_exp = 1000, 6 19 t_smooth = 100. # width (in ms) of the integration window 20 from NeuroTools.parameters import ParameterSpace, ParameterRange 21 snr = 2.0 * numpy.linspace(0.1,2.0,N_exp) 22 p = ParameterSpace({'snr' : ParameterRange(list(snr))}) 23 18 24 19 25 name = sys.argv[0].split('.')[0] # name of the current script withpout the '.py' part … … 28 34 29 35 except: 30 N, N_exp = 1000, 631 t_smooth = 100. # width (in ms) of the integration window32 36 from retina import * 33 37 retina = Retina(N) 34 38 retina.params['amplitude'] = numpy.ones(retina.params['amplitude'].shape) 35 snr = retina.params['snr']* numpy.linspace(0.1,2.0,N_exp) 36 from NeuroTools.parameters import ParameterSpace 37 p = ParameterSpace({'snr' : ParameterRange(list(snr))}) 39 38 40 39 41 # calculates the dimension of the parameter space … … 65 67 results['temporal_ON'] = temporal_ON 66 68 results['temporal_OFF'] = temporal_OFF 67 results['params'] = params69 results['params'] = retina.params 68 70 69 71 pbar.finish() … … 84 86 #pylab.rcParams.update(pylab_params(fig_width_pt = 497.9/2., ratio = 1.)) 85 87 pylab.figure(1) 86 fmax = numpy.max([numpy.max(temporal_OFF[:]),numpy.max(temporal_ON[:])])88 #fmax = numpy.max([numpy.max(temporal_OFF[:]),numpy.max(temporal_ON[:])]) 87 89 88 90 pylab.subplot(211) 89 91 for i_exp in range(N_exp): 90 pylab.plot(lower_edges[:-1] + t_smooth/2, # TODO add a half bin 91 temporal_ON[i_exp])# 92 pylab.xticks( numpy.round(numpy.linspace(0, retina.params.simtime, 5),0) ) 93 pylab.ylabel('ON Firing frequency (Hz/neuron)') 94 pylab.axis([0, retina.params.simtime, 0.0, fmax]) 92 pylab.plot(lower_edges[:-1] + t_smooth/2, temporal_ON[i_exp], 93 label= '%5.2f' % p.snr._values[i_exp]) 94 pylab.xticks( numpy.round(numpy.linspace(0, params.simtime, 5),0) ) 95 pylab.ylabel('ON Firing frequency (Hz)') 96 pylab.axis([0, params.simtime, 0.0, numpy.max(temporal_ON[:])]) 97 pylab.legend(loc='upper right') 95 98 pylab.subplot(212) 96 99 for i_exp in range(N_exp): 97 pylab.plot(lower_edges[:-1] + t_smooth/2, # TODO add a half bin 98 temporal_OFF[i_exp], 99 label= 'snr= %5.3f' % p.snr._values[i_exp] ) 100 pylab.xticks( numpy.round(numpy.linspace(0, retina.params.simtime, 5),0) ) 101 pylab.ylabel('OFF Firing frequency (Hz/neuron)') 100 pylab.plot(lower_edges[:-1] + t_smooth/2, temporal_OFF[i_exp]) 101 pylab.xticks( numpy.round(numpy.linspace(0, params.simtime, 5),0) ) 102 pylab.ylabel('OFF Firing frequency (Hz)') 102 103 pylab.xlabel('time (ms)') 103 pylab.axis([0, retina.params.simtime, 0.0, fmax ]) 104 105 pylab.legend(loc='upper right') 104 pylab.axis([0, params.simtime, 0.0, numpy.max(temporal_OFF[:]) ]) 106 105 107 106
