def cSpaceSet(d, cmode='istac', clevel=3): #FIXME: assumes particular structure for D. Should be a transform. uc1 = ucse(d['s1'], 10000, LENGTH) uc2 = ucse(d['s2'], 10000, LENGTH) rc1 = ece(d['s1'], d['evts1'], LENGTH, LEAD) rc2 = ece(d['s2'], d['evts2'], LENGTH, LEAD) istacs = {} istacs['uc'] = comp(uc2, uc1, clevel) istacs['rc'] = comp(rc2, rc1, clevel) istacs['c1'] = comp(rc1, uc1, clevel) istacs['c2'] = comp(rc2, uc2, clevel) istacs['j'] = comp(eqrc((rc1, rc2)), np.column_stack([uc1, uc2]), clevel) return istacs
def comp2s(stim1, evts1, stim2, evts2, length=LENGTH, lead=LEAD, compress='no', clevel=0, testprop=TESTPROP, bootstrap=BOOTSTRAP, report=None): ''' Like compare, but considers the case where there are two stimuli in addition to two response sets ''' rc1 = ece(stim1, evts1, length, lead) rc2 = ece(stim2, evts2, length, lead) if compress in DRMODES: uc = np.column_stack([ucse(stim1, 10000, length), ucse(stim2, 10000, length)]) ce = eqrc((rc1, rc2)) cspace = DRMODES[compress](ce, uc, clevel) if report: report('Using %i components' % cspace.shape[0]) rc1 = np.dot(cspace, rc1) rc2 = np.dot(cspace, rc2) return lltest(rc1, rc2, testprop, bootstrap)
def evalSystem(m, ens=False, bl=True, cid=0): if not type(m[0]) in [tuple, list]: nd = int((-5 + np.sqrt(25 + 8 * len(m))) / 2) m = (m[:nd], m[nd:2 * nd], m[2 * nd:]) if bl: stim = gwn.getstim('bl') else: stim = gwn.getstim('raw') evts = acell.gmatchCell(stim, m[0], m[1], m[2], cid) if not ens: return evts else: return ece(stim, evts)
def runSystems(stimuli=STIMS_BAND_OL, systems=(M200_FO,), stimlength=800, length=60, lead=40, label="A", date="", comments="", edet=(1.0, .01)): ''' stimuli is a list of "band" parameter tuples. Systems is a list of (off, mean, cov) test system parameter tuples. "l" is a stimulus length. Constructs each stimulus in the stimulus list, and passes it to each system. ''' if not date: date = time.strftime("%m%d%y") s = gd.Doc() s['label'] = 'iSTACe' + date + label s['comments'] = comments s['samplerate'] = 1000.0 s['stimlength'] = stimlength s['enslength'] = length s['enslead'] = lead s['eventgenerator'] = 'peakdet' for i, b in enumerate(stimuli): sn = "s%i" % i s[sn + '._'] = gwn.getstim('bl', stimlength, b) s[sn + '.band'] = b un = "u%i" % i s[un + '._'] = ucse(s[sn + '._'], 10000, length) for i, p in enumerate(systems): mn = "m%i" % i off, mu, sig = p d = {'mu': mu, 'off': off, 'sigma': sig, 'cid': i, 'ejit': edet[0], 'ethresh': edet[1]} s.set(mn, d) for j in range(len(stimuli)): en = "e%i_%i" % (i, j) sn = "s%i" % j d['outpath'] = en d['stimpath'] = "->" + sn s = s.fuse(acell(s, d)[0]) s[en + '.stim'] = {'_link': sn} s[en + '.sys'] = {'_link': mn} rn = "r%i_%i" % (i, j) s[rn + '._'] = ece(s[sn + '._'], s[en + '._'], length, lead) s[rn + '.stim'] = {'_link': sn} s[rn + '.sys'] = {'_link': mn} return s