Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions nibabel/cmdline/parrec2nii.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,7 @@
)
with open(basefilename + '.bvals', 'w') as fid:
# np.savetxt could do this, but it's just a loop anyway
for val in bvals:
fid.write(f'{val} ')
fid.write(' '.join(str(val) for val in bvals) + ' ')

Check warning on line 361 in nibabel/cmdline/parrec2nii.py

View check run for this annotation

Codecov / codecov/patch

nibabel/cmdline/parrec2nii.py#L361

Added line #L361 was not covered by tests
fid.write('\n')
else:
verbose('Writing .bvals and .bvecs files')
Expand All @@ -369,13 +368,11 @@
bvecs = apply_affine(bv_reorient, bvecs)
with open(basefilename + '.bvals', 'w') as fid:
# np.savetxt could do this, but it's just a loop anyway
for val in bvals:
fid.write(f'{val} ')
fid.write(' '.join(str(val) for val in bvals) + ' ')
fid.write('\n')
with open(basefilename + '.bvecs', 'w') as fid:
for row in bvecs.T:
for val in row:
fid.write(f'{val} ')
fid.write(' '.join(str(val) for val in row) + ' ')
fid.write('\n')

# export data labels varying along the 4th dimensions if requested
Expand Down
3 changes: 1 addition & 2 deletions nibabel/volumeutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,8 +830,7 @@ def write_zeros(fileobj: io.IOBase, count: int, block_size: int = 8194) -> None:
nblocks = int(count // block_size)
rem = count % block_size
blk = b'\x00' * block_size
for bno in range(nblocks):
fileobj.write(blk)
fileobj.write(blk * nblocks)
fileobj.write(b'\x00' * rem)


Expand Down
Loading