def test_outlierfunction():
    # Test outlierfunction
    # Test data 
    x = np.random.normal(size=(1000))
    expected = np.where(x>2)[0]
    actual = np.ravel(outlier(x, 2))
    # Did you forget to return the value?
    if actual is None:
        raise RuntimeError("function returned None")
    assert_allclose(expected, actual)
Esempio n. 2
0
def test_outlierfunction():
    # Test outlierfunction
    # Test data
    x = np.random.normal(size=(1000))
    expected = np.where(x > 2)[0]
    actual = np.ravel(outlier(x, 2))
    # Did you forget to return the value?
    if actual is None:
        raise RuntimeError("function returned None")
    assert_allclose(expected, actual)
Esempio n. 3
0
import numpy as np
from outlierfunction import outlier

for i in range(1,10):
    for j in range(1,4):
        # set general path for reaching dvars and fd files
        # also path for saving files
        txtpath='ds005/sub00'+`i`+'/BOLD/task001_run00'+`j`+'/QA/'
        # dvars path and name, call function to get outliers
        dvarsfile=txtpath+'dvars.txt'
        dvarssave=txtpath+'dvars_outlier_sub'+`i`+'run'+`j`+'.txt'
        # common boundary for dvars is 0.3 - 0.5
        # paper used 0.5
        dvars_outlier = outlier(dvarsfile,dvarssave, 0.5)
        # fd path and name, call function to get outliers
        fdfile=txtpath+'fd.txt'
        fdsave=txtpath+'fd_outlier_sub'+`i`+'run'+`j`+'.txt'
        # common boundary for fd is 0.2 - 0.5
        # paper used 0.5
        fd_outlier = outlier(fdfile, fdsave, 0.5)

for i in range(10,17):
    for j in range(1,4):
        # set general path for reaching dvars and fd files
        # also path for saving files
        txtpath='ds005/sub0'+`i`+'/BOLD/task001_run00'+`j`+'/QA/'
        # dvars path and name, call function to get outliers
        dvarsfile=txtpath+'dvars.txt'
        dvarssave=txtpath+'dvars_outlier_sub'+`i`+'run'+`j`+'.txt'
        # common boundary for dvars is 0.3 - 0.5
        # paper used 0.5
#This script calculates the outliers for subjects runs based on fd and dvars

dvars_out = {}
fd_out = {}

for i in range(1,10):
    for j in range(1,4):
        # set general path for reaching dvars and fd files
        # also path for saving files
        txtpath='../../data/ds005/sub00'+`i`+'/BOLD/task001_run00'+`j`+'/QA/'
        # dvars path and name, call function to get outliers
        dvarsfile=txtpath+'dvars.txt'
        dvars_data = np.loadtxt(dvarsfile)
        # common boundary for dvars is 0.3 - 0.5
        # paper used 0.5
        dvars_outlier = outlier(dvars_data, 0.5)
        dvars_out['sub'+`i`+'run'+`j`] = dvars_outlier[0].tolist()
        # fd path and name, call function to get outliers
        fdfile=txtpath+'fd.txt'
        fd_data = np.loadtxt(fdfile)
        # common boundary for fd is 0.2 - 0.5
        # paper used 0.5
        fd_outlier = outlier(fd_data, 0.5)
        fd_out['sub'+`i`+'run'+`j`] = fd_outlier[0].tolist()

for i in range(10,17):
    for j in range(1,4):
        # set general path for reaching dvars and fd files
        # also path for saving files
        txtpath='../../data/ds005/sub0'+`i`+'/BOLD/task001_run00'+`j`+'/QA/'
        # dvars path and name, call function to get outliers
Esempio n. 5
0
from outlierfunction import outlier

dvars_out = {}
fd_out = {}

for i in range(1, 10):
    for j in range(1, 4):
        # set general path for reaching dvars and fd files
        # also path for saving files
        txtpath = '../../data/ds005/sub00' + ` i ` + '/BOLD/task001_run00' + ` j ` + '/QA/'
        # dvars path and name, call function to get outliers
        dvarsfile = txtpath + 'dvars.txt'
        dvars_data = np.loadtxt(dvarsfile)
        # common boundary for dvars is 0.3 - 0.5
        # paper used 0.5
        dvars_outlier = outlier(dvars_data, 0.5)
        dvars_out['sub' + ` i ` + 'run' + ` j `] = dvars_outlier[0].tolist()
        # fd path and name, call function to get outliers
        fdfile = txtpath + 'fd.txt'
        fd_data = np.loadtxt(fdfile)
        # common boundary for fd is 0.2 - 0.5
        # paper used 0.5
        fd_outlier = outlier(fd_data, 0.5)
        fd_out['sub' + ` i ` + 'run' + ` j `] = fd_outlier[0].tolist()

for i in range(10, 17):
    for j in range(1, 4):
        # set general path for reaching dvars and fd files
        # also path for saving files
        txtpath = '../../data/ds005/sub0' + ` i ` + '/BOLD/task001_run00' + ` j ` + '/QA/'
        # dvars path and name, call function to get outliers
Esempio n. 6
0
import numpy as np
from outlierfunction import outlier

for i in range(1, 10):
    for j in range(1, 4):
        # set general path for reaching dvars and fd files
        # also path for saving files
        txtpath = 'ds005/sub00' + ` i ` + '/BOLD/task001_run00' + ` j ` + '/QA/'
        # dvars path and name, call function to get outliers
        dvarsfile = txtpath + 'dvars.txt'
        dvarssave = txtpath + 'dvars_outlier_sub' + ` i ` + 'run' + ` j ` + '.txt'
        # common boundary for dvars is 0.3 - 0.5
        # paper used 0.5
        dvars_outlier = outlier(dvarsfile, dvarssave, 0.5)
        # fd path and name, call function to get outliers
        fdfile = txtpath + 'fd.txt'
        fdsave = txtpath + 'fd_outlier_sub' + ` i ` + 'run' + ` j ` + '.txt'
        # common boundary for fd is 0.2 - 0.5
        # paper used 0.5
        fd_outlier = outlier(fdfile, fdsave, 0.5)

for i in range(10, 17):
    for j in range(1, 4):
        # set general path for reaching dvars and fd files
        # also path for saving files
        txtpath = 'ds005/sub0' + ` i ` + '/BOLD/task001_run00' + ` j ` + '/QA/'
        # dvars path and name, call function to get outliers
        dvarsfile = txtpath + 'dvars.txt'
        dvarssave = txtpath + 'dvars_outlier_sub' + ` i ` + 'run' + ` j ` + '.txt'
        # common boundary for dvars is 0.3 - 0.5
        # paper used 0.5