def main(stdscr): # for debugging logger = logging.getLogger(__file__) hdlr = logging.FileHandler(__file__ + ".log") formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') hdlr.setFormatter(formatter) logger.addHandler(hdlr) logger.setLevel(logging.DEBUG) logger.info("begin") # clear screen stdscr.clear() # initializing colors curses.start_color() curses.init_pair(1, curses.COLOR_BLUE, curses.COLOR_BLACK) curses.init_pair(2, curses.COLOR_MAGENTA, curses.COLOR_BLACK) curses.init_pair(3, curses.COLOR_CYAN, curses.COLOR_BLACK) curses.init_pair(4, curses.COLOR_YELLOW, curses.COLOR_BLACK) width = 102 height = 30 sim = Simulator() nw = sim.nw #nw.set_input_data(["OLQDL"], [10000.0]) y_coords = get_y_coords(sim.nw, width) done = False while (sim.curr_tick < sim.TICKS and not done): stdscr.clear() sim.perform_tick() draw_border(stdscr, width, height) write_info(stdscr, width, height, sim.curr_tick) draw_cells(stdscr, nw, y_coords, sim.curr_tick) stdscr.refresh() done = sim.check_state() sim.curr_tick += 1 time.sleep(0.5) if done or sim.curr_tick == sim.TICKS: time.sleep(1000)
#x = np.array([500]) output = "" counter = 1 muscles = get_muscle_labels() for sensor in sensors: print("sensor: " + sensor + " (" + str(counter) + ")") for inp in x: print("inp: " + str(inp)) sim = Simulator() nw = sim.nw nw.set_input_data([sensor], [inp]) done = False while (sim.curr_tick < sim.TICKS and not done): sim.perform_tick() done = sim.check_state() sim.curr_tick += 1 first_reached_values = [ sim.nw.neurons[muscle].first_reached for muscle in muscles ] first_fired_values = [ sim.nw.neurons[muscle].first_fired for muscle in muscles ] fired_values_list = [ sim.nw.neurons[muscle].fire_values for muscle in muscles ] reached_values_list = [ sim.nw.neurons[muscle].reached_values for muscle in muscles ] all_values_list = [