예제 #1
0
    def setup(self):
        self.orig_path = os.getcwd()
        self.tmpdir = tempfile.mkdtemp()
        setup_fname = os.path.abspath('setup_example.py')
        self.perm_fname = os.path.abspath('cli/permute_isc_within.py')

        os.chdir(self.tmpdir)
        subprocess.call(['python', setup_fname, 'test'])
        print os.listdir('.')

        f = h5py.File('test.h5')
        E = subject.Exp(f)

        print self.config
        E.setup(self.config, create_conds=True)
        cond = E.get_cond('test_cond')
        for run in E.iter_runs(cond):
            run.threshold(cond.attrs['threshold'], save=True)

        E.gen_composite('test_cond')
        isc_within(E, cond)

        E.gen_cond_thresh('test_cond')
        E.f.file.flush()
        self.E = E
예제 #2
0
    def setup(self):
        self.orig_path = os.getcwd()
        self.tmpdir = tempfile.mkdtemp()
        setup_fname = os.path.abspath("setup_example.py")
        self.perm_fname = os.path.abspath("cli/permute_isc_within.py")

        os.chdir(self.tmpdir)
        subprocess.call(["python", setup_fname, "test"])
        print os.listdir(".")

        f = h5py.File("test.h5")
        E = subject.Exp(f)

        print self.config
        E.setup(self.config, create_conds=True)
        cond = E.get_cond("test_cond")
        for run in E.iter_runs(cond):
            run.threshold(cond.attrs["threshold"], save=True)

        E.gen_composite("test_cond")
        isc_within(E, cond)

        E.gen_cond_thresh("test_cond")
        E.f.file.flush()
        self.E = E
예제 #3
0
for condname in config['conds']:
    cond = E.get_cond(condname)
    for run in E.iter_runs(condname):
        run.threshold(cond.attrs['threshold'], save=True)

    # Alignment -------------------------------------------
    a1 = E.f['rois/audenv_3mm_gdboth_wordscram_mean_thr0.2'][
        ...]  #TODO remove hardcoded roi?
    aud_env = cond['audio_env']
    # Calculate lags over range, then set offset
    lags = xrange(-5, 5)
    for run in E.iter_runs(condname):
        data = run.load(roi=a1, standardized=True,
                        threshold=True)  #slice(None,None,None))
        corrs = [lagcor(data, aud_env, h=h) for h in lags]
        print corrs
        offset = lags[np.argmax(corrs)]
        run.attrs['offset'] = offset

    # With offsets down, can generate composite
    if condname != "dummy": E.gen_composite(condname)

# ISC Calculations ----------------------------------------

cond1 = E.get_cond('wordscram')  # conditions for calculations
cond2 = E.get_cond('wordscram2')

# Run calculations
isc_within(E, cond1)
isc_between(E, cond1, cond2, method='inter-subject')
예제 #4
0
파일: run_pipe.py 프로젝트: machow/pycorr
# Iterate over conditions ---------------------------------

for condname in config['conds']:
    cond = E.get_cond(condname)
    for run in E.iter_runs(condname):
        run.threshold(cond.attrs['threshold'], save=True)

    # Alignment -------------------------------------------
    a1 = E.f['rois/audenv_3mm_gdboth_wordscram_mean_thr0.2'][...]   #TODO remove hardcoded roi?
    aud_env = cond['audio_env']
    # Calculate lags over range, then set offset
    lags = xrange(-5,5)
    for run in E.iter_runs(condname):
        data = run.load(roi=a1, standardized=True, threshold=True)#slice(None,None,None))
        corrs = [lagcor(data, aud_env, h=h) for h in lags]
        print corrs
        offset = lags[np.argmax(corrs)]
        run.attrs['offset'] = offset

    # With offsets down, can generate composite
    if condname != "dummy":E.gen_composite(condname)

# ISC Calculations ----------------------------------------

cond1 = E.get_cond('wordscram')     # conditions for calculations
cond2 = E.get_cond('wordscram2')

# Run calculations
isc_within(E, cond1)
isc_between(E, cond1, cond2, method='inter-subject')