New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RF - removed duplicate tests #1626

Merged
merged 1 commit into from Aug 27, 2018

Conversation

Projects
None yet
3 participants
@gabknight
Copy link
Contributor

gabknight commented Aug 27, 2018

Tests on ThresholdTissueClassifier are duplicated in dipy.tracking.tests.test_localtracking.py and dipy.tracking.local.tests.test_tissue_classifier. The former tests are redundant.

Current tests for ThresholdTissueClassifier:
dipy.tracking.local.test_tissue_classifier.py: line 61.

def test_threshold_tissue_classifier():
    """This tests that the thresholdy tissue classifier returns expected
     tissue types.
    """

    tissue_map = np.random.random((4, 4, 4))

    ttc = ThresholdTissueClassifier(tissue_map.astype('float32'), 0.5)

    # Test voxel center
    for ind in ndindex(tissue_map.shape):
        pts = np.array(ind, dtype='float64')
        state = ttc.check_point(pts)
        if tissue_map[ind] > 0.5:
            npt.assert_equal(state, TissueTypes.TRACKPOINT)
        else:
            npt.assert_equal(state, TissueTypes.ENDPOINT)

    # Test random points in voxel
    inds = [[0, 1.4, 2.2], [0, 2.3, 2.3], [0, 2.2, 1.3], [0, 0.9, 2.2],
            [0, 2.8, 1.1], [0, 1.1, 3.3], [0, 2.1, 1.9], [0, 3.1, 3.1],
            [0, 0.1, 0.1], [0, 0.9, 0.5], [0, 0.9, 0.5], [0, 2.9, 0.1]]
    for pts in inds:
        pts = np.array(pts, dtype='float64')
        state = ttc.check_point(pts)
        res = scipy.ndimage.map_coordinates(
            tissue_map, np.reshape(pts, (3, 1)), order=1, mode='nearest')
        if res > 0.5:
            npt.assert_equal(state, TissueTypes.TRACKPOINT)
        else:
            npt.assert_equal(state, TissueTypes.ENDPOINT)

    # Test outside points
    outside_pts = [[100, 100, 100], [0, -1, 1], [0, 10, 2],
                   [0, 0.5, -0.51], [0, -0.51, 0.1]]
    for pts in outside_pts:
        pts = np.array(pts, dtype='float64')
        state = ttc.check_point(pts)
        npt.assert_equal(state, TissueTypes.OUTSIDEIMAGE)
@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Aug 27, 2018

Codecov Report

Merging #1626 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1626      +/-   ##
==========================================
- Coverage   87.33%   87.32%   -0.01%     
==========================================
  Files         246      245       -1     
  Lines       32164    32148      -16     
  Branches     3497     3493       -4     
==========================================
- Hits        28089    28073      -16     
  Misses       3242     3242              
  Partials      833      833

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a1e1f2e...589c3e3. Read the comment docs.

@skoudoro

This comment has been minimized.

Copy link
Member

skoudoro commented Aug 27, 2018

Thank you @gabknight for catching that

@skoudoro skoudoro merged commit a32e164 into nipy:master Aug 27, 2018

2 of 3 checks passed

codecov/project 87.32% (-0.01%) compared to a1e1f2e
Details
codecov/patch Coverage not affected when comparing a1e1f2e...589c3e3
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment