Exemplo n.º 1
0
scaley = int(np.round(training['cols']/resolution))

print(resolution)

num_examples = 4.0 #len(training)
j = 0
dat_arr = []
while j < (int(num_examples)):
    print('image: ' + str(j))
    rates = training['x'][j%60000,:,:] / 8.*input_intensity
    downsample = skimage.transform.downscale_local_mean(rates, (scalex, scaley))
    print('downsampled image from (28, 28) to ' + str(downsample.shape))
    linear = np.ravel(downsample)
    neuron_inds, current_vals = add_current(AL, linear, Nglo, Npn)

    ex.const_current(AL, Nglo, neuron_inds, current_vals)
    #set up the lab
    f, initial_conditions, neuron_inds  = lm.set_up_lab(AL)
    time_sampled_range = np.arange(0., time_per_image*1000, dt*1000)

    data = lm.run_lab(f, initial_conditions, time_sampled_range, integrator = 'dopri5',compile=True)
    dat_arr.append(data)

    lm.show_random_neuron_in_layer(time_sampled_range,data,AL,1,2)
    lm.show_random_neuron_in_layer(time_sampled_range,data,AL,3,2)
    lm.show_random_neuron_in_layer(time_sampled_range,data,AL,5,2)

    j+=1
np.save('MNIST_AL_data.npy', dat_arr)

Exemplo n.º 2
0
                       gLNPN=200,
                       gPN=300)

#AL = net.create_AL_man(nm.LN, nm.PN_2, nm.Synapse_gaba_LN, nm.Synapse_nAch_PN_2)
#Set up the experiment
num_layers = 2

#The value of the input current is 400 pA
val = 250  #nA
#val = 400
#These are the neuron indicies within each layer which receive the current
neuron_inds = [[0, 1], [1, 3]]
current_vals = [[val, val], [val, val]]

# Set up the experiment with a constant input current
ex.const_current(AL, num_layers, neuron_inds, current_vals)

#set up the lab
f, initial_conditions, neuron_inds = lm.set_up_lab(AL)

#run for specified time with dt
time_len = 1000.0  #Run for 600 ms
dt = 0.02  # Integration time step 0.02 ms
time_sampled_range = np.arange(0., time_len, dt)

# Run the lab and get output
data = lm.run_lab(f,
                  initial_conditions,
                  time_sampled_range,
                  integrator='dopri5',
                  compile=True)
Exemplo n.º 3
0
stim = pickle.load(stimuli_pickle)
stimuli_pickle.close()

# Set the current value -- assumes a dc current for all neurons
current_amp = stim_amp(conc)

# Numer of glomeruli
num_layers = len(AL.layers)

#adj_m = net.get_edges_data(AL, "weight")

curr_inds = stim[0][odor]
curr_vals = current_amp * np.asarray(stim[1][odor])
stim = None
print('Odor: {0}, Concentration {1}, Trial {2}'.format(odor, conc, trial))
ex.const_current(AL, num_layers, curr_inds, curr_vals)

# set up the lab
f, initial_conditions, all_neuron_inds = lm.set_up_lab(AL)

# run the lab
data = lm.run_lab(f,
                  initial_conditions,
                  time_sampled_range,
                  integrator='dopri5',
                  compile=True)

data = np.transpose(data)

# Isolate Projection Neuron and Local Neuron indicies for use elsewhere
pn_inds = np.concatenate(np.array(