Beispiel #1
0
from TotalDepth.RP66V1.core import XAxis, File


@pytest.mark.parametrize(
    'norm, dupe, skip, back, expected',
    (
        (1, 2, 3, 4, 10),
    )
)
def test_xaxis_spacing_counts_total(norm, dupe, skip, back, expected):
    counts = XAxis.XAxisSpacingCounts(norm, dupe, skip, back)
    assert counts.total == expected


SPACING_COUNTS = (
    (np.array([1.0, 1.0, 1.0]), 1.0, XAxis.XAxisSpacingCounts(3, 0, 0, 0),),
    # Norm
    (np.array([1.0, 1.0, 1.1]), 1.0, XAxis.XAxisSpacingCounts(3, 0, 0, 0),),
    # Dupe
    (np.array([1.0, 1.0, 0.0]), 1.0, XAxis.XAxisSpacingCounts(2, 1, 0, 0),),
    # Skip
    (np.array([1.0, 1.0, 2.0]), 1.0, XAxis.XAxisSpacingCounts(2, 0, 1, 0),),
    # Back
    (np.array([1.0, 1.0, -1.0]), 1.0, XAxis.XAxisSpacingCounts(2, 0, 0, 1),),
)


@pytest.mark.parametrize('diff_array, exp_median, exp_counts', SPACING_COUNTS)
def test_compute_spacing_counts_median(diff_array, exp_median, exp_counts):
    median, _counts = XAxis.compute_spacing_counts(diff_array)
    assert exp_median == median
Beispiel #2
0
def test_xaxis_spacing_counts_total(norm, dupe, skip, back, expected):
    counts = XAxis.XAxisSpacingCounts(norm, dupe, skip, back)
    assert counts.total == expected
Beispiel #3
0
from TotalDepth.RP66V1.core import XAxis, File


@pytest.mark.parametrize('norm, dupe, skip, back, expected',
                         ((1, 2, 3, 4, 10), ))
def test_xaxis_spacing_counts_total(norm, dupe, skip, back, expected):
    counts = XAxis.XAxisSpacingCounts(norm, dupe, skip, back)
    assert counts.total == expected


SPACING_COUNTS = (
    (
        np.array([1.0, 1.0, 1.0]),
        1.0,
        XAxis.XAxisSpacingCounts(3, 0, 0, 0),
    ),
    # Norm
    (
        np.array([1.0, 1.0, 1.1]),
        1.0,
        XAxis.XAxisSpacingCounts(3, 0, 0, 0),
    ),
    # Dupe
    (
        np.array([1.0, 1.0, 0.0]),
        1.0,
        XAxis.XAxisSpacingCounts(2, 1, 0, 0),
    ),
    # Skip
    (