Skip to content

Commit 034c276

Browse files
committed
corrected styles per Travis, limited fdata to float32
1 parent 76ee358 commit 034c276

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

nibabel/cmdline/diff.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def get_data_hash_diff(files):
130130
"""
131131

132132
md5sums = [
133-
hashlib.md5(np.ascontiguousarray(nib.load(f).get_fdata())).hexdigest()
133+
hashlib.md5(np.ascontiguousarray(nib.load(f).get_fdata(dtype=np.float32))).hexdigest()
134134
for f in files
135135
]
136136

@@ -157,14 +157,17 @@ def get_data_diff(files, max_abs=0, max_rel=0):
157157
Returns
158158
-------
159159
diffs: OrderedDict
160-
An ordered dict with a record per each file which has differences with other files subsequent detected.
161-
Each record is a list of difference records, one per each file pair. Each difference record is an Ordered
162-
Dict with possible keys 'abs' or 'rel' showing maximal absolute or relative differences in the file
163-
or record ('CMP': 'incompat') if file shapes are incompatible.
160+
An ordered dict with a record per each file which has differences
161+
with other files subsequent detected. Each record is a list of
162+
difference records, one per each file pair.
163+
Each difference record is an Ordered Dict with possible keys
164+
'abs' or 'rel' showing maximal absolute or relative differences
165+
in the file or the record ('CMP': 'incompat') if file shapes
166+
are incompatible.
164167
"""
165-
168+
166169
# we are doomed to keep them in RAM now
167-
data = [f if isinstance(f, np.ndarray) else nib.load(f).get_fdata() for f in files]
170+
data = [f if isinstance(f, np.ndarray) else nib.load(f).get_fdata(dtype=np.float32) for f in files]
168171
diffs = OrderedDict()
169172
for i, d1 in enumerate(data[:-1]):
170173
# populate empty entries for non-compared

0 commit comments

Comments
 (0)