# storage old noise and compute new noise bg.prvNoise = bg.actNoise.copy() bg.actNoise = utils.computate_noise(bg.prvNoise, bg.delT, bg.tau) * T #♠ bg.actual_noise = utils.Cut_range(bg.actNoise, -0.5 , 0.5) # compute 3D EPs bg.ep3D = utils.Cut_range(bg.actOut + bg.actNoise, 0., 1.) if movement > 0: wrist.saveMov3d() # compute 3d movement wrist.actual_3dposition = wrist.move3d(bg.ep3D) # conversion to 2d movement wrist.delta_2dposition = utils.conversion2d( utils.change_range(wrist.actual_3dposition, 0, 1, -1, 1)) # compute 2d final position wrist.next_2dposition[ 0] = wrist.actual_2dposition[0] - wrist.delta_2dposition[0] wrist.next_2dposition[ 1] = wrist.actual_2dposition[1] + wrist.delta_2dposition[1] # maze.verifyOutside(wrist.next_2dposition) wrist.next_2dposition = maze.imposeLBounds(wrist.actual_2dposition, wrist.next_2dposition) wrist.next_2dposition = maze.imposeHbounds(wrist.actual_2dposition, wrist.next_2dposition) # wrist.next_2dposition = utils.Cut_range(wrist.next_2dposition, 0., 10) wrist.actual_2dposition = wrist.next_2dposition.copy()
bg.desOutBuff[:, step] = wrist.prvEp.copy() bg.stateBuff[:, step] = bg.prvState.copy() if INTRALAMINAR_NUCLEI == True: bg.prvTrainOut = bg.trainOut.copy() cb.prvOut = cb.currOut.copy() if step > (ACTOR_CEREBELLUM_RATIO - 1): if step % ACTOR_CEREBELLUM_RATIO == 1: bg.prvNoise = bg.currNoise.copy() wrist.move3d() # wrist.curr3DPos = np.array([0.5,1.,0.5]) maze.curr2DPos = utils.conversion2d( utils.change_range(wrist.curr3DPos, 0, 1, -1, 1), perturbation, pertMag) maze.posBuff[:, step] = maze.curr2DPos.copy() wrist.posBuff[:, step] = wrist.curr3DPos.copy() if epoch > startPlotting: text2.set_text("step = %s" % (step + 1)) agent.set_data(maze.curr2DPos[0], maze.curr2DPos[1]) agentCircle.remove() agentCircle = plt.Circle( (maze.curr2DPos[0], maze.curr2DPos[1]), 0.15, color='blue') ax1.add_artist(agentCircle) X = [0.5, 0.5, wrist.curr3DPos[0]]
bg.prvCritOut = bg.currCritOut.copy() bg.prvActOut = bg.currActOut.copy() bg.prvNoise = bg.currNoise.copy() if SL == True: if cerebellum == True: bg.desOutBuff[:, step] = wrist.prvEp.copy() bg.stateBuff[:, step] = bg.prvState.copy() wrist.saveMov3d() wrist.move3d() # compute 2d final position maze.delta2DPos = (utils.conversion2d( utils.change_range( wrist.curr3DPos, 0, 1, -1, 1))).copy() * calibration # conversion to 2d step maze.next2DPos[0] = (maze.curr2DPos[0] - maze.delta2DPos[0]).copy() maze.next2DPos[1] = (maze.curr2DPos[1] + maze.delta2DPos[1]).copy() maze.imposeOutBounds() maze.imposeInBounds() maze.curr2DPos = maze.next2DPos.copy() if epoch > startPlotting: text2.set_text("step = %s" % (step + 1)) agent.set_data(maze.curr2DPos[0], maze.curr2DPos[1]) X = [0.5, 0.5, wrist.curr3DPos[0].copy()] Y = [0.0, 0.5, wrist.curr3DPos[1].copy()] Z = [0.5, 0.5, wrist.curr3DPos[2].copy()