def show_results(result):
    """
    visualizes the result of the parameter search.
    Parameters:
    result - list of result dictionaries.
    """
    import numpy
    rates = numpy.sort([r['source_rate'] for r in result])
    weights = numpy.sort([r['weight'] for r in result])
    neuron_rates = numpy.zeros((len(rates), len(weights)))
    for r_i in range(len(rates)):
        for w_i in range(len(weights)):
            neuron_rates[r_i, w_i] = [r['neuron_rate'] for r in result 
                                      if (r['source_rate'] == rates[r_i])
                                      and (r['weight'] == weights[w_i])][0]
    import NeuroTools.plotting as plotting
    pylab = plotting.get_display(True)
    pylab.rcParams.update(plotting.pylab_params())
    subplot = pylab.imshow(neuron_rates, 
                           interpolation = 'nearest',  
                           origin = 'lower')
    plotting.set_labels(subplot.get_axes(), 
                        xlabel = 'rate',  
                        ylabel = 'weight')
    pylab.colorbar()
    # could add fancy xticks and yticks here
    import tempfile, os
    (fd,  figfilename) = tempfile.mkstemp(prefix = 'parameter_search_result', 
                                          suffix = '.png', 
                                          dir = os.getcwd())
    pylab.gcf().savefig(figfilename)
Ejemplo n.º 2
0
def show_results(result):
    """
    visualizes the result of the parameter search.
    Parameters:
    result - list of result dictionaries.
    """
    import numpy
    t_smooth = 100.  # ms.  integration time to show fiber activity
    snrs = numpy.sort([r['snr'] for r in result])
    neuron_rates = numpy.zeros(len(snr))
    for snr_i in range(len(snrs)):
        neuron_rates[r_i] = [
            r['neuron_rate'] for r in result
            if (r['source_rate'] == snrs[snr_i])
        ][0]

    import NeuroTools.plotting as plotting
    pylab = plotting.get_display(True)
    pylab.rcParams.update(plotting.pylab_params())
    print rates, neuron_rates
    subplot = pylab.imshow(neuron_rates,
                           interpolation='nearest',
                           origin='lower')
    plotting.set_labels(subplot.get_axes(), xlabel='rate', ylabel='weight')
    pylab.colorbar()
    # could add fancy xticks and yticks here
    import tempfile, os
    (fd, figfilename) = tempfile.mkstemp(prefix='parameter_search_result',
                                         suffix='.png',
                                         dir=os.getcwd())
    pylab.gcf().savefig(figfilename)
Ejemplo n.º 3
0
############# MAKING FIGURE ############################
from NeuroTools.plotting import pylab_params
from numpy import zeros, where, arange

pylab.close("all")
pylab.ioff()  # pylab.ion() #

""" Figure

Prints to a figure the mean firing rate
* in (x,y) accross time during the stimulation and
* in t accross positions within the center
for the output (ON and OFF) and for the different parameter values.

"""
pylab.rcParams.update(pylab_params(fig_width_pt=497.9))  # , text_fontsize=8))
pylab.figure(num=1, dpi=300, facecolor="w", edgecolor="k")

x = params["position"][0]
y = params["position"][1]
# Lmargin, Rmargin, dmargin, umargin = 0.05, 0.15, 0.05,  0.05
# pylab.axes([Lmargin, dmargin , 1.0 - Rmargin- Lmargin,1.0-umargin-dmargin]) # [left, bottom, width, height]
# pylab.subplot(131)
pylab.axes([0.1, 0.33, 0.3 / 1.61, 0.3])  # [left, bottom, width, height]
pylab.scatter(x, y, c=params["amplitude"], faceted=False)  # , edgecolors='none'
pylab.title("Input", fontsize="small")
pylab.axis("equal")
pylab.subplot(232)
pylab.plot(lower_edges[:-1], temporal_ON)
pylab.title("time course (ROI) ", fontsize="small")
# pylab.title('time course ON',fontsize = 'small')
Ejemplo n.º 4
0
############# MAKING FIGURE ############################
from NeuroTools.plotting import pylab_params
from numpy import zeros, where, arange

pylab.close('all')
pylab.ioff()  #pylab.ion() #
""" Figure

Prints to a figure the mean firing rate
* in (x,y) accross time during the stimulation and
* in t accross positions within the center
for the output (ON and OFF) and for the different parameter values.

"""
pylab.rcParams.update(pylab_params(fig_width_pt=497.9))  #, text_fontsize=8))
pylab.figure(num=1, dpi=300, facecolor='w', edgecolor='k')

x = params['position'][0]
y = params['position'][1]
#Lmargin, Rmargin, dmargin, umargin = 0.05, 0.15, 0.05,  0.05
#pylab.axes([Lmargin, dmargin , 1.0 - Rmargin- Lmargin,1.0-umargin-dmargin]) # [left, bottom, width, height]
#pylab.subplot(131)
pylab.axes([0.1, 0.33, .3 / 1.61, .3])  # [left, bottom, width, height]
pylab.scatter(x, y, c=params['amplitude'], faceted=False)  #, edgecolors='none'
pylab.title('Input', fontsize='small')
pylab.axis('equal')
pylab.subplot(232)
pylab.plot(lower_edges[:-1], temporal_ON)
pylab.title('time course (ROI) ', fontsize='small')
#pylab.title('time course ON',fontsize = 'small')