def end(): """Do any necessary cleaning up before exiting.""" for (population, variables, filename) in simulator.state.write_on_end: logger.debug("%s%s --> %s" % (population.label, variables, filename)) io = recording.get_io(filename) population.write_data(io, variables) for tempdir in simulator.state.tempdirs: shutil.rmtree(tempdir) simulator.state.tempdirs = [] simulator.state.write_on_end = []
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 = [] electrodes.current_sources = [] for item in simulator.state.network.groups + simulator.state.network._all_operations: del item del simulator.state
def end(_=True): """ Cleans up the SpiNNaker machine and software :param _: was named compatible_output, which we don't care about,\ so is a non-existent parameter :rtype: None """ for (population, variables, filename) in \ globals_variables.get_simulator().write_on_end: io = get_io(filename) population.write_data(io, variables) globals_variables.get_simulator().write_on_end = [] globals_variables.get_simulator().stop()
def end(): """Do any necessary cleaning up before exiting.""" for (population, variables, filename) in simulator.state.write_on_end: io_file = get_io(filename) population.write_data(io_file, variables) simulator.state.write_on_end = [] if simulator.state.conn_manager is not None: simulator.state.conn_manager.__exit__() simulator.state.conn_manager = None assert simulator.state.conn is not None simulator.state.conn = None # remove instance singleton simulator.state = None
def end(_=True): """ Cleans up the SpiNNaker machine and software :param _: was named compatible_output, which we don't care about, so is a non-existent parameter """ try: simulator = globals_variables.get_simulator() except SimulatorShutdownException: logger.warning("Second call to end ignored") return except SimulatorNotSetupException: logger.exception("Calling end before setup makes no sense ignoring!") return for (population, variables, filename) in \ simulator.write_on_end: io = get_io(filename) population.write_data(io, variables) simulator.write_on_end = [] simulator.stop()
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 = []
plt.ion() #.rcParams['interactive'] = True example = sys.argv[1] blocks = {} for simulator in 'MOCK', 'NEST', 'NEURON', 'Brian', 'MOOSE', 'Nemo': pattern = "Results/%s_*%s.*" % (example, simulator.lower()) datafiles = glob.glob(pattern) if datafiles: for datafile in datafiles: base = os.path.basename(datafile) root = base[:base.find(simulator.lower())-1] if root not in blocks: blocks[root] = {} blocks[root][simulator] = get_io(datafile).read_block() else: print("No data found for pattern %s" % pattern) print("-"*79) print(example) from pprint import pprint pprint(blocks) if len(blocks) > 0: for name in blocks: plt.figure() lw = 2*len(blocks[name]) - 1 for simulator, block in blocks[name].items(): vm = block.segments[0].filter(name="v")[0] plt.plot(vm.times, vm[:, 0], label=simulator, linewidth=lw)
plt.ion() #.rcParams['interactive'] = True example = sys.argv[1] blocks = {} for simulator in 'MOCK', 'NEST', 'NEURON', 'Brian', 'MOOSE', 'Nemo': pattern = "Results/%s_*%s.*" % (example, simulator.lower()) datafiles = glob.glob(pattern) if datafiles: for datafile in datafiles: base = os.path.basename(datafile) root = base[:base.find(simulator.lower()) - 1] if root not in blocks: blocks[root] = {} blocks[root][simulator] = get_io(datafile).read_block() else: print("No data found for pattern %s" % pattern) print("-" * 79) print(example) from pprint import pprint pprint(blocks) if len(blocks) > 0: for name in blocks: plt.figure() lw = 2 * len(blocks[name]) - 1 for simulator, block in blocks[name].items(): vm = block.segments[0].filter(name="v")[0]