Exemplo n.º 1
0
def test_plotmotionparams(create_files_in_directory_plus_output_type):
    filelist, outdir, _ = create_files_in_directory_plus_output_type
    parfiles = create_parfiles()
    plotter = fsl.PlotMotionParams()

    # make sure command gets called
    assert plotter.cmd == "fsl_tsplot"

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

    # .inputs based parameters setting
    plotter.inputs.in_file = parfiles[0]
    plotter.inputs.in_source = "fsl"
    plotter.inputs.plot_type = "rotations"
    plotter.inputs.out_file = "foo.png"
    assert plotter.cmdline == (
        "fsl_tsplot -i %s -o foo.png -t 'MCFLIRT estimated rotations (radians)' "
        "--start=1 --finish=3 -a x,y,z" % parfiles[0]
    )

    # .run based parameter setting
    plotter2 = fsl.PlotMotionParams(
        in_file=parfiles[1],
        in_source="spm",
        plot_type="translations",
        out_file="bar.png",
    )
    assert plotter2.cmdline == (
        "fsl_tsplot -i %s -o bar.png -t 'Realign estimated translations (mm)' "
        "--start=1 --finish=3 -a x,y,z" % parfiles[1]
    )
Exemplo n.º 2
0
def test_plotmotionparams():
    filelist, outdir, cwd = create_files_in_directory()
    parfiles = create_parfiles()
    plotter = fsl.PlotMotionParams()

    # make sure command gets called
    yield assert_equal, plotter.cmd, 'fsl_tsplot'

    # test raising error with mandatory args absent
    yield assert_raises, ValueError, plotter.run

    # .inputs based parameters setting
    plotter.inputs.in_file = parfiles[0]
    plotter.inputs.in_source = 'fsl'
    plotter.inputs.plot_type = 'rotations'
    plotter.inputs.out_file = 'foo.png'
    yield assert_equal, plotter.cmdline, \
        ('fsl_tsplot -i %s -o foo.png -t \'MCFLIRT estimated rotations (radians)\' '
         '--start=1 --finish=3 -a x,y,z' % parfiles[0])

    # .run based parameter setting
    plotter2 = fsl.PlotMotionParams(in_file=parfiles[1],
                                    in_source='spm',
                                    plot_type='translations',
                                    out_file='bar.png')
    yield assert_equal, plotter2.cmdline, \
        ('fsl_tsplot -i %s -o bar.png -t \'Realign estimated translations (mm)\' '
         '--start=1 --finish=3 -a x,y,z' % parfiles[1])

    clean_directory(outdir, cwd)