Пример #1
0
aps_vector_x = np.ones((track.duration, 1)) * track.aps[:, 0].transpose()
aps_vector_y = np.ones((track.duration, 1)) * track.aps[:, 1].transpose()
aps_vector_dir = np.ones((track.duration, 1)) * track.aps[:, 2].transpose()

track_x = np.ones((track.duration, track.aps.shape[0])) * track.track[:, 0].reshape((track.duration, 1))
track_y = np.ones((track.duration, track.aps.shape[0])) * track.track[:, 1].reshape((track.duration, 1))

# Calculate distance between APs to MS
aps_dist = ((aps_vector_x - track_x) ** 2 + (aps_vector_y - track_y) ** 2)

# remove AP if it is saturated
aps_sat = aps_dist <= cfg.r_sat_sqrd

# Calculate simulated global angles from APs to the MS
global_angle_sim = fn.find_global_angle(aps_vector_x, aps_vector_y, track_x, track_y)

# Calculate simulated local angles from APs to the MS
local_angle_sim = global_angle_sim - aps_vector_dir

# Add random error
local_angle_sim = fn.add_error(local_angle_sim)

"""
Get position, remember to remove sat, when positioning
"""
# Converting to predicted global angle
global_angle = local_angle_sim + aps_vector_dir

# Converting predicted angles into slopes
slopes = 1 / np.tan(np.radians(global_angle))
Пример #2
0
pos_error_y = np.ones((grid.shape[0], cfg_exp.N / cfg_exp.res + 1))

print 'training covariance'
for k in range(cfg_exp.N):
    """
    Simulate
    """

    # Calculate distance between APs to MS
    aps_dist = ((aps_vector_x - grid_x) ** 2 + (aps_vector_y - grid_y) ** 2)

    # remove AP if it is saturated
    aps_sat = aps_dist <= cfg_exp.r_sat_sqrd

    # Calculate global angles from APs to the MS
    global_angle_sim = fn.find_global_angle(aps_vector_x, aps_vector_y, grid_x, grid_y)

    # Calculate local angles from APs to the MS
    local_angle_sim = global_angle_sim - aps_vector_dir

    # Add random error
    local_angle_sim = fn.add_error(local_angle_sim)

    """
    Get grid, remember to remove sat, when positioning
    """
    # Converting to predicted global angle
    global_angle = local_angle_sim + aps_vector_dir

    # Converting predicted angles into slopes
    slopes = 1 / np.tan(np.radians(global_angle))