Ejemplo n.º 1
0
def analyzeStimulus(stimulusName):
    data = getData.getRawData(dataset, stimulusName)
    trials = []
    trialNum = len(data[0]) / numberOfFramesPerTrial
    for x in range(trialNum):
        trials.append(
            map(
                lambda neuron: neuron[x * numberOfFramesPerTrial:
                                      (x + 1) * numberOfFramesPerTrial], data))

    for t in range(len(trials)):
        analyzeTrial(stimulusName, trials[t], t)

Config.read(rawDataDirectory + 'analysis.config')
number_of_shuffles = int(Config.get("analysis","number_of_shuffles_for_correlation_analysis"))


def listdir_nohidden(path):
	for f in os.listdir(path):
         if not f.startswith('.'):
			if not f.endswith('p'):
				yield f


#get number of neurons
originalFiles=map(lambda x: x.rpartition('.')[0],listdir_nohidden(rawDataDirectory + 'stimuliData'))
originalData=getData.getRawData(dataset, originalFiles[0])
number_of_neurons=len(originalData)



stimuliNames = map(lambda x: x.rpartition('.')[0], listdir_nohidden(outputDirectory + 'mergedExportingN'))

#generates all of the combinations of two different neurons
neuronCombinations=list(itertools.combinations(range(number_of_neurons),2))


def getOutputData(location):
	f = open(location+'.txt', 'r')
	data=[]
	for line in f:
	    data.append(line)
Ejemplo n.º 3
0
#gets directory of raw data and where output should go
rawDataDirectory = '../datasets/' + dataset + '/'
outputDirectory = '../analyzedDatasets/' + dataset + '/'


def listdir_nohidden(path):
    for f in os.listdir(path):
        if not f.startswith('.'):
            if not f.endswith('p'):
                yield f


#CAN USE THE RAW DATA FOR RAW CORRELATION TO DISTANCE IN ANOTHER ANALYSIS
stimuliNames = map(lambda x: x.rpartition('.')[0],
                   listdir_nohidden(rawDataDirectory + 'stimuliData'))
rawData = getData.getRawData(dataset, stimuliNames[0])

#get number of neurons
number_of_neurons = len(rawData)


def getOutputData(location):
    f = open(outputDirectory + 'exportingN/' + location + '.txt', 'r')
    data = []
    for line in f:
        data.append(line)

    data = map(lambda x: map(lambda y: float(y.strip()),
                             x.strip().split(',')), data)

    return data
Ejemplo n.º 4
0
rawDataDirectory = '../datasets/' + dataset + '/'
outputDirectory = '../analyzedDatasets/' + dataset + '/'
Config = ConfigParser.ConfigParser()
Config.read(rawDataDirectory + 'analysis.config')


def listdir_nohidden(path):
    for f in os.listdir(path):
        if not f.startswith('.'):
            if not f.endswith('p'):
                yield f


analysisOptions = Config.options("analysis")

#generate list of settings
analysisSettings = map(
    lambda option: option + ":" + Config.get('analysis', option),
    analysisOptions)

#add number of neurons
files = map(lambda x: x.rpartition('.')[0],
            listdir_nohidden(rawDataDirectory + 'stimuliData'))
data = getData.getRawData(dataset, files[0])
analysisSettings.append('number_of_neurons:' + str(len(data)))

#write file
f = open(outputDirectory + "mathematicaConfig.txt", "w")
for option in analysisSettings:
    f.write(option + '\n')
f.close()