Skip to content

Commit 3b71c4f

Browse files
committed
BF: workaround numpy bug when testing roundtrip
np.longdouble infs out for the max of float64 on (at least) numpy 1.6.2 on PPC.
1 parent 72f4c3d commit 3b71c4f

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

nibabel/tests/test_arraywriters.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,10 @@ def test_float_int_min_max():
508508
for in_dt in FLOAT_TYPES:
509509
finf = type_info(in_dt)
510510
arr = np.array([finf['min'], finf['max']], dtype=in_dt)
511+
# Bug in numpy 1.6.2 on PPC leading to infs - abort
512+
if not np.all(np.isfinite(arr)):
513+
print 'Hit PPC max -> inf bug; skip in_type %s' % in_dt
514+
continue
511515
for out_dt in IUINT_TYPES:
512516
try:
513517
aw = SlopeInterArrayWriter(arr, out_dt)

nibabel/tests/test_scaling.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,11 @@ def check_int_a2f(in_type, out_type):
224224
this_min, this_max = info['min'], info['max']
225225
if not in_type in np.sctypes['complex']:
226226
data = np.array([this_min, this_max], in_type)
227+
# Bug in numpy 1.6.2 on PPC leading to infs - abort
228+
if not np.all(np.isfinite(data)):
229+
if DEBUG:
230+
print 'Hit PPC max -> inf bug; skip in_type %s' % in_type
231+
return
227232
else: # Funny behavior with complex256
228233
data = np.zeros((2,), in_type)
229234
data[0] = this_min + 0j

0 commit comments

Comments
 (0)