コード例 #1
0
def test_distance_fail_with_difference_size_ip():
    input_1 = np.matrix([[0, 1 / 3.], [0, 1.]], dtype=np.float32)
    input_3 = np.matrix([[2 / 3., 0], [2 / 3., 2 / 3.], [0, 2 / 3.]], dtype=np.float32)
    try:
        compute_distance(input_1, input_3, 2)
    except:
        pass
    else:
        raise AssertionError("Different size matrices did not trigger error")
コード例 #2
0
ファイル: test_morris_util.py プロジェクト: lidaweicc/SALib
def test_distance_fail_with_difference_size_ip():
    input_1 = np.matrix([[0, 1 / 3.], [0, 1.]], dtype=np.float32)
    input_3 = np.matrix([[2 / 3., 0], [2 / 3., 2 / 3.], [0, 2 / 3.]],
                        dtype=np.float32)
    try:
        compute_distance(input_1, input_3, 2)
    except:
        pass
    else:
        raise AssertionError("Different size matrices did not trigger error")
コード例 #3
0
def test_distance():
    '''
    Tests the computation of the distance of two trajectories
    '''
    input_1 = np.matrix([[0, 1 / 3.], [0, 1.], [2 / 3., 1.]], dtype=np.float32)
    input_3 = np.matrix([[2 / 3., 0], [2 / 3., 2 / 3.], [0, 2 / 3.]], dtype=np.float32)
    output = compute_distance(input_1, input_3)
    assert_allclose(output, 6.18, atol=1e-2)
コード例 #4
0
def test_distance_of_identical_matrices_is_min():
    input_1 = np.matrix([[ 1.          ,1.        ],
                         [ 1.          ,0.33333333],
                         [ 0.33333333  ,0.33333333]])
    input_2 = input_1.copy()
    actual = compute_distance(input_1, input_2)
    desired = 0
    assert_allclose(actual, desired, atol=1e-2)
コード例 #5
0
ファイル: test_morris_util.py プロジェクト: lidaweicc/SALib
def test_distance():
    '''
    Tests the computation of the distance of two trajectories
    '''
    input_1 = np.matrix([[0, 1 / 3.], [0, 1.], [2 / 3., 1.]], dtype=np.float32)
    input_3 = np.matrix([[2 / 3., 0], [2 / 3., 2 / 3.], [0, 2 / 3.]],
                        dtype=np.float32)
    output = compute_distance(input_1, input_3)
    assert_allclose(output, 6.18, atol=1e-2)
コード例 #6
0
ファイル: test_morris_util.py プロジェクト: lidaweicc/SALib
def test_distance_of_identical_matrices_is_min():
    input_1 = np.matrix([[1., 1.], [1., 0.33333333], [0.33333333, 0.33333333]])
    input_2 = input_1.copy()
    actual = compute_distance(input_1, input_2)
    desired = 0
    assert_allclose(actual, desired, atol=1e-2)