def write_pajek_network_topology(dirname): """ Create .net file with locations and connections between HVC-RA and HVC-I neurons """ file_RA_xy = os.path.join(dirname, "RA_xy.bin") file_I_xy = os.path.join(dirname, "I_xy.bin") RA2I = os.path.join(dirname, "RA_I_connections.bin") I2RA = os.path.join(dirname, "I_RA_connections.bin") file_training = os.path.join(dirname, "training_neurons_clustered.bin") file_pajek = os.path.join(dirname, "network_topology_clustered.net") (N_RA, RA_targets, RA_targets_G, _, _) = reading.read_connections(RA2I) (N_I, I_targets, I_targets_G, _, _) = reading.read_connections(I2RA) coord_RA = reading.read_coordinates(file_RA_xy) coord_I = reading.read_coordinates(file_I_xy) #print targets_ID #print targets_G if file_training: training_neurons = reading.read_training_neurons(file_training) else: training_neurons = [] print "Training neurons: ", training_neurons with open(file_pajek, 'w') as f: f.write("*Vertices {0}\n".format(N_RA + N_I)) for i in range(N_RA): if i in training_neurons: f.write('{0} "{1}" {2} {3} {4} ic Green\n'.format( i + 1, i, coord_RA[i][0], coord_RA[i][1], coord_RA[i][2])) else: f.write('{0} "{1}" {2} {3} {4} ic Yellow\n'.format( i + 1, i, coord_RA[i][0], coord_RA[i][1], coord_RA[i][2])) for i in range(N_RA, N_RA + N_I): f.write('{0} "{1}" {2} {3} {4} ic Red\n'.format( i + 1, i, coord_I[i - N_RA][0], coord_I[i - N_RA][1], coord_I[i - N_RA][2])) f.write("*Arcs\n".format(N_RA)) # write targets of HVC(RA) neurons for i, targets in enumerate(RA_targets): for j, target in enumerate(targets): f.write('{0} {1} {2} c Green\n'.format(i + 1, N_RA + target + 1, RA_targets_G[i][j])) # write targets of HVC(I) neurons for i, targets in enumerate(I_targets): for j, target in enumerate(targets): f.write('{0} {1} {2} c Red\n'.format(N_RA + i + 1, target + 1, I_targets_G[i][j]))
def get_bursts_of_chain_neurons(mean_burst_time, std_burst_time, firing_robustness, num_soma_spikes, num_dend_spikes, filename): """ Extracts burst information for neurons in the chain """ (N_RA, RA_super_targets, RA_super_targets_G) = reading.read_connections(filename) # select neurons connected by supersynapses superTargets = set( [element for sublist in RA_super_targets for element in sublist]) superSources = set([ i for i in xrange(len(RA_super_targets)) if len(RA_super_targets[i]) > 0 ]) stronglyConnected = superTargets | superSources num_soma_spikes_stronglyConnected = [] num_dend_spikes_stronglyConnected = [] mean_burst_time_stronglyConnected = [] std_burst_time_stronglyConnected = [] firing_robustness_stronglyConnected = [] id_stronglyConnected = [] id_stronglyConnectedNotFired = [] for i in xrange(N_RA): if i in stronglyConnected: if mean_burst_time[i] != -1: id_stronglyConnected.append(i) firing_robustness_stronglyConnected.append( firing_robustness[i]) mean_burst_time_stronglyConnected.append( mean_burst_time[i] - CURRENT_INJECTION_TIME) std_burst_time_stronglyConnected.append(std_burst_time[i]) num_soma_spikes_stronglyConnected.append(num_soma_spikes[i]) num_dend_spikes_stronglyConnected.append(num_dend_spikes[i]) else: id_stronglyConnectedNotFired.append(i) min_burst_time = min(mean_burst_time_stronglyConnected) mean_burst_time_stronglyConnected[:] = [ x - min_burst_time for x in mean_burst_time_stronglyConnected ] mean_burst_time_stronglyConnected, id_stronglyConnected, firing_robustness_stronglyConnected, \ std_burst_time_stronglyConnected, num_soma_spikes_stronglyConnected, \ num_dend_spikes_stronglyConnected = \ zip(*sorted(zip(mean_burst_time_stronglyConnected, id_stronglyConnected, \ firing_robustness_stronglyConnected, std_burst_time_stronglyConnected, num_soma_spikes_stronglyConnected, \ num_dend_spikes_stronglyConnected))) return mean_burst_time_stronglyConnected, id_stronglyConnected, firing_robustness_stronglyConnected, \ std_burst_time_stronglyConnected, num_soma_spikes_stronglyConnected, \ num_dend_spikes_stronglyConnected
def get_statistics_of_grown_conn(arrangement, dirname): """ Get mean and std of grown connections between HVC(RA) neurons Input: arrangement: spatial arrangement of neurons: "square", "sphere", "cube" dirname: directory with data """ latest_checkpoint = find_latest_checkpoint(dirname) print "latest_checkpoint for directory {0} = {1}".format( dirname, latest_checkpoint) RARA = os.path.join( dirname, "RA_RA_super_connections_" + str(latest_checkpoint) + "_.bin") RA_xy = os.path.join(dirname, "RA_xy_" + str(latest_checkpoint) + "_.bin") I2RA = os.path.join(dirname, "I_RA_connections_" + str(latest_checkpoint) + "_.bin") (N_I, _, I_targets_G) = reading.read_connections(I2RA) Gie = -1.0 for i in xrange(N_I): if len(I_targets_G[i]) > 0: Gie = I_targets_G[i][0] break coord = reading.read_coordinates(space.num_coordinates[arrangement], RA_xy) # coordinates of HVC(RA) neurons dist_RA2RA = [] # array with distances between supersynapses (N_RA, RA_super_targets, _) = reading.read_connections(RARA) for i in xrange(N_RA): if len(RA_super_targets[i]) > 0: for target_ind in RA_super_targets[i]: dist_RA2RA.append(space.distance_function[arrangement]( coord[i], coord[target_ind])) #mean = np.mean(dist_RA2RA) #std = np.std(dist_RA2RA) return dist_RA2RA, Gie
def get_fraction_chain_neurons(dirname): """ Get fraction of storngly connected neurons in the chain """ RARA = os.path.join(dirname, "RA_RA_super_connections.bin") strongly_connected = set() (N_RA, RA_super_targets, _) = reading.read_connections(RARA) for i in xrange(N_RA): if len(RA_super_targets[i]) > 0: strongly_connected.update(RA_super_targets[i]) return len(strongly_connected) / float(N_RA)
def get_spike_times_strongly_connected(self): """ Returns spike times ordered sequence of strongly connected neurons """ # update file modification time self.mod_time_super = os.path.getmtime(self.file_super) # read supersynapses from file (unused, RA_super_targets, unused) = read.read_connections(self.file_super) # extract strongly connected neurons superTargets = set( [element for sublist in RA_super_targets for element in sublist]) superSources = set([ i for i in xrange(len(RA_super_targets)) if len(RA_super_targets[i]) > 0 ]) stronglyConnected = superTargets | superSources self.fired_dend_id_strongly_connected = [ i for i in self.fired_dend_id if i in stronglyConnected ] self.spike_times_dend_strongly_connected = [ t for ind, t in enumerate(self.spike_times_dend) if self.fired_dend_id[ind] in stronglyConnected ] self.fired_soma_id_strongly_connected = [ i for i in self.fired_soma_id if i in stronglyConnected ] self.spike_times_soma_strongly_connected = [ t for ind, t in enumerate(self.spike_times_soma) if self.fired_soma_id[ind] in stronglyConnected ] self.order_strongly_connected_fired()
######### coordinates ############## coordBefore = reading.read_coordinates(fileCoordBefore) coordAfter = reading.read_coordinates(fileCoordAfter) ######### active synapses ############## (_, _, active_synapses_before) = reading.read_synapses(fileActiveBefore) (_, _, active_synapses_after) = reading.read_synapses(fileActiveAfter) ######### super synapses ############### (_, _, super_synapses_before) = reading.read_synapses(fileSuperBefore) (_, _, super_synapses_after) = reading.read_synapses(fileSuperAfter) ############# HVC-RA -> HVC-I connections ############# (_, targets_id_RA2I_before, weights_RA2I_before, \ syn_lengths_RA2I_before, axonal_delays_RA2I_before) = reading.read_connections(fileRA2IBefore) (_, targets_id_RA2I_after, weights_RA2I_after, \ syn_lengths_RA2I_after, axonal_delays_RA2I_after) = reading.read_connections(fileRA2IAfter) ############# HVC-I -> HVC-RA connections ############# (_, targets_id_I2RA_before, weights_I2RA_before, \ syn_lengths_I2RA_before, axonal_delays_I2RA_before) = reading.read_connections(fileI2RABefore) (_, targets_id_I2RA_after, weights_I2RA_after, \ syn_lengths_I2RA_after, axonal_delays_I2RA_after) = reading.read_connections(fileI2RAAfter) ############ HVC-RA -> HVC-RA connections ############# (_, _, weights_before) = reading.read_weights(fileWeightsBefore) (_, _, weights_after) = reading.read_weights(fileWeightsAfter)
if np.logical_and.reduce(coord_equal[i]) == False: replacement_correct = False print "Coordinates changed for neuron {0} that was not replaced".format(i) break else: if np.logical_and.reduce(coord_equal[i]) == True: replacement_correct = False print "Coordinates didn't change for neuron {0} that was replaced".format(i) break print "Coordinate replacement went correctly: ",replacement_correct ######################################### # Check HVC(RA) -> HVC(I) connections replacement ######################################### (N_RA, targets_RAI_ID_before, targets_RAI_G_before) = reading.read_connections(filename_RAI_before) (_, targets_RAI_ID_after, targets_RAI_G_after) = reading.read_connections(filename_RAI_after) replacement_correct = True for i in range(N_RA): if i in not_replaced: if targets_RAI_ID_before[i] != targets_RAI_ID_after[i]: replacement_correct = False print "Connections to HVC(I) neurons changed for neuron {0} that was not replaced".format(i) break else: if targets_RAI_ID_before[i] == targets_RAI_ID_after[i]: replacement_correct = False print "Connections to HVC(I) neurons didn't change for neuron {0} that was replaced".format(i) break
mean = np.mean(x) sum = 0 for e in x: sum += (e - mean)**2 return math.sqrt(sum / len(x)) (x_I, y_I) = reading.read_coordinates(I_xy) (x_RA, y_RA) = reading.read_coordinates(RA_xy) #print "(x_I, y_I):", zip(x_I, y_I) #print "(x_RA, y_RA):", zip(x_RA, y_RA) (N_RA, RA_targets, RA_targets_G) = reading.read_connections(RA2I) (N_I, I_targets, I_targets_G) = reading.read_connections(I2RA) num_targetsRAI = [len(t) for t in RA_targets] num_targetsIRA = [len(t) for t in I_targets] targetsRAI = [t for sublist in RA_targets for t in sublist] targetsIRA = [t for sublist in I_targets for t in sublist] # for each neuron calculate how number of its indirect links via interneurons decays with distance #print RA_targets #print I_targets distances = [] nIinputs = []
ax1 = f.add_subplot(211) ax1.plot(trial_number, num_active_synapses) ax1.set_ylabel("# active synapses") ax2 = f.add_subplot(212) ax2.plot(trial_number, num_supersynapses) ax2.set_xlabel("Time (# trials)") ax2.set_ylabel("# supersynapses") ############################################## # plot weight distributions ############################################## (_, _, weights_RA2RA) = reading.read_weights( os.path.join(dataDir, "weights_" + str(trial) + ".bin")) (_, targets_ID, weights_RA2I, syn_lengths, axonal_delays) = reading.read_connections( os.path.join(dataDir, "RA_I_connections_" + str(trial) + ".bin")) (_, targets_ID, weights_I2RA, syn_lengths, axonal_delays) = reading.read_connections( os.path.join(dataDir, "I_RA_connections_" + str(trial) + ".bin")) f = plt.figure() ax1 = f.add_subplot(131) ax1.hist([w / A_D for weights in weights_RA2RA for w in weights], bins=50) ax1.set_ylabel("Counts") ax1.set_xlabel("Synaptic weight HVC-RA -> HVC-RA") ax1.set_yscale('log') ax2 = f.add_subplot(132) ax2.hist([w for weights in weights_RA2I for w in weights], bins=50) ax2.set_ylabel("Counts")
def update(self): (self.N_RA, w) = read.read_weights(self.file_weights) self.mod_time_RA_RA = os.path.getmtime(filenameRA_RA) self.mod_time_wgh = os.path.getmtime(self.file_weights) self.mod_time_time = os.path.getmtime(self.file_time_soma) self.weights = [item for sublist in w for item in sublist] for i in range(len(self.weights)): if self.weights[i] < sys.float_info.epsilon: self.weights[i] = 0 self.hist, self.bin_edges = np.histogram(self.weights, bins=100) # update mean and std dependences on time sigma = std(self.weights) mu = mean(self.weights) self.mean.append(mu) self.std.append(sigma) # update time pattern of spikes self.trial_number, simulation_time, spike_times_dend, neuronID_dend = read.read_time_info( self.file_time_dend) unused, unused, spike_times_soma, neuronID_soma = read.read_time_info( self.file_time_soma) (unused, RA_super_targets, unused) = read.read_connections(filenameRA_RA_super) # extract strongly connected neurons superTargets = set( [element for sublist in RA_super_targets for element in sublist]) superSources = set([ i for i in xrange(len(RA_super_targets)) if len(RA_super_targets[i]) > 0 ]) stronglyConnected = superTargets | superSources self.time.append(simulation_time / 1000) self.spike_times_soma = [ item for sublist in spike_times_soma for item in sublist ] self.ID_soma = [item for sublist in neuronID_soma for item in sublist] self.spike_times_dend = [ item for sublist in spike_times_dend for item in sublist ] self.ID_dend = [item for sublist in neuronID_dend for item in sublist] # check that spike times are in range if len(self.spike_times_soma) > 1: if min(self.spike_times_soma) < 0: print "Somatic spike time is negative! Min somatic spike = ", min( self.spike_times_soma) if max(self.spike_times_soma) > TRIAL_DURATION: print "Somatic spike time exceeds trial duration!" if len(self.spike_times_dend) > 1: if min(self.spike_times_dend) < 0: print "Dendritic spike time is negative! Min dendritic spike = ", min( self.spike_times_dend) if max(self.spike_times_dend) > TRIAL_DURATION: print "Dendritic spike time exceeds trial duration!" # extract only spikes of strongly connected neurons self.ID_soma_strong = [ i for i in self.ID_soma if i in stronglyConnected ] self.spike_times_soma_strong = [ t for ind, t in enumerate(self.spike_times_soma) if self.ID_soma[ind] in stronglyConnected ] self.ID_dend_strong = [ i for i in self.ID_dend if i in stronglyConnected ] self.spike_times_dend_strong = [ t for ind, t in enumerate(self.spike_times_dend) if self.ID_dend[ind] in stronglyConnected ] self.order_dend() self.order_soma() #ID = range(self.N_RA) #self.spike_times = sorted(spike_times) #temp = sorted(zip(ID, spike_times), key=lambda par:par[1]) #self.ID, self.spike_times = zip(*temp) (unused, self.edges, self.active_weights) = read.get_RA2RA_graph(filenameRA_RA) active_synapses = len(self.active_weights) #print active_synapses #print self.active_weights supersynapses = sum(1 for w in self.active_weights if w > SUPERSYNAPSE_THRESHOLD) #print supersynapses self.active_synapses.append(active_synapses) self.supersynapses.append(supersynapses) #self.weights = map(lambda x: x*10, self.weights) # create new empty graph self.G_temp = nx.DiGraph() self.G_temp.add_nodes_from( self.G.nodes(data=True)) # read nodes from the previous graph self.G = self.G_temp for i in range(len(self.edges)): self.G.add_edge(self.edges[i][0], self.edges[i][1], weight=self.active_weights[i]) self.edgewidth = [d['weight'] for (u, v, d) in self.G.edges(data=True)] self.update_edge_color()
dirname = "/home/eugene/results/noDelays/replacement/sphere/180717_lionx_4/" arrangement = "sphere" dim = space.num_coordinates[arrangement] #dirname = "/home/eugene/Output/networks/140717_huxley/" trial_number = 21000 file_xy = os.path.join(dirname, "RA_xy_" + str(trial_number) + "_.bin") file_super = os.path.join(dirname, "RA_RA_super_connections_" + str(trial_number) + "_.bin") #file_training = None file_training = os.path.join(dirname, "training_neurons.bin") file_pajek = os.path.join(dirname, "super_" + str(trial_number) + "_.net") (N_RA, targets_ID, targets_G) = reading.read_connections(file_super) coord = reading.read_coordinates(dim, file_xy) #print targets_ID #print targets_G if file_training: training_neurons = reading.read_training_neurons(file_training) else: training_neurons = [] print "Training neurons: ",training_neurons with open(file_pajek, 'w') as f: f.write("*Vertices {0}\n".format(N_RA)) if dim == 2:
from collections import Counter import utils import numpy as np trial_number = 0 dirname = "/home/eugene/Output/networks/chainGrowth/testGrowthDelays6/" fileRA2I = os.path.join(dirname, "RA_I_connections_" + str(trial_number) + ".bin") fileI2RA = os.path.join(dirname, "I_RA_connections_" + str(trial_number) + ".bin") fileTraining = os.path.join(dirname, "training_neurons.bin") (N_RA, targets_id_RA2I, weights_RA2I, _, _) = reading.read_connections(fileRA2I) (N_I, targets_id_I2RA, weights_I2RA, _, _) = reading.read_connections(fileI2RA) training_neurons = reading.read_training_neurons(fileTraining) utils.find_inhibitory_effect_of_hvcra(training_neurons, targets_id_RA2I, weights_RA2I, targets_id_I2RA, weights_I2RA) ### Compare with number of inputs from all interneurons ### pool_neurons = range(N_RA) interneurons = range(N_I) pool_neurons_sorted, num_inhibitory_inputs, input_inhibitory_weight = \ utils.find_convergence_of_inhibitory_input(interneurons, pool_neurons, targets_id_I2RA, weights_I2RA)
nbins = int((xmax - xmin) / bin_size) bin_centers = [xmin + i * bin_size for i in range(nbins)] hist = np.zeros(nbins, np.int32) for x in a: ind = int((x - xmin) / bin_size) hist[ind] += 1 return bin_centers, hist (N_RA, targets_id_RA2I, _, syn_lengths_RA2I, _) = reading.read_connections(file_RA2I) #(_, targets_id_RA2RA, _, syn_lengths_RA2RA, _) = reading.read_connections(file_RA2RA) (N_I, targets_id_I2RA, _, syn_lengths_I2RA, _) = reading.read_connections(file_I2RA) print N_RA, N_I ############################################# ### Calculate fraction of connected targets ############################################# fractions = [] for targets in targets_id_RA2I: # check that each connection is unique if len(set(targets)) != len(targets): print "Several connections between HVC-RA and HVC-I neurons exist!"
# -*- coding: utf-8 -*- """ Created on Mon Feb 6 16:44:37 2017 @author: jingroup Script reads supersynapses from file """ import reading filename_super = "/home/eugene/Output/networks/gabaMaturation130317/RA_RA_super_connections_17900_.bin" filename_active = "/home/eugene/Output/networks//gabaMaturation130317/RA_RA_active_connections.bin" (N_RA, targets_ID_super, targets_G_super) = reading.read_connections(filename_super) print N_RA print targets_ID_super print "\nSupersynapses:\n" strongly_connected = set() for i in range(len(targets_ID_super)): if len(targets_ID_super[i]) > 0: strongly_connected.add(i) for j in range(len(targets_ID_super[i])): print "Supersynapse {0} -> {1}".format(i, targets_ID_super[i][j]) strongly_connected.add(targets_ID_super[i][j]) print "Strongly connected neurons: ", strongly_connected
def compare_inhibitory_weights(dataDir, outFigureDir, simName, trial): """ Compare inhibitory inputs to network and pool neurons """ N_RA, N_I = reading.read_num_neurons( os.path.join(dataDir, "num_neurons.bin")) training_neurons = reading.read_training_neurons( os.path.join(dataDir, "training_neurons.bin")) N_TR = len(training_neurons) _, numTestTrials, \ probability_soma_spike, average_num_soma_spikes_in_trial, mean_first_soma_spike_time, std_first_soma_spike_time,\ probability_dend_spike, average_num_dend_spikes_in_trial, mean_first_dend_spike_time, std_first_dend_spike_time = reading.read_jitter(os.path.join(testDataDir, "jitter.bin")) neuronsWithRobustDendriticSpike = np.where( probability_dend_spike >= 0.75)[0] # analyze inhibitory weights to neurons (_, targets_ID, weights_I2RA, syn_lengths, axonal_delays) = reading.read_connections( os.path.join(dataDir, "I_RA_connections_" + str(trial) + ".bin")) inhibition_weights_on_network_neurons = [] inhibition_weights_on_pool_neurons = [] total_inhibition_on_network_neurons = {} total_inhibition_on_pool_neurons = {} set_neuronsWithRobustDendriticSpike = set(neuronsWithRobustDendriticSpike) for i in range(N_I): for j, target in enumerate(targets_ID[i]): if target not in training_neurons: if target in set_neuronsWithRobustDendriticSpike: if target in total_inhibition_on_network_neurons: total_inhibition_on_network_neurons[ target] += weights_I2RA[i][j] else: total_inhibition_on_network_neurons[ target] = weights_I2RA[i][j] inhibition_weights_on_network_neurons.append( weights_I2RA[i][j]) else: if target in total_inhibition_on_pool_neurons: total_inhibition_on_pool_neurons[ target] += weights_I2RA[i][j] else: total_inhibition_on_pool_neurons[ target] = weights_I2RA[i][j] inhibition_weights_on_pool_neurons.append( weights_I2RA[i][j]) totalInhId, totalInhW = total_inhibition_on_network_neurons.keys( ), total_inhibition_on_network_neurons.values() f = plt.figure() plt.scatter(mean_first_soma_spike_time[totalInhId], totalInhW) plt.xlabel('Mean first spike time (ms)') plt.ylabel('Total inhibitory input (mS/cm^2)') f.savefig(outFigureDir + simName + "_trial" + str(trial) + '_total_Ginh_vs_burstTime.png', bbox_inches='tight') plt.close(f) nbin = 20 hist_on_network, bin_edges_on_network = np.histogram( inhibition_weights_on_network_neurons, bins=nbin) hist_on_network = hist_on_network.astype(float) / float( len(neuronsWithRobustDendriticSpike) - N_TR) bin_centers_on_network = bin_edges_on_network[:-1:1] + bin_edges_on_network[ 1] - bin_edges_on_network[0] hist_on_pool, bin_edges_on_pool = np.histogram( inhibition_weights_on_pool_neurons, bins=nbin) hist_on_pool = hist_on_pool.astype(float) / float( N_RA - len(neuronsWithRobustDendriticSpike)) bin_centers_on_pool = bin_edges_on_pool[:-1:1] + bin_edges_on_pool[ 1] - bin_edges_on_pool[0] f = plt.figure() plt.xlabel('Inhibitory input weight (mS/cm^2)') plt.ylabel('# of inputs per neuron') #plt.hist( , fill=False, label='network neurons', edgecolor='r') #plt.hist(np.array(inhibition_weights_on_pool_neurons) / float(N_RA - len(neuronsWithRobustDendriticSpike) - N_TR), fill=False, label='pool neurons', edgecolor='b') plt.bar(bin_centers_on_network, hist_on_network, align='center', fill=False, edgecolor='b', width=bin_edges_on_network[1] - bin_edges_on_network[0], label='network neurons') plt.bar(bin_centers_on_pool, hist_on_pool, align='center', fill=False, edgecolor='r', width=bin_edges_on_pool[1] - bin_edges_on_pool[0], label='pool neurons') plt.legend(loc=4) f.savefig(outFigureDir + simName + "_trial" + str(trial) + '_Ginh_weights_comparison.png', bbox_inches='tight') plt.close(f) nbin = 20 hist_on_network_total, bin_edges_on_network_total = np.histogram( total_inhibition_on_network_neurons.values(), bins=nbin) hist_on_network_total = hist_on_network_total.astype(float) / float( len(neuronsWithRobustDendriticSpike) - N_TR) bin_centers_on_network_total = bin_edges_on_network_total[:-1:1] + bin_edges_on_network_total[ 1] - bin_edges_on_network_total[0] hist_on_pool_total, bin_edges_on_pool_total = np.histogram( total_inhibition_on_pool_neurons.values(), bins=nbin) hist_on_pool_total = hist_on_pool_total.astype(float) / float( N_RA - len(neuronsWithRobustDendriticSpike)) bin_centers_on_pool_total = bin_edges_on_pool_total[:-1:1] + bin_edges_on_pool_total[ 1] - bin_edges_on_pool_total[0] f = plt.figure() plt.xlabel('Total inhibitory input weight (mS/cm^2)') plt.ylabel('Norm. # of neurons') #plt.hist( , fill=False, label='network neurons', edgecolor='r') #plt.hist(np.array(inhibition_weights_on_pool_neurons) / float(N_RA - len(neuronsWithRobustDendriticSpike) - N_TR), fill=False, label='pool neurons', edgecolor='b') plt.bar(bin_centers_on_network_total, hist_on_network_total, align='center', fill=False, edgecolor='b', width=bin_edges_on_network_total[1] - bin_edges_on_network_total[0], label='network neurons') plt.bar(bin_centers_on_pool_total, hist_on_pool_total, align='center', fill=False, edgecolor='r', width=bin_edges_on_pool_total[1] - bin_edges_on_pool_total[0], label='pool neurons') plt.legend(loc=1) f.savefig(outFigureDir + simName + "_trial" + str(trial) + '_total_Ginh_comparison.png', bbox_inches='tight') plt.close(f) f = plt.figure() plt.bar([1, 2], [ np.mean(total_inhibition_on_pool_neurons.values()), np.mean(total_inhibition_on_network_neurons.values()) ], align='center', width=0.1, yerr=[ np.std(total_inhibition_on_pool_neurons.values()) / np.sqrt(float(N_RA - len(neuronsWithRobustDendriticSpike))), np.std(total_inhibition_on_network_neurons.values()) / np.sqrt(float(len(neuronsWithRobustDendriticSpike) - N_TR)) ]) plt.xticks([1, 2], ['pool', 'network']) plt.ylabel('Mean inhibitory input (mS/cm^2)') f.savefig(outFigureDir + simName + "_trial" + str(trial) + '_mean_Ginh_comparison.png', bbox_inches='tight') plt.close(f) from scipy.stats import ranksums print ranksums(total_inhibition_on_pool_neurons.values(), total_inhibition_on_network_neurons.values()) plt.show()