Skip to content

Commit 5099d01

Browse files
committed
Check only for known cases in bvals_are_zero (0 or 5)
1 parent aca523b commit 5099d01

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

heudiconv/convert.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -822,14 +822,13 @@ def add_taskname_to_infofile(infofiles):
822822
save_json(infofile, meta_info)
823823

824824

825-
def bvals_are_zero(bval_file, threshold=5):
826-
"""Checks if all entries in a bvals file are zero (or below the threshold).
825+
def bvals_are_zero(bval_file):
826+
"""Checks if all entries in a bvals file are zero (or 5, for Siemens files).
827827
Returns True if that is the case, otherwise returns False
828828
829829
Parameters
830830
----------
831831
bval_file : file with the bvals
832-
threshold : b-value below which they are considered to be zero. (Default: 5)
833832
834833
Returns
835834
-------
@@ -839,4 +838,5 @@ def bvals_are_zero(bval_file, threshold=5):
839838
with open(bval_file) as f:
840839
bvals = f.read().split()
841840

842-
return all(float(b) <= threshold for b in bvals)
841+
bvals_unique = set(float(b) for b in bvals)
842+
return bvals_unique == {0.} or bvals_unique == {5.}

0 commit comments

Comments
 (0)