예제 #1
0
 def test_DumpNodes2(self):
     """Test dumping nodes, two layers."""
     ldict = {'elements': 'iaf_neuron', 'rows': 3, 'columns':3,
              'extent': [2., 2.], 'edge_wrap': True}
     nest.ResetKernel()
     l = topo.CreateLayer(ldict)
     topo.DumpLayerNodes(l*2, os.path.join(self.nest_tmpdir(), 'test_DumpNodes2.out.lyr') )
     self.assertTrue(True)
예제 #2
0
save_gabors(gabors_to_nest, images_to_simulate)
if get_output_images_bool:
    quit()

############################################################  Connectivity ######################################################################

t = time.time()
poiss_layers_dict, lgn_layers_dict, v1_layers_dict = main_get_and_connect_layers(
)
conn_time = time.time() - t

######################################################### Dump layers

t = time.time()
for layer, j in zip(v1_layers_dict, range(0, len(v1_layers_dict))):
    tp.DumpLayerNodes(v1_layers_dict[layer], 'positions-' + str(layer))

for layer, j in zip(lgn_layers_dict, range(0, len(lgn_layers_dict))):
    tp.DumpLayerNodes(lgn_layers_dict[layer], 'positions-' + str(layer))
dump_time = time.time() - t

print("Dump layers done!")

####################################################### Position files

t = time.time()
save_positions_to_file()
positions_time = time.time() - t
print("Positions to file done!")

################################################# Simulation
예제 #3
0
    'edge_wrap': True
})

topo.ConnectLayers(
    l1, l2, {
        'connection_type': direction,
        'mask': {
            'circular': {
                'radius': 0.4
            }
        },
        'weights': {
            'linear': {
                'c': 1.,
                'a': -5.
            }
        }
    })

topo.DumpLayerNodes(l1 + l2, 'topo_mpi_test.lyr_tmp')
topo.DumpLayerConnections(l1, 'static_synapse', 'topo_mpi_test.cnn_tmp')

# combine all layer and connection files into one sorted file, respectively
nest.sli_run('SyncProcesses')  # make sure all are done dumping
if nest.Rank() == 0:
    for filetype in ['cnn', 'lyr']:
        os.system('cat *.{0}_tmp | sort > all_sorted.{0}'.format(filetype))
        os.system('rm *.{0}_tmp'.format(filetype))

# directories for any number of MPI processes should now be diff-able
예제 #4
0
    inserted as a string and the parameter to be specified in a
    dictionary. All instances of theses models created after this point
    will have the properties specified in the dictionary by default.
    '''

    nest.SetDefaults("iaf_psc_alpha", neuron_params)
    '''
    Creation of the topology layers for excitatory and inhibitory neurons.
    GIDs and neuron positions are written to file.
    '''

    layer_in = tp.CreateLayer(layerdict_in)
    layer_ex = tp.CreateLayer(layerdict_ex)
    layer_stim = tp.CreateLayer(layerdict_stim)

    tp.DumpLayerNodes(
        layer_ex, os.path.join(spike_output_path, label_positions + '-0.dat'))
    tp.DumpLayerNodes(
        layer_in, os.path.join(spike_output_path, label_positions + '-1.dat'))
    tp.DumpLayerNodes(
        layer_stim, os.path.join(spike_output_path,
                                 label_positions + '-2.dat'))

    nodes_ex = nest.GetChildren(layer_ex)[0]  # nodes of ex/in neurons
    nodes_in = nest.GetChildren(layer_in)[0]
    nodes_stim = nest.GetChildren(layer_stim)[0]
    '''
    Distribute initial membrane voltages.
    '''

    for neurons in [nodes_ex, nodes_in]:
        for neuron in neurons:
예제 #5
0
t = time.time()
steady_state_time = time.time() - t

for i in tqdm(range(num_images_to_simulate)):
    set_poisson_values(gabors_to_nest['image_' + str(i)], poiss_layers,
                       num_orientations)
    nest.Simulate(ms_per_stimuli)
sim_time = time.time() - t

######################################################### Data Treatment #################################################################

layers_to_record = {}
spike_detectors = {}
for i in layers:
    layers_to_record.update(dict(list(layers[i].items())[:2]))
    spike_detectors.update(dict(list(layers[i].items())[2:]))

save_dict(layers_to_record, 'to_record_layer')
save_dict(spike_detectors, 'to_record_sd')

for layer, j in zip(layers_to_record, range(0, len(layers_to_record))):
    tp.DumpLayerNodes(layers_to_record[layer], 'positions-' + str(layer))

print("Times: \n\n     Building architecture: " +
      str(np.around(conn_time / 60, 2)) + "m")
print("\n     Image processing: " + str(np.around(gabors_time, 2)) + "s")
print("\n     Simulation: " + str(np.around(sim_time / 60, 2)) + "m")
print("\n")
print(image_selected, "\n")