Esempio n. 1
0
def test_interpolate_intervals_gap():
    """Check that an interval set is interpolated properly, with gaps."""
    labels = list('abc')
    intervals = np.array([[0.5, 1.0], [1.5, 2.0], [2.5, 3.0]])
    time_points = [0.0, 0.75, 1.25, 1.75, 2.25, 2.75, 3.5]
    expected_ans = ['N', 'a', 'N', 'b', 'N', 'c', 'N']
    assert (util.interpolate_intervals(intervals, labels, time_points, 'N') ==
            expected_ans)
Esempio n. 2
0
def test_interpolate_intervals():
    """Check that an interval set is interpolated properly, with boundaries
    conditions and out-of-range values.
    """
    labels = list('abc')
    intervals = np.array([(n, n + 1.0) for n in range(len(labels))])
    time_points = [-1.0, 0.1, 0.9, 1.0, 2.3, 4.0]
    expected_ans = ['N', 'a', 'a', 'b', 'c', 'N']
    assert (util.interpolate_intervals(intervals, labels, time_points, 'N') ==
            expected_ans)
Esempio n. 3
0
def test_interpolate_intervals():
    """Check that an interval set is interpolated properly, with boundaries
    conditions and out-of-range values.
    """
    labels = list('abc')
    intervals = np.array([(n, n + 1.0) for n in range(len(labels))])
    time_points = [-1.0, 0.1, 0.9, 1.0, 2.3, 4.0]
    expected_ans = ['N', 'a', 'a', 'b', 'c', 'N']
    assert (util.interpolate_intervals(intervals, labels, time_points, 'N') ==
            expected_ans)