def run(config_file): conf = bionet.Config.from_json(config_file, validate=True) conf.build_env() net = bionet.BioNetwork.from_config(conf) sim = bionet.BioSimulator.from_config(conf, network=net) sim.run() # run simulation assert (spike_files_equal(conf['output']['spikes_file_csv'], 'expected/spikes.csv')) bionet.nrn.quit_execution() # exit
def main(config_file): configure = pointnet.Config.from_json(config_file) configure.build_env() network = pointnet.PointNetwork.from_config(configure) py_modules.add_cell_processor('process_model', process_model) py_modules.add_synaptic_weight('gaussianLL', gaussianLL) sim = pointnet.PointSimulator.from_config(configure, network) sim.run() assert (spike_files_equal(configure['output']['spikes_file_csv'], 'expected/spikes.csv'))
def main(config_file): configure = config.from_json(config_file) graph = PointGraph.from_config(configure) graph.add_weight_function(fn.wmax) graph.add_weight_function(fn.gaussianLL) net = PointNetwork.from_config(configure, graph) net.run() # print nest.GetConnections() assert (spike_files_equal(configure['output']['spikes_ascii'], 'expected/spikes.txt'))
def run(config_file): conf = config.from_json(config_file) # build configuration io.setup_output_dir(conf) # set up output directories nrn.load_neuron_modules(conf) # load NEURON modules and mechanisms nrn.load_py_modules( cell_models=set_cell_params, # load custom Python modules syn_models=set_syn_params, syn_weights=set_weights) graph = BioGraph.from_config( conf, # create network graph containing parameters of the model network_format=TabularNetwork_AI, property_schema=AIPropertySchema) net = BioNetwork.from_config( conf, graph ) # create netwosim = Simulation.from_config(conf, network=net) rk of in NEURON sim = Simulation.from_config(conf, network=net) # initialize a simulation sim.run() # run simulation if MPI_RANK == 0: try: # Check spikes print2log0('Checking spike times') assert (os.path.exists(conf['output']['spikes_ascii_file'])) assert (spike_files_equal(conf['output']['spikes_ascii_file'], 'expected/spikes.txt')) print2log0('Spikes passed!') # Check extracellular recordings print2log0('Checking ECP output') check_ecp() print2log0('ECP passed!') # Check saved variables print2log0('Checking NEURON saved variables') for saved_gids in conf['node_id_selections']['save_cell_vars']: check_cellvars(saved_gids, conf) print2log0('variables passed!') except AssertionError: _, _, tb = sys.exc_info() traceback.print_tb(tb) pc.barrier() nrn.quit_execution() # exit
def main(config_file): nest.SetKernelStatus({"total_num_virtual_procs": comm.Get_size()}) print nest.NumProcesses() print comm.Get_size() configure = config.from_json(config_file) io.setup_output_dir(configure) graph = PointGraph.from_config(configure, network_format=TabularNetwork_AI, property_schema=AIPropertySchema) graph.add_weight_function(fn.wmax) graph.add_weight_function(fn.gaussianLL) net = PointNetwork.from_config(configure, graph) net.run(configure['run']['duration']) assert (spike_files_equal(configure['output']['spikes_ascii'], 'expected/spikes.txt'))
def run(config_file): conf = config.from_json(config_file) # build configuration io.setup_output_dir(conf) # set up output directories nrn.load_neuron_modules(conf) # load NEURON modules and mechanisms nrn.load_py_modules( cell_models=set_cell_params, # load custom Python modules syn_models=set_syn_params, syn_weights=set_weights) graph = BioGraph.from_config( conf) # create network graph containing parameters of the model net = BioNetwork.from_config(conf, graph) # create network of in NEURON sim = Simulation.from_config(conf, net) # initialize a simulation # sim.set_recordings() # set recordings of relevant variables to be saved as an ouput sim.run() # run simulation assert (os.path.exists(conf['output']['spikes_ascii_file'])) assert (spike_files_equal(conf['output']['spikes_ascii_file'], 'expected/spikes.txt')) nrn.quit_execution() # exit
def run(config_file): conf = config.from_json(config_file) # build configuration io.setup_output_dir(conf) # set up output directories nrn.load_neuron_modules(conf) # load NEURON modules and mechanisms nrn.load_py_modules( cell_models=set_cell_params, # load custom Python modules syn_models=set_syn_params, syn_weights=set_weights) graph = BioGraph.from_config( conf, # create network graph containing parameters of the model network_format=TabularNetwork_AI, property_schema=AIPropertySchema) net = BioNetwork.from_config( conf, graph ) # create netwosim = Simulation.from_config(conf, network=net) rk of in NEURON sim = Simulation.from_config(conf, network=net) # initialize a simulation # sim.set_recordings() # set recordings of relevant variables to be saved as an ouput sim.run() # run simulation assert (os.path.exists(conf['output']['spikes_ascii_file'])) assert (spike_files_equal(conf['output']['spikes_ascii_file'], 'expected/spikes.txt')) # Test the results of the ecp SAMPLE_SIZE = 100 expected_h5 = h5py.File('expected/ecp.h5', 'r') nrows, ncols = expected_h5['ecp'].shape expected_mat = np.matrix(expected_h5['ecp']) results_h5 = h5py.File('output/ecp.h5', 'r') assert ('ecp' in results_h5.keys()) results_mat = np.matrix(results_h5['ecp'][:]) assert (results_h5['ecp'].shape == (nrows, ncols)) for i, j in zip(randint(0, nrows, size=SAMPLE_SIZE), randint(0, ncols, size=SAMPLE_SIZE)): assert (results_mat[i, j] == expected_mat[i, j]) nrn.quit_execution() # exit
def run(config_file): conf = config.from_json(config_file) # build configuration io.setup_output_dir(conf) # set up output directories nrn.load_neuron_modules(conf) # load NEURON modules and mechanisms nrn.load_py_modules( cell_models=set_cell_params, # load custom Python modules syn_models=set_syn_params, syn_weights=set_weights) graph = BioGraph.from_config( conf, # create network graph containing parameters of the model network_format=TabularNetwork_AI, property_schema=AIPropertySchema) net = BioNetwork.from_config(conf, graph) sim = Simulation.from_config(conf, network=net) sim.run() assert (os.path.exists(conf['output']['spikes_ascii_file'])) assert (spike_files_equal(conf['output']['spikes_ascii_file'], 'expected/spikes.txt')) nrn.quit_execution() # exit