示例#1
0
文件: Runner.py 项目: nico202/pyNeMo
    synapses = networks[1][5]
    network_name = networks[1][6]

    #Save Config
    dict_config = {
        "neurons": neurons,
        "sensory_neurons": (sensory_neurons_in, sensory_neurons_out),
        "save": to_save,
        "step_input": stimuli_dict,
        "synapses": synapses,
        "name": network_name
    }

    config_dict_hash = hashDict(dict_config)
    saveKey(config_dict_hash + "_input"
            , dict_config
            , output_dir)

    saveFile(
        config_file_name
        , output_dir + "/" + config_dict_hash + "_input.py")

    #Define robot
    if sensory_neurons_in or sensory_neurons_out:
        robot = RobotYARP(mode=args.robot_mode)
    else:
        robot = None
    #TODO: Reset robot original position? (and maybe gz-world status?)
    if robot:
        if args.reset_position or args.reset_only:
            print "RESETTING"
示例#2
0
文件: Batch.py 项目: nico202/pyNeMo
#fix parentheses:
commands = [ i for i in commands if not missing(i) ]

#set just to be sure no duplicate runs
real_commands = set(commands)

#TODO:
#FIXME: remove "--show-image" etc to prevent different hashes of same config
session_hash = hashDict(real_commands)

#Save commands list
is_folder("./commands")
commands_file = "./commands/" + session_hash + "_commands"
cprint ("Saving %s commands to file: %s" % (len(real_commands), commands_file), 'info')
saveKey(commands_file, commands)
# Debug: re-enable in release
# cprint("Running in 5s", "warning")
# time.sleep(5)

#Start
is_folder (output_dir)

cprint("We'll use %s as output dir" % (output_dir), 'info')

#Let's run the simulations (surely not the best way, but does the job)
#TODO: add the loop inside Runner?
start = time.time()
try:
    run = import_history(output_dir + "/" + session_hash + "_batch")
    recover_from_lap = run["cycle"]