-
Notifications
You must be signed in to change notification settings - Fork 530
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
FIX: Make positional arguments to LaplacianThickness require previous argument #2848
Merged
+87
−14
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0430c85
RF+ENH(TST): use %s instead of %f when rendering cmdline float point …
yarikoptic fc18c78
TST(BK): test_LaplacianThickness_wrongargs to demonstrate #2847
yarikoptic 597c03f
Merge remote-tracking branch 'origin/master' into bf-2847
yarikoptic d633a57
BF: provide chain of requires for LaplacianThickness
yarikoptic 56b2227
FIX: Requires error text was backwards
effigies b706af8
TEST: Thorough test of LaplacianThickness requirement cascade
effigies 2ff466e
BF: regenerated test_auto_LaplacianThickness using wonderfully long r…
yarikoptic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- | ||
# vi: set ft=python sts=4 ts=4 sw=4 et: | ||
|
||
from ..segmentation import LaplacianThickness | ||
from .test_resampling import change_dir | ||
|
||
import os | ||
import pytest | ||
|
||
|
||
@pytest.fixture() | ||
def change_dir(request): | ||
orig_dir = os.getcwd() | ||
filepath = os.path.dirname(os.path.realpath(__file__)) | ||
datadir = os.path.realpath(os.path.join(filepath, '../../../testing/data')) | ||
os.chdir(datadir) | ||
|
||
def move2orig(): | ||
os.chdir(orig_dir) | ||
|
||
request.addfinalizer(move2orig) | ||
|
||
|
||
@pytest.fixture() | ||
def create_lt(): | ||
lt = LaplacianThickness() | ||
# we do not run, so I stick some not really proper files as input | ||
lt.inputs.input_gm = 'diffusion_weighted.nii' | ||
lt.inputs.input_wm = 'functional.nii' | ||
return lt | ||
|
||
|
||
def test_LaplacianThickness_defaults(change_dir, create_lt): | ||
lt = create_lt | ||
base_cmd = 'LaplacianThickness functional.nii diffusion_weighted.nii functional_thickness.nii' | ||
assert lt.cmdline == base_cmd | ||
lt.inputs.smooth_param = 4.5 | ||
assert lt.cmdline == base_cmd + " 4.5" | ||
lt.inputs.prior_thickness = 5.9 | ||
assert lt.cmdline == base_cmd + " 4.5 5.9" | ||
|
||
|
||
def test_LaplacianThickness_wrongargs(change_dir, create_lt): | ||
lt = create_lt | ||
lt.inputs.tolerance = 0.001 | ||
with pytest.raises(ValueError, match=r".* requires a value for input 'sulcus_prior' .*"): | ||
lt.cmdline | ||
lt.inputs.sulcus_prior = 0.15 | ||
with pytest.raises(ValueError, match=r".* requires a value for input 'dT' .*"): | ||
lt.cmdline | ||
lt.inputs.dT = 0.01 | ||
with pytest.raises(ValueError, match=r".* requires a value for input 'prior_thickness' .*"): | ||
lt.cmdline | ||
lt.inputs.prior_thickness = 5.9 | ||
with pytest.raises(ValueError, match=r".* requires a value for input 'smooth_param' .*"): | ||
lt.cmdline | ||
lt.inputs.smooth_param = 4.5 | ||
assert lt.cmdline == 'LaplacianThickness functional.nii diffusion_weighted.nii ' \ | ||
'functional_thickness.nii 4.5 5.9 0.01 0.15 0.001' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure this logic was backwards. Does anybody want to double-check me?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eyeballed it -- seems to produce logically correct statement at this moment, so all is good ;)