Exemplo n.º 1
0
def test_approx_mdl_traj():

    t = np.linspace(0, 1.75 * 2 * np.pi, 100)
    x = np.sin(t)
    y = np.cos(t)
    z = t
    xyz = np.vstack((x, y, z)).T
    xyza1 = pf.approximate_mdl_trajectory(xyz, alpha=1.)
    xyza2 = pf.approximate_mdl_trajectory(xyz, alpha=2.)
    assert_equal(len(xyza1), 10)
    assert_equal(len(xyza2), 8)
    assert_array_almost_equal(
        xyza1,
        np.array([[0.00000000e+00, 1.00000000e+00, 0.00000000e+00],
                  [9.39692621e-01, 3.42020143e-01, 1.22173048e+00],
                  [6.42787610e-01, -7.66044443e-01, 2.44346095e+00],
                  [-5.00000000e-01, -8.66025404e-01, 3.66519143e+00],
                  [-9.84807753e-01, 1.73648178e-01, 4.88692191e+00],
                  [-1.73648178e-01, 9.84807753e-01, 6.10865238e+00],
                  [8.66025404e-01, 5.00000000e-01, 7.33038286e+00],
                  [7.66044443e-01, -6.42787610e-01, 8.55211333e+00],
                  [-3.42020143e-01, -9.39692621e-01, 9.77384381e+00],
                  [-1.00000000e+00, -4.28626380e-16, 1.09955743e+01]]))

    assert_array_almost_equal(
        xyza2,
        np.array([[0.00000000e+00, 1.00000000e+00, 0.00000000e+00],
                  [9.95471923e-01, -9.50560433e-02, 1.66599610e+00],
                  [-1.89251244e-01, -9.81928697e-01, 3.33199221e+00],
                  [-9.59492974e-01, 2.81732557e-01, 4.99798831e+00],
                  [3.71662456e-01, 9.28367933e-01, 6.66398442e+00],
                  [8.88835449e-01, -4.58226522e-01, 8.32998052e+00],
                  [-5.40640817e-01, -8.41253533e-01, 9.99597663e+00],
                  [-1.00000000e+00, -4.28626380e-16, 1.09955743e+01]]))
Exemplo n.º 2
0
def test_approx_mdl_traj():
    
    t=np.linspace(0,1.75*2*np.pi,100)
    x = np.sin(t)
    y = np.cos(t)
    z = t    
    xyz=np.vstack((x,y,z)).T     
    xyza1 = pf.approximate_mdl_trajectory(xyz,alpha=1.)
    xyza2 = pf.approximate_mdl_trajectory(xyz,alpha=2.)    
    assert_equal(len(xyza1), 10)
    assert_equal(len(xyza2), 8)
    assert_array_almost_equal( xyza1, np.array([[  0.00000000e+00,   1.00000000e+00,   0.00000000e+00],
       [  9.39692621e-01,   3.42020143e-01,   1.22173048e+00],
       [  6.42787610e-01,  -7.66044443e-01,   2.44346095e+00],
       [ -5.00000000e-01,  -8.66025404e-01,   3.66519143e+00],
       [ -9.84807753e-01,   1.73648178e-01,   4.88692191e+00],
       [ -1.73648178e-01,   9.84807753e-01,   6.10865238e+00],
       [  8.66025404e-01,   5.00000000e-01,   7.33038286e+00],
       [  7.66044443e-01,  -6.42787610e-01,   8.55211333e+00],
       [ -3.42020143e-01,  -9.39692621e-01,   9.77384381e+00],
       [ -1.00000000e+00,  -4.28626380e-16,   1.09955743e+01]]))
    
    assert_array_almost_equal(xyza2, np.array([[  0.00000000e+00,   1.00000000e+00,   0.00000000e+00],
       [  9.95471923e-01,  -9.50560433e-02,   1.66599610e+00],
       [ -1.89251244e-01,  -9.81928697e-01,   3.33199221e+00],
       [ -9.59492974e-01,   2.81732557e-01,   4.99798831e+00],
       [  3.71662456e-01,   9.28367933e-01,   6.66398442e+00],
       [  8.88835449e-01,  -4.58226522e-01,   8.32998052e+00],
       [ -5.40640817e-01,  -8.41253533e-01,   9.99597663e+00],
       [ -1.00000000e+00,  -4.28626380e-16,   1.09955743e+01]]))