### Store data: theta_t, x_t, y_t, theta_t+1, x_t+1, y_t+1, a_t, w_t, T ### data = np.zeros((ntrials,9)) for itrial in range(ntrials): print("numtrial %d" % itrial) t = 0. # current time ### Initialize point mass ### position0 = np.random.uniform(40, 60, (2,)) # np.array([50., 50.]) p0 = np.array([0.]) v0 = np.array([0.]) a0 = np.array([0.]) angle0 = np.random.random((1,))*2*np.pi # np.zeros((1,)) # angle_v0 = np.array([0.]) angle_a0 = np.array([0.]) pm = PointMass(position0, p0, v0, a0, angle0, angle_v0, angle_a0) ### Run Simulation ### # while running: for _ in range(500): # event = pygame.event.poll() # if event.type == pygame.QUIT: # running = 0 # screen.fill(bgcolor) if t == 0: pm.acceleration = np.random.random((1,)) * 500 pm.angle_acceleration = (np.random.random((1,))-0.5) * 10 * np.pi # np.zeros((1,)) # # print pm.angle_acceleration elif t < T: # probly better to alloc zeros right at the start
running = 1 dt = 0.01 # [seconds] T = .2 # duration of acceleration # Initialize Target Point Mass ### random_index = np.random.randint(data.shape[0] - n_test, data.shape[0]) t_position0 = dat[random_index, [4, 5]] t_p0 = np.array([0.]) t_v0 = np.array([0.]) t_a0 = np.array([0.]) t_angle0 = np.array([dat[random_index, 3]]) t_angle_v0 = np.array([0.]) t_angle_a0 = np.array([0.]) target = PointMass(t_position0, t_p0, t_v0, t_a0, t_angle0, t_angle_v0, t_angle_a0) target.color = 255, 0, 0 ntrials = 1 for itrial in range(ntrials): t = 0. # current time ### Initialize Point Mass ### position0 = np.array([50., 50.]) p0 = np.array([0.]) v0 = np.array([0.]) a0 = np.array([0.]) angle0 = np.array([dat[random_index, 0]]) angle_v0 = np.array([0.]) angle_a0 = np.array([0.])
running = 1 dt = 0.01 # [seconds] T = 0.2 # duration of acceleration # Initialize Target Point Mass ### random_index = np.random.randint(data.shape[0] - n_test, data.shape[0]) t_position0 = dat[random_index, [4, 5]] t_p0 = np.array([0.0]) t_v0 = np.array([0.0]) t_a0 = np.array([0.0]) t_angle0 = np.array([dat[random_index, 3]]) t_angle_v0 = np.array([0.0]) t_angle_a0 = np.array([0.0]) target = PointMass(t_position0, t_p0, t_v0, t_a0, t_angle0, t_angle_v0, t_angle_a0) target.color = 255, 0, 0 ntrials = 1 for itrial in range(ntrials): t = 0.0 # current time ### Initialize Point Mass ### position0 = np.array([50.0, 50.0]) p0 = np.array([0.0]) v0 = np.array([0.0]) a0 = np.array([0.0]) angle0 = np.array([dat[random_index, 0]]) angle_v0 = np.array([0.0]) angle_a0 = np.array([0.0])
### Store data: theta_t, x_t, y_t, theta_t+1, x_t+1, y_t+1, a_t, w_t, T ### data = np.zeros((ntrials, 9)) for itrial in range(ntrials): print("numtrial %d" % itrial) t = 0. # current time ### Initialize point mass ### position0 = np.random.uniform(40, 60, (2, )) # np.array([50., 50.]) p0 = np.array([0.]) v0 = np.array([0.]) a0 = np.array([0.]) angle0 = np.random.random((1, )) * 2 * np.pi # np.zeros((1,)) # angle_v0 = np.array([0.]) angle_a0 = np.array([0.]) pm = PointMass(position0, p0, v0, a0, angle0, angle_v0, angle_a0) ### Run Simulation ### # while running: for _ in range(500): # event = pygame.event.poll() # if event.type == pygame.QUIT: # running = 0 # screen.fill(bgcolor) if t == 0: pm.acceleration = np.random.random((1, )) * 500 pm.angle_acceleration = (np.random.random( (1, )) - 0.5) * 10 * np.pi # np.zeros((1,)) # # print pm.angle_acceleration elif t < T: