-
Notifications
You must be signed in to change notification settings - Fork 533
FIX: Sort conditions in bids_gen_info to ensure consistent order #2867
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2867 +/- ##
==========================================
- Coverage 67.5% 64.19% -3.32%
==========================================
Files 343 341 -2
Lines 43598 43546 -52
Branches 5426 5424 -2
==========================================
- Hits 29431 27954 -1477
- Misses 13465 14517 +1052
- Partials 702 1075 +373
Continue to review full report at Codecov.
|
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 think this is reasonable. Small suggestion.
@satra I think you suggested there should be a test to go with this?
@effigies and @TheChymera - yes, it may be useful to see a point of failure where this will not work. i'm mostly concerned whether this worked and stopped working or did not work properly ever. also whether this works across both FSL and SPM. |
This was recently added (#2845) as a BIDS-y alternative to the existing events files, so it's not a failure of a historical construct. |
@TheChymera Can you review the suggestion? And is there any chance of a small regression test? |
@TheChymera Just a note that the 1.1.9 release is coming up on Monday, and it would be good to have any PRs we want to include in on Friday. |
@effigies I'm not sure what kind of test you're looking for. Could you provide me with an example? |
In this case, a simple regression test would be a BIDS-style event file and a function that compares the output of def test_bids_gen_info():
fname = ...
res = bids_gen_info(fname)
# Tests of properties
assert len(res) == 1
assert res[0].onsets == ...
assert res[0].durations == ...
assert res[0].amplitudes == ...
assert res[0].conditions == ... |
@effigies what directory should I put the example file into? I can't find other example files, e.g. |
@TheChymera - if you create a test with: def test_bids_info(tmpdir):
filename = tmpdir / 'testfile.nii'
import nibabel as nb
# create a local file here and use it for a test.
....
img.to_nifti(filename)
# use filename for test |
@satra so I should create the .tsv file as part of the test? that's a lot more and a lot less legible text than if I tracked it somewhere. But where? |
the general place where test data go is |
b433508
to
58737df
Compare
|
||
|
||
def test_bids_gen_info(): | ||
fname = os.path.realpath('data/events.tsv') |
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.
fname = os.path.realpath('data/events.tsv') | |
fname = npt.example_data('events.tsv') |
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.
sorry i forgot that location is not a default in the regular tests.
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.
Two minor style points, but otherwise this looks good. Looks like @satra's fix should fix up the tests, but let me know if we're still falling short.
f8e0964
to
d9b8378
Compare
Added separate import because @satra's suggestion failed with
|
Ok, can't reproduce this new failure locally, sounds like some unicode support is missing from the testing environment:
|
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.
Looks like you found the nipype.testing
fix. Added a suggestion for your Py2 issue.
And can you rebase on top of current master to get all imports and resolve the merge conflict?
17bea46
to
f627f4d
Compare
If this is not done, condition order for orthogonalizarion is unpredictable.
ok, so using the str type from builtins gives me this:
The only way I was able to fix it is by re-assigning the base type before the import, since removing the import breaks another function. |
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.
Going to go ahead and merge. Thanks for your patience! |
@effigies
If this is not done, condition order for orthogonalizarion is
unpredictable.
Acknowledgment