def quicksave(self, filename=None): """ Saves this sorn object :param filename: str, Default: "net.pickle" """ if filename == None: filename = utils.logfilename("sorn.pickle") print("\nThe RM-SORN network are saved to:", filename) pickle.dump(self, gzip.open(filename, "wb"), pickle.HIGHEST_PROTOCOL)
def quicksave(self, filename=None): """ Saves this object Parameters: filename: string Filename to save in. Default: "net.pickle" """ if filename == None: filename = utils.logfilename("net.pickle") temp = self.stats self.stats = 0 # pickle cannot deal with running stats pickle.dump(self, gzip.open(filename, "wb"), pickle.HIGHEST_PROTOCOL) self.stats = temp
def quicksave(self, filename=None): """ Saves this object Parameters: filename: string Filename to save in. Default: "net.pickle" """ if filename == None: filename = utils.logfilename("net.pickle") temp = self.stats self.stats = 0 # pickle cannot deal with running stats pickle.dump( self, gzip.open( filename, "wb" ), \ pickle.HIGHEST_PROTOCOL ) self.stats = temp
import ipdb ipdb.set_trace() # ~ np.seterrcall(debugger) # ~ np.seterr(all='call') # Parameters are read from the second command line argument param = import_module(utils.param_file()) experiment_module = import_module(param.c.experiment.module) experiment_name = param.c.experiment.name experiment = getattr(experiment_module, experiment_name)(param) c = param.c c.logfilepath = utils.logfilename("") + "/" (source, stats_single, _) = experiment.start() sorn = Sorn(c, source) # Create a StatsCollection and fill it with methods for all statistics # that should be tracked (and later plotted) stats = StatsCollection(sorn) stats.methods = stats_single sorn.stats = stats # Datalog is used to store all results and parameters stats.dlog.set_handler("*", utils.StoreToH5, utils.logfilename("result.h5")) stats.dlog.append("c", utils.unbunchify(c)) stats.dlog.set_handler("*", utils.TextPrinter)
print 'In debugger!' #~ import ipdb #~ ipdb.set_trace() np.seterrcall(debugger) np.seterr(all='call') # Parameters are read from the second command line argument param = import_module(utils.param_file()) experiment_module = import_module(param.c.experiment.module) experiment_name = param.c.experiment.name c = param.c if rank == 0: logfilepath = utils.logfilename('') + '/' else: logfilepath = None c.logfilepath = comm.bcast(logfilepath, root=0) c.display = False # Keep logfile small. dlog = utils.DataLog() dlog.progress("Code Backed up") # Create one logger for all simulations dlog.progress("NUMBER_OF_SIMS = %d" % c.cluster.NUMBER_OF_SIMS) result_path = c.logfilepath + 'result.h5' dlog.set_handler("*", utils.StoreToH5, result_path) dlog.append('c', utils.unbunchify(c)) # Loop over all simulations on this core
# Start debugging mode when an error is raised def debugger(type,flag): print 'In debugger!' #~ import ipdb #~ ipdb.set_trace() np.seterrcall(debugger) np.seterr(all='call') # Parameters are read from the second command line argument param = import_module(utils.param_file()) experiment_module = import_module(param.c.experiment.module) experiment_name = param.c.experiment.name c = param.c if rank==0: logfilepath = utils.logfilename('')+'/' else: logfilepath = None c.logfilepath = comm.bcast(logfilepath, root=0) c.display = False # Keep logfile small. dlog = utils.DataLog() dlog.progress("Code Backed up") # Create one logger for all simulations dlog.progress("NUMBER_OF_SIMS = %d"%c.cluster.NUMBER_OF_SIMS) result_path = c.logfilepath+'result.h5' dlog.set_handler("*", utils.StoreToH5, result_path) dlog.append('c', utils.unbunchify(c)) # Loop over all simulations on this core
print 'In debugger! (test_single.py)' import ipdb ipdb.set_trace() #~ np.seterrcall(debugger) #~ np.seterr(all='call') # Parameters are read from the second command line argument param = import_module(utils.param_file()) experiment_module = import_module(param.c.experiment.module) experiment_name = param.c.experiment.name experiment = getattr(experiment_module, experiment_name)(param) c = param.c c.logfilepath = utils.logfilename('') + '/' (source, stats_single, _) = experiment.start() sorn = Sorn(c, source) # Create a StatsCollection and fill it with methods for all statistics # that should be tracked (and later plotted) stats = StatsCollection(sorn) stats.methods = stats_single sorn.stats = stats # Datalog is used to store all results and parameters stats.dlog.set_handler('*', utils.StoreToH5, utils.logfilename("result.h5")) stats.dlog.append('c', utils.unbunchify(c)) stats.dlog.set_handler('*', utils.TextPrinter)