Skip to content

Commit a765af0

Browse files
author
Mathieu Scheltienne
committed
fix more stuff
1 parent 97e3aa9 commit a765af0

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

nibabel/casting.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ def type_info(np_type):
291291
return ret
292292
info_64 = np.finfo(np.float64)
293293
if dt.kind == 'c':
294-
assert np_type is np.longcomplex
294+
assert np_type is np.clongdouble
295295
vals = (nmant, nexp, width / 2)
296296
else:
297297
assert np_type is np.longdouble
@@ -319,7 +319,7 @@ def type_info(np_type):
319319
# Oh dear, we don't recognize the type information. Try some known types
320320
# and then give up. At this stage we're expecting exotic longdouble or
321321
# their complex equivalent.
322-
if np_type not in (np.longdouble, np.longcomplex) or width not in (16, 32):
322+
if np_type not in (np.longdouble, np.clongdouble) or width not in (16, 32):
323323
raise FloatingError(f'We had not expected type {np_type}')
324324
if vals == (1, 1, 16) and on_powerpc() and _check_maxexp(np.longdouble, 1024):
325325
# double pair on PPC. The _check_nmant routine does not work for this
@@ -329,13 +329,13 @@ def type_info(np_type):
329329
# Got float64 despite everything
330330
pass
331331
elif _check_nmant(np.longdouble, 112) and _check_maxexp(np.longdouble, 16384):
332-
# binary 128, but with some busted type information. np.longcomplex
332+
# binary 128, but with some busted type information. np.clongdouble
333333
# seems to break here too, so we need to use np.longdouble and
334334
# complexify
335335
two = np.longdouble(2)
336336
# See: https://matthew-brett.github.io/pydagogue/floating_point.html
337337
max_val = (two**113 - 1) / (two**112) * two**16383
338-
if np_type is np.longcomplex:
338+
if np_type is np.clongdouble:
339339
max_val += 0j
340340
ret = dict(
341341
min=-max_val,

nibabel/nifti1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
if have_binary128():
9090
# Only enable 128 bit floats if we really have IEEE binary 128 longdoubles
9191
_float128t: type[np.generic] = np.longdouble
92-
_complex256t: type[np.generic] = np.longcomplex
92+
_complex256t: type[np.generic] = np.clongdouble
9393
else:
9494
_float128t = np.void
9595
_complex256t = np.void

nibabel/tests/test_arraywriters.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ def test_arraywriters():
6161
assert aw.out_dtype == arr.dtype
6262
assert_array_equal(arr, round_trip(aw))
6363
# Byteswapped should be OK
64-
bs_arr = arr.byteswap().newbyteorder('S')
64+
bs_arr = arr.byteswap()
65+
bs_arr = bs_arr.view(bs_arr.dtype.newbyteorder('S'))
6566
bs_aw = klass(bs_arr)
6667
bs_aw_rt = round_trip(bs_aw)
6768
# assert against original array because POWER7 was running into

nibabel/tests/test_nifti1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class TestNifti1PairHeader(tana.TestAnalyzeHeader, tspm.HeaderScalingMixin):
7979
(np.int8, np.uint16, np.uint32, np.int64, np.uint64, np.complex128)
8080
)
8181
if have_binary128():
82-
supported_np_types = supported_np_types.union((np.longdouble, np.longcomplex))
82+
supported_np_types = supported_np_types.union((np.longdouble, np.clongdouble))
8383
tana.add_duplicate_types(supported_np_types)
8484

8585
def test_empty(self):

0 commit comments

Comments
 (0)