Show
Ignore:
Timestamp:
05/07/08 18:56:23 (4 years ago)
Author:
LaurentPerrinet
Message:

Code Jam #2 : retina/benchmark_noise and benchmark_linear should now work

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/examples/retina/benchmark_noise.py

    r165 r166  
    1313""" 
    1414 
    15 import os, datetime, numpy 
    16 import retina as model 
     15import os, datetime, numpy, shelve 
    1716 
    1817from NeuroTools.parameters import * 
     
    2221import progressbar # see http://projects.scipy.org/pipermail/scipy-dev/2008-January/008200.html 
    2322 
     23N, N_exp_noise = 100, 22 
    2424p = ParameterSet({}) 
    25 N, N_exp_noise = 10, 22 
    2625p.noise_std = ParameterRange(list(10.**(numpy.linspace(-.50,1.,N_exp_noise)))) 
    27 retina = model.Retina(N) 
    28 retina.params['snr'] = 0 
    2926 
    3027results = shelve.open('results/benchmark_noise') 
     
    3229    CRF = results['CRF'] 
    3330except: 
     31    import retina as model 
    3432 
     33 
     34    retina = model.Retina(N) 
     35    retina.params['snr'] = 0 
    3536    # calculates the dimension of the parameter space 
    3637    results_dim, results_label = p.parameter_space_dimension_labels() 
     
    5051        index = p.parameter_space_index(experiment) 
    5152        # put the data at the right position in the results array 
    52         CRF[index] = data.mean_rate()# 
     53        CRF[index] = data['out_ON_DATA'].mean_rate()# 
    5354        pbar.update(i_exp) 
    5455 
     
    8081#pylab.axes([Lmargin, dmargin , 1.0 - Rmargin- Lmargin,1.0-umargin-dmargin]) # [left, bottom, width, height] 
    8182 
    82 idx_ = numpy.argsort(noise_std) # extract lines 
    83 pylab.plot(noise_std[idx_],CRF[idx_],'go-', label='line 1', linewidth=2) 
     83pylab.plot(p.noise_std._values,CRF,'go-', label='line 1', linewidth=2) 
    8484pylab.ylabel('Firing Frequency (Hz)') 
    8585pylab.xlabel('Noise amplitude')