示例#1
0
                position_nose = np.array([x_positions_nose,
                                          y_positions_nose]).T
                vx = np.zeros((x_positions_head.shape[0], 1))
                vy = np.zeros((y_positions_head.shape[0], 1))
                vx[1:, 0] = np.diff(position[:, 0])
                vy[1:, 0] = np.diff(position[:, 1])
                speed = np.sqrt(vx * vx + vy * vy)

                ## get points coordinates for head direction and objects location
                p2 = position_nose  # nose position
                p1 = position  # head position
                p3 = coordinates1 * np.ones_like(p1)
                p4 = coordinates2 * np.ones_like(p1)

                ## binary looking at object vectors
                looking_vector1, angle1_vector = beh_func.looking_at_vector(
                    p2, p1, p3)
                looking_vector2, angle2_vector = beh_func.looking_at_vector(
                    p2, p1, p4)

                ## proximity vector between mouse position and objects
                proximity_vector1 = beh_func.proximity_vector(position,
                                                              p3,
                                                              radius=RADIUS1)
                proximity_vector2 = beh_func.proximity_vector(position,
                                                              p4,
                                                              radius=RADIUS1)

                ## super proximity vector for mouse position and objects (closer that proximity1)
                super_proximity_vector1 = beh_func.proximity_vector(
                    position, p3, radius=RADIUS2)
                super_proximity_vector2 = beh_func.proximity_vector(
示例#2
0
                vy[1:, 0] = np.diff(position[:, 1])
                speed = np.sqrt(vx * vx + vy * vy)

                ## get points coordinates for head direction and objects location
                # p2 = np.array([tracking[0:duration, 0], tracking[0:duration, 1]]).T  # nose position
                # p1 = np.array([tracking[0:duration, 2], tracking[0:duration, 3]]).T  # head position
                p2 = position_nose  # nose position
                p0 = np.array([x_positions_head, y_positions_head]).T
                p1 = position  # cm position
                p3 = coordinates1 * np.ones_like(p1)
                p4 = coordinates2 * np.ones_like(p1)
                p5 = coordinates[non_object_list[0] - 1] * np.ones_like(p1)
                p6 = coordinates[non_object_list[1] - 1] * np.ones_like(p1)

                ## binary looking at object vectors
                looking_vector1, angle1_vector = beh_func.looking_at_vector(
                    p2, p0, p3)
                looking_vector2, angle2_vector = beh_func.looking_at_vector(
                    p2, p0, p4)
                looking_vector3, angle3_vector = beh_func.looking_at_vector(
                    p2, p0, p5)
                looking_vector4, angle4_vector = beh_func.looking_at_vector(
                    p2, p0, p6)

                ## proximity vector between mouse position and objects
                proximity_vector1 = beh_func.proximity_vector(position,
                                                              p3,
                                                              radius=RADIUS1)
                proximity_vector2 = beh_func.proximity_vector(position,
                                                              p4,
                                                              radius=RADIUS1)
                proximity_vector3 = beh_func.proximity_vector(position,