Пример #1
0
def test_lesq_repair2():
    # Bad DE row, not enough rows to repair.
    N = np.array([0, 0, 0, 0])
    DE = np.matrix([[1, 0, 0], [0, 1, 0], [0, 0, 1], [22, 222, 222]])
    dd_obs = np.array([1, 1, 1, 1])
    code, num_used, residuals, removed_obs, b \
      = bl.lesq_solve_raim_(dd_obs, N, DE, False, bl.DEFAULT_RAIM_THRESHOLD_)
    assert np.allclose(b, np.array([0.1705906, -0.00802221, -0.00802221]))
    assert num_used == 0
    assert np.allclose(residuals, np.zeros(num_used))
    assert removed_obs == 0
    assert code == -4, "Expecting -4 for not enough dds to repair, got: %i." % code
Пример #2
0
def test_lesq_repair1():
    # Test raim repair: over constrained with bad DE row.
    N = np.array([0, 0, 0, 0, 0])
    DE = np.matrix([[1, 0, 0], [0, 1, 0], [0, 0, 1], [1, 1, 1], [22, 222,
                                                                 222]])
    dd_obs = np.array([1, 1, 1, 3, 1])
    code, num_used, residuals, removed_obs, b \
      = bl.lesq_solve_raim_(dd_obs, N, DE, False, bl.DEFAULT_RAIM_THRESHOLD_)
    assert num_used == 4
    assert np.allclose(residuals, np.zeros(num_used))
    assert removed_obs == 4
    assert np.allclose(b, np.array([0.19023801, 0.19023801, 0.19023801]))
    assert code == 1, "Expecting 1 for repaired solution, got: %i." % code
    assert removed_obs == 4, \
      "Expecting repaired solution (dropping index 4 of DE), got: %i." % removed_obs
Пример #3
0
def test_lesq_repair2():
  # Bad DE row, not enough rows to repair.
  N = np.array([0, 0, 0, 0])
  DE = np.matrix([[1, 0, 0],
                  [0, 1, 0],
                  [0, 0, 1],
                  [22, 222, 222]])
  dd_obs = np.array([1, 1, 1, 1])
  code, num_used, residuals, removed_obs, b \
    = bl.lesq_solve_raim_(dd_obs, N, DE, False, bl.DEFAULT_RAIM_THRESHOLD_)
  assert np.allclose(b, np.array([ 0.1705906,  -0.00802221, -0.00802221]))
  assert num_used == 0
  assert np.allclose(residuals, np.zeros(num_used))
  assert removed_obs == 0
  assert code == -4, "Expecting -4 for not enough dds to repair, got: %i." % code
Пример #4
0
def test_lesq_repair_disabled():
    # Test raim disabling flag: Over constrained with bad DE row.
    N = np.array([0, 0, 0, 0, 0])
    DE = np.matrix([[1, 0, 0], [0, 1, 0], [0, 0, 1], [1, 1, 1], [22, 222,
                                                                 222]])
    dd_obs = np.array([1, 1, 1, 3, 1])
    # DISABLE raim
    code, num_used, residuals, removed_obs, b \
      = bl.lesq_solve_raim_(dd_obs, N, DE, True, bl.DEFAULT_RAIM_THRESHOLD_)
    assert np.allclose(b, np.array([0.37698481, -0.01824651, -0.01824651]))
    assert num_used == 5
    assert np.allclose(
        residuals,
        np.array([-0.9816482, 1.09591413, 1.09591413, 1.21018006,
                  -0.01038781]))
    assert removed_obs == 0
    assert code == 2, "Expecting 1 for repaired solution, got: %i." % code
Пример #5
0
def test_lesq_solution4():
    # Over constrained, integer valued ambiguity
    N = np.array([22, 23, 34, -123])
    DE = np.matrix([[1, 0, 0], [0, 1, 0], [0, 0, 1], [1, 1, 1]])
    b_true = np.array([1.234, 1.456, 1.789])
    dd_obs = bl.predict_carrier_obs_(N, DE, b_true)
    N_int = N
    code, num_used, residuals, removed_obs, b \
      = bl.lesq_solve_raim_(dd_obs, N_int, DE, False, bl.DEFAULT_RAIM_THRESHOLD_)
    assert num_used == 4
    assert np.allclose(
        residuals,
        np.array(
            [1.77635684e-15, -3.55271368e-15, -5.32907052e-15,
             3.55271368e-15]))
    assert removed_obs == 0
    assert np.allclose(b, np.array([1.234, 1.456, 1.789]))
    assert np.allclose(b, b_true)
Пример #6
0
def test_lesq_repair_disabled():
  # Test raim disabling flag: Over constrained with bad DE row.
  N = np.array([0, 0, 0, 0, 0])
  DE = np.matrix([[1, 0, 0],
                  [0, 1, 0],
                  [0, 0, 1],
                  [1, 1, 1],
                  [22, 222, 222]])
  dd_obs = np.array([1, 1, 1, 3, 1])
  # DISABLE raim
  code, num_used, residuals, removed_obs, b \
    = bl.lesq_solve_raim_(dd_obs, N, DE, True, bl.DEFAULT_RAIM_THRESHOLD_)
  assert np.allclose(b, np.array([ 0.37698481, -0.01824651, -0.01824651]))
  assert num_used == 5
  assert np.allclose(residuals,
                     np.array([-0.9816482, 1.09591413,  1.09591413,  1.21018006, -0.01038781]))
  assert removed_obs == 0
  assert code == 2, "Expecting 1 for repaired solution, got: %i." % code
Пример #7
0
def test_lesq_repair1():
  # Test raim repair: over constrained with bad DE row.
  N = np.array([0, 0, 0, 0, 0])
  DE = np.matrix([[1, 0, 0],
                  [0, 1, 0],
                  [0, 0, 1],
                  [1, 1, 1],
                  [22, 222, 222]])
  dd_obs = np.array([1, 1, 1, 3, 1])
  code, num_used, residuals, removed_obs, b \
    = bl.lesq_solve_raim_(dd_obs, N, DE, False, bl.DEFAULT_RAIM_THRESHOLD_)
  assert num_used == 4
  assert np.allclose(residuals, np.zeros(num_used))
  assert removed_obs == 4
  assert np.allclose(b, np.array([ 0.19023801,  0.19023801,  0.19023801]))
  assert code == 1, "Expecting 1 for repaired solution, got: %i." % code
  assert removed_obs == 4, \
    "Expecting repaired solution (dropping index 4 of DE), got: %i." % removed_obs
Пример #8
0
def test_lesq_solution4():
  # Over constrained, integer valued ambiguity
  N = np.array([22, 23, 34, -123])
  DE = np.matrix([[1, 0, 0],
                  [0, 1, 0],
                  [0, 0, 1],
                  [1, 1, 1]])
  b_true = np.array([1.234, 1.456, 1.789])
  dd_obs = bl.predict_carrier_obs_(N, DE, b_true)
  N_int = N
  code, num_used, residuals, removed_obs, b \
    = bl.lesq_solve_raim_(dd_obs, N_int, DE, False, bl.DEFAULT_RAIM_THRESHOLD_)
  assert num_used == 4
  assert np.allclose(residuals,
                     np.array([  1.77635684e-15,  -3.55271368e-15,
                                 -5.32907052e-15,   3.55271368e-15]))
  assert removed_obs == 0
  assert np.allclose(b, np.array([ 1.234,  1.456,  1.789]))
  assert np.allclose(b, b_true)