figPrefOri, axPrefOri = plt.subplots()
                axPrefOri.set_xlabel('Orientation')
                axPrefOri.set_ylabel('Number of principal components')
                axPrefOri.set_title('Orientation of eigen neurons for different components')
            axPrefOri.scatter(x, y, s=30, color='red')

            if numEigNeurons == numComps[-1]:
                now = datetime.datetime.now().strftime("%Y_%m_%d_%H_%M_%S")
                figPrefOri.savefig(plotDir+'subsetbMain_prefOri_'+now+'.pdf')

        # Fit double gaussian for each eigen neuron
        w0 = np.array([4, 50, np.pi/2, 1, 50, 3*np.pi/2, 1])
        what = np.zeros((numEigNeurons, w0.size))
        sse = np.zeros((numEigNeurons,))
        for n in xrange(numEigNeurons):
            what[n], sse[n] = fit.fitCurve(eigSpikeRate[n, :, :], w0)
        # Plot double gaussians for each eigen neuron
        if False:
            fig, ax = plt.subplots()
            for n in xrange(numEigNeurons):
                x = np.arange(0, 360, 5)
                y = fit.doubleGaussian(np.radians(x), what[n])
                ax.plot(x, y, linewidth=2, label='Neuron '+str(n))
            ax.set_title('Fitting of directional selectivity for eigen neurons')
            ax.set_xlabel(r'$\theta$')
            ax.set_ylabel('spikerate')
            now = datetime.datetime.now().strftime("%Y_%m_%d_%H_%M_%S")
            fig.savefig(plotDir+'subsetbMain_dgauss_'+now+'.pdf')

        if True:
            n = 0
Пример #2
0
    ax.grid(False)
    plt.title("Correlation heatmap thresholded c > " + str(corrThres))

    # **************** Plot response of selected cells *********
    # [7, 10, 16, 23, 28]
    # [10, 16,23, 26, 28]
    # [14, 21, 30, 40, 44, 49, 56]
    # [16, 23, 26, 28]
    # [19, 27, 30, 33, 37, 38, 44, 47, 49, 50, 56, 58]
    # [21, 25, 30, 33, 36, 37, 38, 40, 44, 49, 50, 56, 58, 63]
    # [30, 33, 36, 37, 38, 40, 41, 44, 49, 50, 56, 58, 60, 63]
    selNeurons = np.array([30, 33, 36, 37, 38, 40, 41, 44, 49, 50, 56, 58, 60, 63])
    numNeurons = selNeurons.size
    w0 = np.array([4, 50, np.pi / 2, 1, 50, 3 * np.pi / 2, 1])
    what = np.zeros((numNeurons, w0.size))
    sse = np.zeros((numNeurons,))
    for n in xrange(numNeurons):
        what[n], sse[n] = fit.fitCurve(spikeRate[selNeurons[n], :, :], w0)
    fig, ax = plt.subplots()
    for n in xrange(numNeurons):
        x = np.arange(0, 360, 5)
        y = fit.doubleGaussian(np.radians(x), what[n])
        ax.plot(x, y, linewidth=3, label="Fitted curve of neuron " + str(selNeurons[n]))

    ax.legend(loc="upper right")
    ax.set_title("Response curves of neurons showed high correlation (>0.7) ")
    ax.set_xlabel(r"$\theta$")
    ax.set_ylabel("spikerate")
    plt.text(1, 1, "Neurons " + str(selNeurons) + " are tuned similarly, as their preferred orientation is same")
    plt.show()