def gen_composite(self, condname, overwrite=False): """Create linear composite for condition. """ #TODO overwrite data = (run.load(standardized=True, threshold=True) for run in self.iter_runs(condname)) shape = self.iter_runs(condname).next().load().shape composite = sum_tc(data, shape=shape, standardize_out=False) cond = self.get_cond(condname) dset = cond.require_dataset('composite', shape=composite.shape, dtype=composite.dtype) dset[...] = composite
def isc_within_diff(A, B, standardized=False): """Contrast within-group subject-total correlation for A and B. This function operates on the timecourse data, so is slower than isc_corrmat_within_diff. Inputs may be multi-dimensional. The last dimension is used for correlations (e.g. time should be last). Arguments: A (list): List of timecourse data for each member of group A. B (list): Timecourses of same length as A. Returns: ndarray with isc for A minus isc for B. """ isc = lambda L, ttl: nanmean([corcomposite(dat, ttl, standardized=standardized) for dat in L], axis=0) A_composite = sum_tc(A) B_composite = sum_tc(B) A_mean_isc = isc(A, A_composite) B_mean_isc = isc(B, B_composite) return A_mean_isc - B_mean_isc