Exemplo n.º 1
0
 def lagcor_is_trimcor(self, h):
     a = self.a
     b = self.b
     assert_almost_equal(lagcor(a, b, h),
                         corsubs(trim(a, h=h), trim(b, h=-h)))
Exemplo n.º 2
0
 def lagcor_equal_subcor(self, key, standardized=False):
     x, y = self.ts[key][0:2]
     assert_almost_equal(lagcor(x, y, 0), corsubs(x, y))
Exemplo n.º 3
0
 def lagcor_is_shiftcor(self, h):
     a = self.a
     b = self.b
     outlen = a.shape[-1] - h
     assert_almost_equal(lagcor(a, b, h),
                         corsubs(shift(a, h), shift(b, 0, outlen)))
Exemplo n.º 4
0
 def lagcor_is_trimcor(self, h):
     a = self.a
     b = self.b
     assert_almost_equal(lagcor(a,b,h),
                         corsubs(trim(a, h=h), trim(b, h=-h)))
Exemplo n.º 5
0
 def lagcor_is_shiftcor(self, h):
     a = self.a
     b = self.b
     outlen = a.shape[-1]-h
     assert_almost_equal(lagcor(a, b, h), 
                         corsubs(shift(a, h), shift(b, 0, outlen)))
Exemplo n.º 6
0
 def lagcor_equal_subcor(self, key, standardized=False):
     x, y = self.ts[key][0:2]
     assert_almost_equal(lagcor(x,y,0), corsubs(x,y))
Exemplo n.º 7
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')
Exemplo n.º 8
0
# 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')