Example #1
0
        setattr(js.inputs, key, val)
        expected_data[key] = val

    res = js.run()
    with open(res.outputs.out_file, 'r') as f:
        data = simplejson.load(f)

    assert data == expected_data


# There are three reasons these tests will be skipped:
@pytest.mark.skipif(not have_pybids,
                    reason="Pybids is not installed")
@pytest.mark.skipif(sys.version_info < (3, 0),
                    reason="Pybids no longer supports Python 2")
@pytest.mark.skipif(not dist_is_editable('pybids'),
                    reason="Pybids is not installed in editable mode")
def test_bids_grabber(tmpdir):
    tmpdir.chdir()
    bg = nio.BIDSDataGrabber()
    bg.inputs.base_dir = os.path.join(datadir, 'ds005')
    bg.inputs.subject = '01'
    results = bg.run()
    assert os.path.basename(results.outputs.anat[0]) == 'sub-01_T1w.nii.gz'
    assert os.path.basename(results.outputs.func[0]) == (
        'sub-01_task-mixedgamblestask_run-01_bold.nii.gz')


@pytest.mark.skipif(not have_pybids,
                    reason="Pybids is not installed")
@pytest.mark.skipif(sys.version_info < (3, 0),
Example #2
0
    for key, val in inputs_attributes.items():
        setattr(js.inputs, key, val)
        expected_data[key] = val

    res = js.run()
    with open(res.outputs.out_file, 'r') as f:
        data = simplejson.load(f)

    assert data == expected_data


# There are three reasons these tests will be skipped:
@pytest.mark.skipif(not have_pybids, reason="Pybids is not installed")
@pytest.mark.skipif(sys.version_info < (3, 0),
                    reason="Pybids no longer supports Python 2")
@pytest.mark.skipif(not dist_is_editable('pybids'),
                    reason="Pybids is not installed in editable mode")
def test_bids_grabber(tmpdir):
    tmpdir.chdir()
    bg = nio.BIDSDataGrabber()
    bg.inputs.base_dir = os.path.join(datadir, 'ds005')
    bg.inputs.subject = '01'
    results = bg.run()
    assert 'sub-01_T1w.nii.gz' in map(os.path.basename, results.outputs.anat)
    assert 'sub-01_task-mixedgamblestask_run-01_bold.nii.gz' in \
        map(os.path.basename, results.outputs.func)


@pytest.mark.skipif(not have_pybids, reason="Pybids is not installed")
@pytest.mark.skipif(sys.version_info < (3, 0),
                    reason="Pybids no longer supports Python 2")
Example #3
0
    setattr(js.inputs, "contrasts.alt", "someNestedValue")
    expected_data = {"contrasts": {"alt": "someNestedValue"}, "foo": "var"}
    for key, val in inputs_attributes.items():
        setattr(js.inputs, key, val)
        expected_data[key] = val

    res = js.run()
    with open(res.outputs.out_file, "r") as f:
        data = simplejson.load(f)

    assert data == expected_data


# There are three reasons these tests will be skipped:
@pytest.mark.skipif(not have_pybids, reason="Pybids is not installed")
@pytest.mark.skipif(not dist_is_editable("pybids"),
                    reason="Pybids is not installed in editable mode")
def test_bids_grabber(tmpdir):
    tmpdir.chdir()
    bg = nio.BIDSDataGrabber()
    bg.inputs.base_dir = os.path.join(datadir, "ds005")
    bg.inputs.subject = "01"
    results = bg.run()
    assert "sub-01_T1w.nii.gz" in map(os.path.basename, results.outputs.T1w)
    assert "sub-01_task-mixedgamblestask_run-01_bold.nii.gz" in map(
        os.path.basename, results.outputs.bold)


@pytest.mark.skipif(not have_pybids, reason="Pybids is not installed")
@pytest.mark.skipif(not dist_is_editable("pybids"),
                    reason="Pybids is not installed in editable mode")