Skip to content

removing trailing spaces #1746

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 12, 2016
Merged
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
2 changes: 1 addition & 1 deletion nipype/algorithms/confounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ def compute_dvars(in_file, in_mask, remove_zerovariance=False):
warnings.filterwarnings('error')

# voxelwise standardization
diff_vx_stdz = func_diff / np.array([diff_sdhat] * func_diff.shape[-1]).T
diff_vx_stdz = func_diff / np.array([diff_sdhat] * func_diff.shape[-1]).T
dvars_vx_stdz = diff_vx_stdz.std(axis=0, ddof=1)

return (dvars_stdz, dvars_nstd, dvars_vx_stdz)
Expand Down
2 changes: 1 addition & 1 deletion nipype/algorithms/tests/test_compcor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class TestCompCor():
filenames = {'functionalnii': 'compcorfunc.nii',
'masknii': 'compcormask.nii',
'components_file': None}

@pytest.fixture(autouse=True)
def setup_class(self, tmpdir):
# setup
Expand Down
18 changes: 9 additions & 9 deletions nipype/algorithms/tests/test_mesh_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_ident_distances(tmpdir):
dist_ident.inputs.out_file = os.path.join(tempdir, 'distance.npy')
res = dist_ident.run()
assert res.outputs.distance == 0.0

dist_ident.inputs.weighting = 'area'
res = dist_ident.run()
assert res.outputs.distance == 0.0
Expand All @@ -35,23 +35,23 @@ def test_ident_distances(tmpdir):
def test_trans_distances(tmpdir):
tempdir = str(tmpdir)
os.chdir(tempdir)

from ...interfaces.vtkbase import tvtk

in_surf = example_data('surf01.vtk')
warped_surf = os.path.join(tempdir, 'warped.vtk')

inc = np.array([0.7, 0.3, -0.2])

r1 = tvtk.PolyDataReader(file_name=in_surf)
vtk1 = VTKInfo.vtk_output(r1)
r1.update()
vtk1.points = np.array(vtk1.points) + inc

writer = tvtk.PolyDataWriter(file_name=warped_surf)
VTKInfo.configure_input_data(writer, vtk1)
writer.write()

dist = m.ComputeMeshWarp()
dist.inputs.surface1 = in_surf
dist.inputs.surface2 = warped_surf
Expand Down Expand Up @@ -79,10 +79,10 @@ def test_meshwarpmaths(tmpdir):

@pytest.mark.skipif(not VTKInfo.no_tvtk(), reason="tvtk is installed")
def test_importerror():
with pytest.raises(ImportError):
with pytest.raises(ImportError):
m.ComputeMeshWarp()

with pytest.raises(ImportError):
with pytest.raises(ImportError):
m.WarpPoints()

with pytest.raises(ImportError):
Expand Down
4 changes: 2 additions & 2 deletions nipype/algorithms/tests/test_modelgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ def test_modelgen_sparse(tmpdir):
assert len(res.outputs.session_info[0]['regress']) == 1
s.inputs.use_temporal_deriv = True
res = s.run()

assert len(res.outputs.session_info[0]['regress']) == 2
npt.assert_almost_equal(res.outputs.session_info[0]['regress'][0]['val'][0], 0.016675298129743384)
npt.assert_almost_equal(res.outputs.session_info[1]['regress'][1]['val'][5], 0.007671459162258378)

2 changes: 1 addition & 1 deletion nipype/algorithms/tests/test_overlap.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def check_close(val1, val2):
overlap.inputs.volume2 = in1
res = overlap.run()
check_close(res.outputs.jaccard, 1.0)

overlap = Overlap()
overlap.inputs.volume1 = in1
overlap.inputs.volume2 = in2
Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/freesurfer/tests/test_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_robustregister(create_files_in_directory):
assert reg2.cmdline == ('mri_robust_register --halfdst %s_halfway.nii --lta foo.lta '
'--sat 3.0000 --mov %s --dst %s'
% (os.path.join(outdir, filelist[1][:-4]), filelist[0], filelist[1]))


@pytest.mark.skipif(freesurfer.no_freesurfer(), reason="freesurfer is not installed")
def test_fitmsparams(create_files_in_directory):
Expand Down
16 changes: 8 additions & 8 deletions nipype/interfaces/fsl/tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import pytest

@pytest.mark.skipif(no_fsl(), reason="fsl is not installed")
@pytest.mark.skipif(no_fsl(), reason="fsl is not installed")
def test_fslversion():
ver = fsl.Info.version()
ver = ver.split('.')
Expand All @@ -27,8 +27,8 @@ def test_outputtype_to_ext():
for ftype, ext in fsl.Info.ftypes.items():
res = fsl.Info.output_type_to_ext(ftype)
assert res == ext
with pytest.raises(KeyError):

with pytest.raises(KeyError):
fsl.Info.output_type_to_ext('JUNK')


Expand Down Expand Up @@ -60,11 +60,11 @@ def test_FSLCommand2():


@pytest.mark.skipif(no_fsl(), reason="fsl is not installed")
@pytest.mark.parametrize("args, desired_name",
[({}, {"file": 'foo.nii.gz'}), # just the filename
({"suffix": '_brain'}, {"file": 'foo_brain.nii.gz'}), # filename with suffix
({"suffix": '_brain', "cwd": '/data'},
{"dir": '/data', "file": 'foo_brain.nii.gz'}), # filename with suffix and working directory
@pytest.mark.parametrize("args, desired_name",
[({}, {"file": 'foo.nii.gz'}), # just the filename
({"suffix": '_brain'}, {"file": 'foo_brain.nii.gz'}), # filename with suffix
({"suffix": '_brain', "cwd": '/data'},
{"dir": '/data', "file": 'foo_brain.nii.gz'}), # filename with suffix and working directory
({"suffix": '_brain.mat', "change_ext": False}, {"file": 'foo_brain.mat'}) # filename with suffix and no file extension change
])
def test_gen_fname(args, desired_name):
Expand Down
16 changes: 8 additions & 8 deletions nipype/interfaces/fsl/tests/test_dti.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def test_dtifit2(create_files_in_directory):
filelist[1])


@pytest.mark.xfail(reason="These tests are skipped until we clean up some of this code")
@pytest.mark.xfail(reason="These tests are skipped until we clean up some of this code")
def test_randomise2():

rand = fsl.Randomise()
Expand All @@ -79,7 +79,7 @@ def test_randomise2():
assert rand.cmd == 'randomise'

# test raising error with mandatory args absent
with pytest.raises(ValueError):
with pytest.raises(ValueError):
rand.run()

# .inputs based parameters setting
Expand Down Expand Up @@ -155,7 +155,7 @@ def test_Randomise_parallel():
assert rand.cmd == 'randomise_parallel'

# test raising error with mandatory args absent
with pytest.raises(ValueError):
with pytest.raises(ValueError):
rand.run()

# .inputs based parameters setting
Expand Down Expand Up @@ -269,7 +269,7 @@ def test_Vec_reg():
assert vrg.cmd == 'vecreg'

# test raising error with mandatory args absent
with pytest.raises(ValueError):
with pytest.raises(ValueError):
vrg.run()

# .inputs based parameters setting
Expand Down Expand Up @@ -330,7 +330,7 @@ def test_Find_the_biggest():
assert fbg.cmd == 'find_the_biggest'

# test raising error with mandatory args absent
with pytest.raises(ValueError):
with pytest.raises(ValueError):
fbg.run()

# .inputs based parameters setting
Expand All @@ -355,12 +355,12 @@ def test_tbss_skeleton(create_files_in_directory):
skeletor = fsl.TractSkeleton()

files, newdir = create_files_in_directory

# Test the underlying command
assert skeletor.cmd == "tbss_skeleton"

# It shouldn't run yet
with pytest.raises(ValueError):
with pytest.raises(ValueError):
skeletor.run()

# Test the most basic way to use it
Expand All @@ -379,7 +379,7 @@ def test_tbss_skeleton(create_files_in_directory):
bones = fsl.TractSkeleton(in_file="a.nii", project_data=True)

# This should error
with pytest.raises(ValueError):
with pytest.raises(ValueError):
bones.run()

# But we can set what we need
Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/fsl/tests/test_epi.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_eddy_correct2(create_files_in_directory):
assert eddy.cmd == 'eddy_correct'

# test raising error with mandatory args absent
with pytest.raises(ValueError):
with pytest.raises(ValueError):
eddy.run()

# .inputs based parameters setting
Expand Down
18 changes: 9 additions & 9 deletions nipype/interfaces/fsl/tests/test_maths.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def create_files_in_directory(request):
nb.save(nb.Nifti1Image(img, np.eye(4), hdr),
os.path.join(testdir, f))

out_ext = Info.output_type_to_ext(Info.output_type())
out_ext = Info.output_type_to_ext(Info.output_type())

def fin():
if os.path.exists(testdir):
Expand Down Expand Up @@ -186,7 +186,7 @@ def test_meanimage(create_files_in_directory):
meaner = fsl.MeanImage(in_file="a.nii")
assert meaner.cmdline == "fslmaths a.nii -Tmean %s" % os.path.join(testdir, "a_mean%s" % out_ext)


@pytest.mark.skipif(no_fsl(), reason="fsl is not installed")
def test_stdimage(create_files_in_directory):
files, testdir, out_ext = create_files_in_directory
Expand All @@ -209,7 +209,7 @@ def test_stdimage(create_files_in_directory):
# Test the auto naming
stder = fsl.StdImage(in_file="a.nii")
#NOTE_dj, FAIL: this is failing (even the original version of the test with pytest)
#NOTE_dj: not sure if this should pass, it uses cmdline from interface.base.CommandLine
#NOTE_dj: not sure if this should pass, it uses cmdline from interface.base.CommandLine
#assert stder.cmdline == "fslmaths a.nii -Tstd %s"%os.path.join(testdir, "a_std.nii")


Expand Down Expand Up @@ -248,7 +248,7 @@ def test_smooth(create_files_in_directory):
assert smoother.cmd == "fslmaths"

# Test that smoothing kernel is mandatory
with pytest.raises(ValueError):
with pytest.raises(ValueError):
smoother.run()

# Test smoothing kernels
Expand Down Expand Up @@ -276,7 +276,7 @@ def test_mask(create_files_in_directory):
assert masker.cmd == "fslmaths"

# Test that the mask image is mandatory
with pytest.raises(ValueError):
with pytest.raises(ValueError):
masker.run()

# Test setting the mask image
Expand All @@ -299,7 +299,7 @@ def test_dilation(create_files_in_directory):
assert diller.cmd == "fslmaths"

# Test that the dilation operation is mandatory
with pytest.raises(ValueError):
with pytest.raises(ValueError):
diller.run()

# Test the different dilation operations
Expand Down Expand Up @@ -361,7 +361,7 @@ def test_spatial_filter(create_files_in_directory):
assert filter.cmd == "fslmaths"

# Test that it fails without an operation
with pytest.raises(ValueError):
with pytest.raises(ValueError):
filter.run()

# Test the different operations
Expand All @@ -385,7 +385,7 @@ def test_unarymaths(create_files_in_directory):
assert maths.cmd == "fslmaths"

# Test that it fails without an operation
with pytest.raises(ValueError):
with pytest.raises(ValueError):
maths.run()

# Test the different operations
Expand Down Expand Up @@ -488,4 +488,4 @@ def test_tempfilt(create_files_in_directory):
"fslmaths a.nii -bptf 64.000000 -1.000000 %s" % os.path.join(testdir, "a_filt%s" % out_ext)



20 changes: 10 additions & 10 deletions nipype/interfaces/fsl/tests/test_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def setup_infile(request):
tmp_dir = tempfile.mkdtemp()
tmp_infile = os.path.join(tmp_dir, 'foo' + ext)
open(tmp_infile, 'w')

def fin():
shutil.rmtree(tmp_dir)

Expand All @@ -50,7 +50,7 @@ def test_bet(setup_infile):
assert better.cmd == 'bet'

# Test raising error with mandatory args absent
with pytest.raises(ValueError):
with pytest.raises(ValueError):
better.run()

# Test generated outfile name
Expand All @@ -68,7 +68,7 @@ def test_bet(setup_infile):
# infile foo.nii doesn't exist
def func():
better.run(in_file='foo2.nii', out_file='bar.nii')
with pytest.raises(TraitError):
with pytest.raises(TraitError):
func()

# Our options and some test values for them
Expand Down Expand Up @@ -100,7 +100,7 @@ def func():
better.inputs.in_file = tmp_infile
realcmd = ' '.join([better.cmd, tmp_infile, outpath, settings[0]])
assert better.cmdline == realcmd

# test fast


Expand Down Expand Up @@ -196,7 +196,7 @@ def setup_flirt(request):
tmpdir = tempfile.mkdtemp()
_, infile = tempfile.mkstemp(suffix=ext, dir=tmpdir)
_, reffile = tempfile.mkstemp(suffix=ext, dir=tmpdir)

def teardown_flirt():
shutil.rmtree(tmpdir)

Expand Down Expand Up @@ -234,11 +234,11 @@ def test_flirt(setup_flirt):

flirter = fsl.FLIRT()
# infile not specified
with pytest.raises(ValueError):
with pytest.raises(ValueError):
flirter.run()
flirter.inputs.in_file = infile
# reference not specified
with pytest.raises(ValueError):
with pytest.raises(ValueError):
flirter.run()
flirter.inputs.reference = reffile
# Generate outfile and outmatrix
Expand Down Expand Up @@ -415,7 +415,7 @@ def test_fnirt(setup_flirt):

# Test ValueError is raised when missing mandatory args
fnirt = fsl.FNIRT()
with pytest.raises(ValueError):
with pytest.raises(ValueError):
fnirt.run()
fnirt.inputs.in_file = infile
fnirt.inputs.ref_file = reffile
Expand Down Expand Up @@ -507,7 +507,7 @@ def test_applywarp(setup_flirt):
settings[0])
assert awarp.cmdline == realcmd


@pytest.fixture(scope="module")
def setup_fugue(request):
import nibabel as nb
Expand All @@ -528,7 +528,7 @@ def teardown_fugue():

@pytest.mark.skipif(no_fsl(), reason="fsl is not installed")
@pytest.mark.parametrize("attr, out_file", [
({"save_unmasked_fmap":True, "fmap_in_file":"infile", "mask_file":"infile", "output_type":"NIFTI_GZ"},
({"save_unmasked_fmap":True, "fmap_in_file":"infile", "mask_file":"infile", "output_type":"NIFTI_GZ"},
'fmap_out_file'),
({"save_unmasked_shift":True, "fmap_in_file":"infile", "dwell_time":1.e-3, "mask_file":"infile", "output_type": "NIFTI_GZ"},
"shift_out_file"),
Expand Down
Loading