Skip to content

Commit 024670e

Browse files
committed
STY: pep8 clean
1 parent 4e78121 commit 024670e

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

nibabel/freesurfer/io.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import getpass
55
import time
66

7+
78
def _fread3(fobj):
89
"""Read a 3-byte int from an open binary file object
910
@@ -93,6 +94,7 @@ def read_geometry(filepath):
9394
coords = coords.astype(np.float) # XXX: due to mayavi bug on mac 32bits
9495
return coords, faces
9596

97+
9698
def write_geometry(filepath, coords, faces, create_stamp=None):
9799
"""Write a triangular format Freesurfer surface mesh.
98100
@@ -107,10 +109,11 @@ def write_geometry(filepath, coords, faces, create_stamp=None):
107109
create_stamp : str
108110
User/time stamp (default: "created by <user> on <ctime>")
109111
"""
110-
magic_bytes = np.array([255,255,254],dtype=np.uint8)
112+
magic_bytes = np.array([255, 255, 254], dtype=np.uint8)
111113

112114
if create_stamp is None:
113-
create_stamp = "created by %s on %s" % (getpass.getuser(), time.ctime())
115+
create_stamp = "created by %s on %s" % (getpass.getuser(),
116+
time.ctime())
114117

115118
with open(filepath, 'wb') as fobj:
116119
magic_bytes.tofile(fobj)
@@ -122,6 +125,7 @@ def write_geometry(filepath, coords, faces, create_stamp=None):
122125
coords.astype('>f4').reshape(-1).tofile(fobj)
123126
faces.astype('>i4').reshape(-1).tofile(fobj)
124127

128+
125129
def read_morph_data(filepath):
126130
"""Read a Freesurfer morphometry data file.
127131

nibabel/freesurfer/tests/test_io.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
import numpy as np
1111
from numpy.testing import assert_equal
1212

13-
from .. import read_geometry, read_morph_data, read_annot, read_label, write_geometry
13+
from .. import read_geometry, read_morph_data, read_annot, read_label, \
14+
write_geometry
1415

1516

1617
have_freesurfer = True
@@ -45,12 +46,13 @@ def test_geometry():
4546
# with respect to read_geometry()
4647
with InTemporaryDirectory():
4748
surf_path = 'test'
48-
create_stamp = "created by %s on %s" % (getpass.getuser(), time.ctime())
49+
create_stamp = "created by %s on %s" % (getpass.getuser(),
50+
time.ctime())
4951
write_geometry(surf_path, coords, faces, create_stamp)
5052

5153
coords2, faces2 = read_geometry(surf_path)
5254

53-
with open(surf_path,'rb') as fobj:
55+
with open(surf_path, 'rb') as fobj:
5456
magic = np.fromfile(fobj, ">u1", 3)
5557
read_create_stamp = fobj.readline().rstrip('\n')
5658

@@ -65,6 +67,7 @@ def test_geometry():
6567
np.testing.assert_array_equal(coords_swapped, coords)
6668
np.testing.assert_array_equal(faces_swapped, faces)
6769

70+
6871
@freesurfer_test
6972
def test_morph_data():
7073
"""Test IO of morphometry data file (eg. curvature)."""

0 commit comments

Comments
 (0)