예제 #1
0
def test_find_maximum():
    scores = np.array(range(15))
    k_choices = 4
    N = 6
    output = find_maximum(scores, N, k_choices)
    expected = [2, 3, 4, 5]
    assert_equal(output, expected)
예제 #2
0
def test_find_maximum():
    scores = np.array(range(15))
    k_choices = 4
    N = 6
    output = find_maximum(scores, N, k_choices)
    expected = [2, 3, 4, 5]
    assert_equal(output, expected)
예제 #3
0
def test_combo_from_find_most_distant():
    '''
    Tests whether the correct combination is picked from the fixture drawn
    from Saltelli et al. 2008, in the solution to exercise 3a,
    Chapter 3, page 134.
    '''
    sample_inputs = setup()
    N = 6
    num_params = 2
    k_choices = 4
    scores = find_most_distant(sample_inputs, N, num_params, k_choices)
    output = find_maximum(scores, N, k_choices)
    expected = [0, 2, 3, 5]  # trajectories 1, 3, 4, 6
    assert_equal(output, expected)
예제 #4
0
def test_combo_from_find_most_distant():
    '''
    Tests whether the correct combination is picked from the fixture drawn
    from Saltelli et al. 2008, in the solution to exercise 3a,
    Chapter 3, page 134.
    '''
    sample_inputs = setup()
    N = 6
    num_params = 2
    k_choices = 4
    scores = find_most_distant(sample_inputs, N, num_params, k_choices)
    output = find_maximum(scores, N, k_choices)
    expected = [0, 2, 3, 5]  # trajectories 1, 3, 4, 6
    assert_equal(output, expected)
예제 #5
0
def test_find_local_maximum_distance():
    '''
    Test whether finding the local maximum distance equals the global maximum distance
    in a simple case. From Saltelli et al. 2008, in the solution to exercise 3a,
    Chapter 3, page 134.
    '''
    
    sample_inputs = setup()
    N=6
    num_params = 2
    k_choices = 4
    scores_global = find_most_distant(sample_inputs, N, num_params, k_choices)
    output_global = find_maximum(scores_global, N, k_choices)
    output_local = find_local_maximum(sample_inputs, N, num_params, k_choices)
    assert_equal(output_global, output_local)
예제 #6
0
def test_find_local_maximum_distance():
    '''
    Test whether finding the local maximum distance equals the global maximum distance
    in a simple case. From Saltelli et al. 2008, in the solution to exercise 3a,
    Chapter 3, page 134.
    '''

    sample_inputs = setup()
    N = 6
    num_params = 2
    k_choices = 4
    scores_global = find_most_distant(sample_inputs, N, num_params, k_choices)
    output_global = find_maximum(scores_global, N, k_choices)
    output_local = find_local_maximum(sample_inputs, N, num_params, k_choices)
    assert_equal(output_global, output_local)