Show
Ignore:
Timestamp:
01/14/08 16:15:03 (4 years ago)
Author:
LaurentPerrinet
Message:

adapting the retina in the examples folder to work with the new framework

Files:
1 modified

Legend:

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

    r84 r97  
    55================== 
    66 
    7 Just studying how different background noise current is integrated by IAF_SFA neurons on one fiber. 
     7Just studying how different background noise current is integrated by the neurons on one fiber. 
    88 
    99Laurent Perrinet, INCM, CNRS 
     
    1313""" 
    1414 
    15 import os, datetime, numpy, pylab 
     15import os, datetime, numpy 
    1616import retina as model 
    1717import NeuroTools.benchmark as benchmark 
     
    2929    """ 
    3030 
    31     pylab.rcParams.update(pylab_params(fig_width_pt =497.9/2., ratio = 1)) 
    32     pylab.figure(num = 1, dpi=200, facecolor='w', edgecolor='k') 
    33  
    34     Lmargin, Rmargin, dmargin, umargin = 0.15, 0.05, 0.15,  0.05 
    35     pylab.axes([Lmargin, dmargin , 1.0 - Rmargin- Lmargin,1.0-umargin-dmargin]) # [left, bottom, width, height] 
    3631 
    3732    params = benchmark.get('params') 
     
    4035    noise_std, CRF = numpy.zeros(len(experiments)), numpy.zeros(len(experiments)) 
    4136    for count, experiment in enumerate(experiments): 
    42         out_ON_DATA = benchmark.get('out',experiment)['out_ON_DATA'].as_list_id_list_time() 
     37        out_ON_DATA = benchmark.get('out',experiment)['out_ON_DATA']#.as_list_id_list_time() 
    4338        noise_std[count] = benchmark.get('experiments')[experiment]['noise_std'] 
    44         CRF[count] = len(out_ON_DATA[0]) / N / N / simtime * 1000.0 
     39        CRF[count] = out_ON_DATA.mean_rate()#[0]) / N / N / simtime * 1000.0 
    4540 
    4641 
     42    import pylab 
     43 
     44    #pylab.rcParams.update(pylab_params(fig_width_pt =497.9/5, ratio = 1/1.2)) 
     45    pylab.figure(num = 1)#, dpi=200, facecolor='w', edgecolor='k') 
     46 
     47    #Lmargin, Rmargin, dmargin, umargin = 0.15, 0.05, 0.15,  0.05 
     48    #pylab.axes([Lmargin, dmargin , 1.0 - Rmargin- Lmargin,1.0-umargin-dmargin]) # [left, bottom, width, height] 
     49 
    4750    #pylab.subplot(111) 
    48     pylab.plot(noise_std,CRF,'go') 
     51    idx_ = numpy.argsort(noise_std) # extract lines 
     52    pylab.plot(noise_std[idx_],CRF[idx_],'go-', label='line 1', linewidth=2) 
    4953    pylab.ylabel('Firing Frequency (Hz)') 
    5054    pylab.xlabel('Noise amplitude') 
    51     pylab.axis('tight') 
    52     pylab.savefig(benchmark.name + '/benchmark_noise.png')#, dpi=300) # 
     55    #pylab.axis('tight') 
     56    pylab.savefig(benchmark.filename + '/benchmark_noise.pdf')#, dpi=300) # 
    5357    #command = 'epstopdf  "%s" "%s"'% (pdffile, psfile) 
    5458    #os.system(command)