'useRank': 0,  # use the rank transformed version od neural data
}

###############################################
#
# run PCA and store results
#
##############################################
#%%

print 'running PCA without rank'
for kindex, key in enumerate(keyList):
    resultDict[key]['PCA'] = dr.runPCANormal(dataSets[key], pars)

# overview of PCA results and weights
mp.plotPCAresults(dataSets, resultDict, keyList, pars, flag='PCA')
# correlate PCA with all sorts of stuff
mp.plotPCAcorrelates(dataSets, resultDict, keyList, pars, flag='PCA')
plt.show()
#  plot 3D trajectory of PCA
#
#mp.plotPCAresults3D(dataSets, resultDict, keyList, pars, col = 'phase')
#plt.show()
mp.plotPCAresults3D(dataSets, resultDict, keyList, pars, col='velocity')

mp.plotPCAresults3D(dataSets, resultDict, keyList, pars, col='turns')
#plt.show()
# save the most prominent 3 neurons for each PCA axis

pars['useRank'] = 1
print 'running PCA with rank'
예제 #2
0
#plt.show()
labelsPCA = ['GCamp6s', 'GFP', 'GCamp6s immobilized']
colorsPCA = ['#007398', 'k', '#24c8ff']
res, keys = [resultDict, resultDictCtrl,
             resultDictimm], [keyList, keyListCtrl, keyListimm]
mp.averageResultsPCA(res, keys, labelsPCA, colorsPCA, fitmethod="PCA")
plt.show()
###############################################
#
# use svm to predict discrete behaviors
#
##############################################
if svm:

    # overview of SVM results and weights
    mp.plotPCAresults(dataSets, resultDict, keyList, pars, flag='SVM')
    plt.show()
    #  plot 3D trajectory of SVM
    mp.plotPCAresults3D(dataSets,
                        resultDict,
                        keyList,
                        pars,
                        col='etho',
                        flag='SVM')
    plt.show()
#        mp.plotPCAresults3D(dataSets, resultDict, keyList, pars, col = 'time',  flag = 'SVM')
#        plt.show()
#        mp.plotPCAresults3D(dataSets, resultDict, keyList, pars, col = 'velocity',  flag = 'SVM')
#        plt.show()
#        mp.plotPCAresults3D(dataSets, resultDict, keyList, pars, col = 'turns',  flag = 'SVM')
#        plt.show()
예제 #3
0
###############################################
#
# run PCA and store results
#
##############################################
#%%
if pca:
    print 'running PCA'
    for kindex, key in enumerate(keyList):
        resultDict[key]['PCA'] = dr.runPCANormal(dataSets[key],
                                                 pars,
                                                 whichPC=0)
        # overview of data ordered by PCA
        mp.plotDataOverview2(dataSets, keyList, resultDict)
        # overview of PCA results and weights
        mp.plotPCAresults(dataSets, resultDict, keyList, pars)
        plt.show()
        mp.plotPCAresults3D(dataSets, resultDict, keyList, pars, col='time')
        plt.show()
        # color by before and after
        colorBy = np.zeros(dataSets[key]['Neurons']['Activity'].shape[1])
        colorBy[:int(dataSets[key]['Neurons']['Activity'].shape[1] / 2.)] = 1
        mp.plotPCAresults3D(dataSets,
                            resultDict,
                            keyList,
                            pars,
                            col='Immobilization',
                            colorBy=colorBy)
        plt.show()

        plt.show(block=True)
예제 #4
0
    print 'running periodogram(s)'
    for kindex, key in enumerate(keyList):
        resultDict[key]['Period'] = dr.runPeriodogram(dataSets[key],
                                                      pars,
                                                      testset=None)
###############################################
#
# use behavior triggered averaging to create non-othogonal axes
#
##############################################
if bta:
    for kindex, key in enumerate(keyList):
        print 'running BTA'
        resultDict[key]['BTA'] = dr.runBehaviorTriggeredAverage(
            dataSets[key], pars)
    mp.plotPCAresults(dataSets, resultDict, keyList, pars, flag='BTA')
    plt.show()
    mp.plotPCAresults3D(dataSets,
                        resultDict,
                        keyList,
                        pars,
                        col='etho',
                        flag='BTA')
    plt.show()
    ###############################################
#
# use svm to predict discrete behaviors
#
##############################################
if svm:
    for kindex, key in enumerate(keyList):