Fix SBRef sorting when EchoTime is missing#3648
Conversation
|
Ah, thanks for tracking down the root cause here. I'm not sure that lexical sorting is the best option. The reason we use echotime is that we've run across datasets where they don't match. The simple thing would be to reject sbrefs with no echo time, giving a clear warning that this was being done. The more complex but probably okay thing would be to infer the echo time from the corresponding bold files. I lean toward rejection, as there's no danger of making a mistake. |
|
EchoTime is required for files with the echo entity in the filename, so I also lean toward rejection. |
|
So this is probably the time we should finally upgrade the validator... |
|
Addressed the review feedback.
Local verification:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3648 +/- ##
==========================================
+ Coverage 74.41% 74.54% +0.12%
==========================================
Files 62 62
Lines 4987 5012 +25
Branches 637 639 +2
==========================================
+ Hits 3711 3736 +25
Misses 1142 1142
Partials 134 134 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
effigies
left a comment
There was a problem hiding this comment.
Actually, I think this will break in the case of a single sbref that's missing an echo time. Can you add a test for that case? That can probably just be handled by checking len(sbref_files) == 1. (sorted() handled the 0- and 1-file cases by not having any comparisons to make.)
|
I think there’s still one edge case missing here: a single SBRef with no Right now the new logic drops any SBRef missing Could you add a regression test for that case? I think the implementation can probably just special-case it with something like That would keep the multi-file ambiguity fix while preserving the previous behavior for the degenerate single-file case. |
|
Addressed — I updated the PR to preserve the single-SBRef case and added a regression test for it. Changes:
This keeps the multi-file missing- |
Closes #3646.
Summary
EchoTimemetadata when sorting matches.EchoTimesorted by echo time and fall back to filename for missing values.EchoTimemetadata.Test plan
python3 -B -m pytest fmriprep/workflows/bold/tests/test_fit.py::test_get_sbrefs_handles_missing_echo_time