def _create_overloaded_functions(spinnaker_simulator): """ Creates functions that the main PyNN interface supports\ (given from PyNN) :param spinnaker_simulator: the simulator object we use underneath :rtype: None """ # overload the failed ones with now valid ones, now that we're in setup # phase. __pynn["run"], __pynn["run_until"] = pynn_common.build_run( spinnaker_simulator) __pynn["get_current_time"], __pynn["get_time_step"], \ __pynn["get_min_delay"], __pynn["get_max_delay"], \ __pynn["num_processes"], __pynn["rank"] = \ pynn_common.build_state_queries(spinnaker_simulator) __pynn["reset"] = pynn_common.build_reset(spinnaker_simulator) __pynn["create"] = pynn_common.build_create(Population) __pynn["connect"] = pynn_common.build_connect(Projection, FixedProbabilityConnector, StaticSynapse) __pynn["record"] = pynn_common.build_record(spinnaker_simulator)
simulator.state.min_delay = min_delay simulator.state.max_delay = max_delay simulator.state.mpi_rank = extra_params.get('rank', 0) simulator.state.num_processes = extra_params.get('num_processes', 1) return rank() def end(compatible_output=True): """Do any necessary cleaning up before exiting.""" for (population, variables, filename) in simulator.state.write_on_end: io = get_io(filename) population.write_data(io, variables) simulator.state.write_on_end = [] # should have common implementation of end() run, run_until = common.build_run(simulator) run_for = run reset = common.build_reset(simulator) initialize = common.initialize get_current_time, get_time_step, get_min_delay, get_max_delay, \ num_processes, rank = common.build_state_queries(simulator) create = common.build_create(Population) connect = common.build_connect(Projection, FixedProbabilityConnector, StaticSynapse) record = common.build_record(simulator)
""" common.setup(timestep, min_delay, max_delay, **extra_params) simulator.state.dt = timestep if not os.path.exists(temporary_directory): os.mkdir(temporary_directory) return 0 def end(compatible_output=True): """Do any necessary cleaning up before exiting.""" for recorder in simulator.recorder_list: recorder.write(gather=True, compatible_output=compatible_output) simulator.recorder_list = [] shutil.rmtree(temporary_directory, ignore_errors=True) moose.PyMooseBase.endSimulation() run = common.build_run(simulator) reset = common.build_reset(simulator) initialize = common.initialize # ============================================================================== # Functions returning information about the simulation state # ============================================================================== get_current_time, get_time_step, get_min_delay, get_max_delay, \ num_processes, rank = common.build_state_queries(simulator) # ============================================================================== # High-level API for creating, connecting and recording from populations of # neurons.
if os.path.isfile('cellConnections.txt'): print("Connectivity Map Created!") else: print("Connectivity map creation failed") def end(compatible_output=True): """Do any necessary cleaning up before exiting.""" for (population, variables, filename) in simulator.state.write_on_end: io = get_io(filename) population.write_data(io, variables) simulator.state.write_on_end = [] # should have common implementation of end() run, run_until = common.build_run(simulator) run_for = run reset = common.build_reset(simulator) initialize = common.initialize get_current_time, get_time_step, get_min_delay, get_max_delay, \ num_processes, rank = common.build_state_queries(simulator) create = common.build_create(Population) connect = common.build_connect(Projection, FixedProbabilityConnector, StaticSynapse) record = common.build_record(simulator)
if 'default_maxstep' in extra_params: simulator.state.default_maxstep = float( extra_params['default_maxstep']) return rank() def end(compatible_output=True): """Do any necessary cleaning up before exiting.""" for (population, variables, filename) in simulator.state.write_on_end: io = get_io(filename) population.write_data(io, variables) simulator.state.write_on_end = [] #simulator.state.finalize() run, run_until, run_to_steady_state, run_from_steady_state = common.build_run( simulator) run_for = run reset = common.build_reset(simulator) initialize = common.initialize # ============================================================================== # Functions returning information about the simulation state # ============================================================================== get_current_time, get_time_step, get_min_delay, get_max_delay, \ num_processes, rank = common.build_state_queries(simulator) # ============================================================================== # Low-level API for creating, connecting and recording from individual neurons