예제 #1
0
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]))
예제 #2
0
def write_pajek_hvcRA_coord(dirname, trial_number):
    """
    Create .net file with locations of HVC-RA neurons in array.
    Mature neurons are highlighted
    """
    file_RA_xy = os.path.join(dirname, "RA_xy_" + str(trial_number) + ".bin")

    file_training = os.path.join(dirname, "training_neurons.bin")
    file_pajek = os.path.join(dirname, "network_" + str(trial_number) + ".net")
    fileMature = os.path.join(dirname, "mature_" + str(trial_number) + ".bin")

    coord_RA = reading.read_coordinates(file_RA_xy)
    training_neurons = reading.read_training_neurons(file_training)
    (_, _, mature_indicators) = reading.read_mature_indicators(fileMature)

    mature_neurons = np.where(mature_indicators == 1)[0]
    num_neurons = coord_RA.shape[0]
    # sort array with neurons and training neurons #
    training_neurons.sort()
    mature_neurons.sort()

    with open(file_pajek, 'w') as f:
        f.write("*Vertices {0}\n".format(num_neurons))

        for i in range(num_neurons):
            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]))
            elif i in mature_neurons:
                f.write('{0} "{1}" {2} {3} {4} ic Black\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]))
예제 #3
0
def write_pajek_neurons_connected_by_supersynapses(dirname, trial_number):
    """
    Create .net file with locations and supersynaptic connections for HVC-RA neurons connected by supersynapses
    """
    file_RA_xy = os.path.join(dirname, "RA_xy_" + str(trial_number) + ".bin")

    file_training = os.path.join(dirname, "training_neurons.bin")
    file_pajek = os.path.join(dirname, "network_" + str(trial_number) + ".net")
    fileSuperSynapses = os.path.join(
        dirname, "RA_RA_super_connections_" + str(trial_number) + ".bin")
    fileWeights = os.path.join(dirname,
                               "weights_" + str(trial_number) + ".bin")

    coord_RA = reading.read_coordinates(file_RA_xy)
    training_neurons = reading.read_training_neurons(file_training)
    (N_RA, _, super_synapses) = reading.read_synapses(fileSuperSynapses)
    (N_RA, _, weights) = reading.read_weights(fileWeights)

    network_neurons = set(training_neurons)

    for i in range(N_RA):
        for target in super_synapses[i]:
            network_neurons.add(target)

    network_neurons = sorted(list(network_neurons))

    num_neurons = len(network_neurons)
    # sort array with neurons and training neurons #
    training_neurons.sort()

    with open(file_pajek, 'w') as f:
        f.write("*Vertices {0}\n".format(num_neurons))

        for i, neuron_id in enumerate(network_neurons):
            if neuron_id in training_neurons:
                f.write('{0} "{1}" {2} {3} {4} ic Green\n'.format(
                    i + 1, neuron_id, coord_RA[neuron_id][0],
                    coord_RA[neuron_id][1], coord_RA[neuron_id][2]))
            else:
                f.write('{0} "{1}" {2} {3} {4} ic Yellow\n'.format(
                    i + 1, neuron_id, coord_RA[neuron_id][0],
                    coord_RA[neuron_id][1], coord_RA[neuron_id][2]))

        f.write("*Arcs\n")

        # write targets of HVC(RA) neurons
        for i, source_id in enumerate(network_neurons):
            for target_id in super_synapses[source_id]:
                try:
                    ind = utils.index(network_neurons, target_id)
                    f.write('{0} {1} {2} c Green\n'.format(
                        i + 1, ind + 1, weights[source_id][target_id]))
                except ValueError:
                    continue
예제 #4
0
def write_pajek_neurons(dirname, trial_number):
    """
    Create .net file with locations and connections between mature HVC-RA neurons in array
    """
    file_RA_xy = os.path.join(dirname, "RA_xy_" + str(trial_number) + ".bin")

    file_training = os.path.join(dirname, "training_neurons.bin")
    file_pajek = os.path.join(dirname, "network_" + str(trial_number) + ".net")
    fileMature = os.path.join(dirname, "mature_" + str(trial_number) + ".bin")
    fileSuperSynapses = os.path.join(
        dirname, "RA_RA_super_connections_" + str(trial_number) + ".bin")
    fileWeights = os.path.join(dirname,
                               "weights_" + str(trial_number) + ".bin")

    coord_RA = reading.read_coordinates(file_RA_xy)
    training_neurons = reading.read_training_neurons(file_training)
    (N_RA, _, weights) = reading.read_weights(fileWeights)
    (_, _, mature_indicators) = reading.read_mature_indicators(fileMature)
    (_, _, super_synapses) = reading.read_synapses(fileSuperSynapses)

    mature_neurons = np.where(mature_indicators == 1)[0]
    #print list(mature_neurons)
    #mature_neurons = range(N_RA)
    num_neurons = len(mature_neurons)
    # sort array with neurons and training neurons #
    training_neurons.sort()
    mature_neurons.sort()

    with open(file_pajek, 'w') as f:
        f.write("*Vertices {0}\n".format(num_neurons))

        for i, neuron_id in enumerate(mature_neurons):
            if neuron_id in training_neurons:
                f.write('{0} "{1}" {2} {3} {4} ic Green\n'.format(
                    i + 1, neuron_id, coord_RA[neuron_id][0],
                    coord_RA[neuron_id][1], coord_RA[neuron_id][2]))
            else:
                f.write('{0} "{1}" {2} {3} {4} ic Yellow\n'.format(
                    i + 1, neuron_id, coord_RA[neuron_id][0],
                    coord_RA[neuron_id][1], coord_RA[neuron_id][2]))

        f.write("*Arcs\n".format(num_neurons))

        # write targets of HVC(RA) neurons
        for i, source_id in enumerate(mature_neurons):
            for target_id in super_synapses[source_id]:
                try:
                    ind = utils.index(mature_neurons, target_id)
                    f.write('{0} {1} {2} c Green\n'.format(
                        i + 1, ind + 1, weights[source_id][target_id]))
                except ValueError:
                    continue
예제 #5
0
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
예제 #6
0
    """ Computes distance between two points in space"""
    return math.sqrt((x1 - x2)**2 + (y1 - y2)**2)


def std(x):
    """Computes standard deviation"""
    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
예제 #7
0
trial_number = 21600

file_RA_xy = os.path.join(dirname, "RA_xy_" + str(trial_number) + "_.bin")
file_I_xy = os.path.join(dirname, "I_xy.bin")

RA2I = os.path.join(dirname, "RA_I_connections_" + str(trial_number) + "_.bin")
I2RA = os.path.join(dirname, "I_RA_connections_" + str(trial_number) + "_.bin")

file_training = os.path.join(dirname, "training_neurons.bin")
file_pajek = os.path.join(dirname, "fixed_" + str(trial_number) + "_.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(dim, file_RA_xy)
coord_I = reading.read_coordinates(dim, 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))
    
    if dim == 2:
예제 #8
0
    def __init__(self):
        self.file_weights = filename_weights
        self.file_time_dend = filename_time_dend
        self.file_time_soma = filename_time_soma

        self.std = []
        self.mean = []
        self.time = []
        self.active_synapses = []
        self.supersynapses = []

        self.mod_time_RA_RA = 0
        self.mod_time_wgh = 0
        self.mod_time_time = 0

        self.pos = {}
        self.node_color = []
        self.edgewidth = []

        (self.N_RA, self.RA2I_edges,
         self.RA2I_weights) = read.get_RA2I_graph(filenameRA_I)
        (self.N_I, self.I2RA_edges,
         self.I2RA_weights) = read.get_I2RA_graph(self.N_RA, filenameI)
        (unused, self.edges,
         self.weights) = read.get_RA2RA_graph(filenameRA_RA)

        #print self.I2RA_edges[0][0]
        #print self.edges
        #print self.RA2I_edges
        # read coordinates
        (xx_RA, yy_RA) = read.read_coordinates(filename_xy_RA)
        (xx_I, yy_I) = read.read_coordinates(filename_xy_I)

        # fill dictionary for positions of neurons

        for i in range(self.N_RA):
            self.pos[i] = (xx_RA[i], yy_RA[i])
        for i in range(self.N_I):
            self.pos[i + self.N_RA] = (xx_I[i], yy_I[i])

        # assign colors to nodes
        for i in range(self.N_RA):
            self.node_color.append("g")
        for i in range(self.N_I):
            self.node_color.append("r")

        #self.weights = map(lambda x: x*10, self.weights)

        # create bidirectional graph

        self.G = nx.DiGraph()
        self.G.add_nodes_from(self.pos.keys())

        # biderectional graph for fixed synapses
        self.G_I2RA = nx.DiGraph()
        self.G_I2RA.add_nodes_from(self.pos.keys())

        self.G_RA2I = nx.DiGraph()
        self.G_RA2I.add_nodes_from(self.pos.keys())

        self.edge_color_I2RA = []
        self.edge_color_RA2I = []

        for i in range(len(self.I2RA_edges)):
            self.G_I2RA.add_edge(self.I2RA_edges[i][0],
                                 self.I2RA_edges[i][1],
                                 weight=self.I2RA_weights[i])
            self.edge_color_I2RA.append('r')

        for i in range(len(self.RA2I_edges)):
            self.G_RA2I.add_edge(self.RA2I_edges[i][0],
                                 self.RA2I_edges[i][1],
                                 weight=self.RA2I_weights[i])
            self.edge_color_RA2I.append('g')

        self.edgewidth_I2RA = [
            d['weight'] for (u, v, d) in self.G_I2RA.edges(data=True)
        ]
        self.edgewidth_RA2I = [
            d['weight'] for (u, v, d) in self.G_RA2I.edges(data=True)
        ]
예제 #9
0
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:
        for i in range(N_RA):
예제 #10
0
@author: jingroup

Script reads replacement history
"""

import reading
import numpy as np

directory = "/mnt/hodgkin/eugene/results/immature/clusters/matTrans62/"
start_number = 52000  # starting point

filename = directory + "replacement_history_" + str(start_number) + ".bin"

time_from_previous_replacement = reading.read_replacement_history(filename)

coord_HVCRA = reading.read_coordinates(directory + "RA_xy_" +
                                       str(start_number) + ".bin")

print len(time_from_previous_replacement)
print time_from_previous_replacement

print time_from_previous_replacement[2]

print time_from_previous_replacement[2][1334]
print time_from_previous_replacement[2][234]

print coord_HVCRA[1334]
print coord_HVCRA[234]

print coord_HVCRA[234] == coord_HVCRA[1334]

#for i, t in enumerate(time_from_previous_replacement[2]):
예제 #11
0
import reading
import os

R = 1.0  # radius of sphere

num_iter = 10000
tolerance = 1e-7

dirname = "/home/eugene/results/immature/clusters/11/"
trial_number = 13600

fileMature = os.path.join(dirname, "mature_" + str(trial_number) + ".bin")
fileCoordRA = os.path.join(dirname, "RA_xy_" + str(trial_number) + ".bin")
fileTraining = os.path.join(dirname, "training_neurons.bin")

coord = reading.read_coordinates(fileCoordRA)
(_, _, mature_indicators) = reading.read_mature_indicators(fileMature)
training_neurons = reading.read_training_neurons(fileTraining)

mature_neurons = np.where(mature_indicators == 1)[0]

coord_mature = coord[mature_neurons]

### calculate latitude and longitude of mature HVC-RA neurons ####
longitude, latitude = utils.calculate_longAndLat(coord_mature)

print min(longitude) / np.pi
print max(longitude) / np.pi
print min(latitude) / (np.pi / 2.)
print max(latitude) / (np.pi / 2.)
예제 #12
0
latest_checkpoint = spatial.find_latest_checkpoint(dirname)

print "latest checkpoint = ", latest_checkpoint

#dirname = "/home/eugene/lionX/clustered/network/"
RA_xy = os.path.join(dirname, "RA_xy_" + str(latest_checkpoint) + "_.bin")
I_xy = os.path.join(dirname, "I_xy.bin")
RA2I = os.path.join(dirname,
                    "RA_I_connections_" + str(latest_checkpoint) + "_.bin")
I2RA = os.path.join(dirname,
                    "I_RA_connections_" + str(latest_checkpoint) + "_.bin")
RARA = os.path.join(
    dirname, "RA_RA_super_connections_" + str(latest_checkpoint) + "_.bin")

coord_I = reading.read_coordinates(dim, I_xy)
coord_RA = reading.read_coordinates(dim, RA_xy)

(N_RA, RA_targets, RA_targets_G) = reading.read_connections(RA2I)
(N_I, I_targets, I_targets_G) = reading.read_connections(I2RA)
(_, RA_super_targets, RA_super_targets_G) = reading.read_connections(RARA)

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]

# Here we calculate separation between I neurons
distances_between_all_I = np.empty(shape=(N_I, N_I), dtype=np.float32)
distances_between_all_I.fill(1e6)
예제 #13
0
file_chain_test = os.path.join(
    dirname, "matureTest/" + simname + "/mature_chain_test.bin")
file_RA_super = os.path.join(
    dirname,
    simname + "/RA_RA_super_connections_" + str(trial_number) + "_.bin")
file_RA_xy = os.path.join(dirname,
                          simname + "/RA_xy_" + str(trial_number) + "_.bin")

_RA, num_trials, firing_robustness, average_num_dend_spikes_in_trial, \
average_num_soma_spikes_in_trial, mean_burst_time, std_burst_time = reading.read_chain_test(file_chain_test)

mean_burst_time_stronglyConnected, id_stronglyConnected, firing_robustness_stronglyConnected, \
        std_burst_time_stronglyConnected, num_soma_spikes_stronglyConnected, \
        num_dend_spikes_stronglyConnected = analysis.get_bursts_of_chain_neurons(mean_burst_time, std_burst_time,
                                firing_robustness, average_num_soma_spikes_in_trial, average_num_dend_spikes_in_trial, file_RA_super)

groups, burst_times_in_groups = analysis.split_in_frames(
    mean_burst_time_stronglyConnected, id_stronglyConnected)

print groups
print burst_times_in_groups

print sum([len(group) for group in groups])
print len(id_stronglyConnected)

coordinates = reading.read_coordinates(file_RA_xy)

for i, group in enumerate(groups):
    filename = os.path.join(outdir, "snapshot" + str(i + 1) + ".net")
    write_snapshot(id_stronglyConnected, group, coordinates, filename)
예제 #14
0
def write_pajek_network_subset(dirname, trial_number, N, fileSpikes):
    """
    Create .net file with locations and connections between mature HVC-RA neurons in array
        first N mature neurons that spiked are plotted
    """
    file_RA_xy = os.path.join(dirname, "RA_xy_" + str(trial_number) + ".bin")

    file_training = os.path.join(dirname, "training_neurons.bin")
    file_pajek = os.path.join(dirname,
                              "network_subset_" + str(trial_number) + ".net")
    fileMature = os.path.join(dirname, "mature_" + str(trial_number) + ".bin")
    fileSuperSynapses = os.path.join(
        dirname, "RA_RA_super_connections_" + str(trial_number) + ".bin")
    fileWeights = os.path.join(dirname,
                               "weights_" + str(trial_number) + ".bin")

    coord_RA = reading.read_coordinates(file_RA_xy)
    training_neurons = reading.read_training_neurons(file_training)
    (N_RA, _, weights) = reading.read_weights(fileWeights)
    (_, _, mature_indicators) = reading.read_mature_indicators(fileMature)
    (_, _, super_synapses) = reading.read_synapses(fileSuperSynapses)

    #print list(mature_neurons)
    #mature_neurons = range(N_RA)

    # sort array with neurons and training neurons #
    training_neurons.sort()

    #fileDend = "/home/eugene/Output/networks/chainGrowth/passiveDendrite/test/noImmatureOut4/test_spike_times_dend_5.bin"
    #fileSoma = "/home/eugene/Output/networks/chainGrowth/passiveDendrite/test/noImmatureOut4/test_spike_times_soma_5.bin"

    (_, _, spike_times_soma,
     neuron_fired_soma) = reading.read_time_info(fileSpikes)

    ordered_soma_spikes_raw, ordered_soma_raw = zip(
        *sorted(zip(spike_times_soma, neuron_fired_soma)))

    first_mature_spiked = []

    for spikes, neuron_ids in zip(ordered_soma_spikes_raw, ordered_soma_raw):
        if len(first_mature_spiked) >= N:
            break

        if mature_indicators[neuron_ids[0]] == 1:
            first_mature_spiked.append(neuron_ids[0])

    first_mature_spiked.sort()

    num_neurons = len(first_mature_spiked)

    with open(file_pajek, 'w') as f:
        f.write("*Vertices {0}\n".format(num_neurons))

        for i, neuron_id in enumerate(first_mature_spiked):
            if neuron_id in training_neurons:
                f.write('{0} "{1}" {2} {3} {4} ic Green\n'.format(
                    i + 1, neuron_id, coord_RA[neuron_id][0],
                    coord_RA[neuron_id][1], coord_RA[neuron_id][2]))
            else:
                f.write('{0} "{1}" {2} {3} {4} ic Yellow\n'.format(
                    i + 1, neuron_id, coord_RA[neuron_id][0],
                    coord_RA[neuron_id][1], coord_RA[neuron_id][2]))

        f.write("*Arcs\n".format(num_neurons))

        # write targets of HVC(RA) neurons
        for i, source_id in enumerate(first_mature_spiked):
            for target_id in super_synapses[source_id]:
                try:
                    ind = utils.index(first_mature_spiked, target_id)
                    f.write('{0} {1} {2} c Green\n'.format(
                        i + 1, ind + 1, weights[source_id][target_id]))
                except ValueError:
                    continue
예제 #15
0
                    continue


if __name__ == "__main__":
    #dirname = "/home/eugene/Output/networks/chainGrowth/passiveDendrite/maturationTransition4/"

    dirname = "/mnt/hodgkin/eugene/results/immature/clusters/matTrans62/"
    trial_number = 23800

    #dirname = "/mnt/hodgkin/eugene/results/immature/clusters/matTrans62/"
    #trial_number = 23800

    # fileSpikes = "/home/eugene/results/immature/clusters/test/matTrans29/test_spike_times_soma_10.bin"

    dirname = "/mnt/hodgkin/eugene/Output/networks/chainGrowth/network200RA55I"
    fileTraining = "/mnt/hodgkin/eugene/Output/networks/chainGrowth/network200RA55I/training_neurons_random.bin"

    training_neurons = set(reading.read_training_neurons(fileTraining))

    coord_HVCRA = reading.read_coordinates(os.path.join(dirname, "RA_xy.bin"))
    coord_HVCI = reading.read_coordinates(os.path.join(dirname, "I_xy.bin"))

    #print training_neurons
    #print coord_RA

    #write_pajek_neurons_connected_by_supersynapses(dirname, trial_number)
    write_allCoords(training_neurons, coord_HVCRA, coord_HVCI,
                    os.path.join(dirname, "pajek.net"))
    #write_pajek_neurons(dirname, trial_number)
    #write_pajek_network_subset(dirname, trial_number, N, fileSpikes)
    #write_pajek_hvcRA_coord(dirname, trial_number)
예제 #16
0
    neurons_with_changed_targets = np.where(np.array(targets_before) != np.array(targets_after))
    
    not_replaced_with_changed_targets = np.setdiff1d(neurons_with_changed_targets, replaced, assume_unique=False)
    
    if len(not_replaced_with_changed_targets) > 0:
        print not_replaced_with_changed_targets
    else:
        print "Only replaced neurons changed their interneuron targets"
    #print np.array(targets_before)[np.where(true_array)]
    #print np.array(targets_after)[np.where(true_array)]

#########################################
# Check HVC(RA) coordinates replacement
#########################################

coord_before = reading.read_coordinates(dim, filename_RAxy_before)
coord_after = reading.read_coordinates(dim, filename_RAxy_after)

coord_equal = coord_before == coord_after

N_RA = coord_before.shape[0]

not_replaced = [] # neurons not replaced

for i in range(N_RA):
    if i not in replaced_neurons[6]:
        not_replaced.append(i)

print "Neurons not replaced: ",not_replaced

replacement_correct = True
예제 #17
0
###########################
#### Read data from files
###########################
N = 1000
N_I = 200

replaced_neurons = reading.read_replaced_neurons(fileReplaced)

replaced_neurons_trial = set(replaced_neurons[starting_trial])
not_replaced_trial = [i for i in range(N) if i not in replaced_neurons_trial]

#print replaced_neurons_trial

######### 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, \
예제 #18
0
@author: jingroup

Script analyzes spatial arrangment of neurons on sphere
"""
import matplotlib.pyplot as plt
import reading
import os
import space
import numpy as np

directory = "/home/eugene/Output/networks/chainGrowth/network2000/"

file_RA_coord = os.path.join(directory, "RA_xy.bin")
file_I_coord = os.path.join(directory, "I_xy.bin")

coord_RA = reading.read_coordinates(file_RA_coord)
coord_I = reading.read_coordinates(file_I_coord)

# find distribution of smallest distances between interneurons
N_I = coord_I.shape[0]

smallest_distances = np.empty(N_I, np.float32)

for i in range(N_I):
    min_distance = 1e6

    for j in range(N_I):
        if i != j:
            distance = space.distance_on_sphere(coord_I[i], coord_I[j], 1.0)
            if distance < min_distance:
                min_distance = distance