Ejemplo n.º 1
0
    # creates results array with size of parameter space dimension
    data = retina.run(retina.params,verbose=False)
    lower_edges = data['out_ON_DATA'].time_axis(t_smooth)
    N_smooth = len(lower_edges)
    
    temporal_ON, temporal_OFF = [],[]
    import progressbar # see http://projects.scipy.org/pipermail/scipy-dev/2008-January/008200.html
    pbar=progressbar.ProgressBar(widgets=[name, " ", progressbar.Percentage(), ' ',
            progressbar.Bar(), ' ', progressbar.ETA()], maxval=N_exp)
    for i_exp,experiment in enumerate(p.iter_inner()):
        params = retina.params
        params.update(experiment) # updates what changed in the dictionary
        # simulate the experiment and get its data
        data = retina.run(params,verbose=False)
        # calculating the index in the parameter space
        index = p.parameter_space_index(experiment)
        # put the data at the right position in the results array
        temporal_ON.append(sum(data['out_ON_DATA'].firing_rate(t_smooth))/N)#
        temporal_OFF.append(sum(data['out_OFF_DATA'].firing_rate(t_smooth))/N)#
        pbar.update(i_exp)

    
    results['lower_edges'] = lower_edges
    results['temporal_ON'] = temporal_ON
    results['temporal_OFF'] = temporal_OFF
    results['params'] = retina.params

    pbar.finish()

results.close()
Ejemplo n.º 2
0
                         st2.time_histogram(time_bin=1.),
                         mode='same')
    corrcoef = numpy.corrcoef(st1.time_histogram(time_bin=1.0),
                              st2.time_histogram(time_bin=1.))
    time_axis_cc = numpy.linspace(-cc.shape[0] / 2., cc.shape[0] / 2.,
                                  cc.shape[0])
    return cc, time_axis_cc, corrcoef[0][1]


# creating a results array, with the dimensions of the ParameterSpace
corrcoef_results = numpy.empty(dims)

# scanning the ParameterSpace
for experiment in p.iter_inner():
    # calculation of the index in the space
    index = p.parameter_space_index(experiment)
    # perfomring the experiment
    cc, time_axis_cc, corrcoef = calc_cc(experiment)
    corrcoef_results[index] = corrcoef
    # plotting the cc's
    subplot_index = (dims[1] * index[0]) + index[1]
    pylab.subplot(dims[0], dims[1], subplot_index + 1)
    pylab.plot(time_axis_cc, cc)
    pylab.title(make_name(experiment, p.range_keys()))
    pylab.xlim(-30, 30.)
    pylab.ylim(0, 10.)

# plot the results
pylab.matshow(corrcoef_results)
pylab.xticks(numpy.arange(0.5, dims[1] + 0.5, 1.0),
             [str(i) for i in p.jitter._values])