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 stacnbackFig(m1, stac=.8): stim = gwn.getstim('bl') uc = ucse(stim) rc = evalSystem(m1, True, cid=0) iss = istac.istacspace(rc, uc, stac)['vecs'] plt.figure(3) plt.clf() _prow(rc, None, 0) rc1 = np.dot(iss.transpose(), rc) _prow(rc1, None, 1) rc2 = np.dot(iss, rc1) _prow(rc2, None, 2) f = plt.figure(3) f.subplots_adjust(left=.04, right=.99, bottom=.05, top=.99, wspace=.05, hspace=.05) f.canvas.draw()
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
def bigFig(m1, m2, compress='istac', clevel=.85): stim = gwn.getstim('bl') uc = ucse(stim) rcse = evalSystem(m1, True, cid=0) rcse2 = evalSystem(m2, True, cid=1) rc = eqrc((rcse, rcse2)) iss = DRMODES[compress](rc, uc, clevel) report('Using %i components' % iss.shape[0]) plt.figure(3) plt.clf() ll = lltest(rcse, rcse2) _prow(rcse, rcse2, 0, 3, True, ll) rc1 = np.dot(iss, rcse) rc2 = np.dot(iss, rcse2) ll = lltest(rc1, rc2) _prow(rc1, rc2, 1, 3, True, ll) rcb1 = np.dot(iss.transpose(), rc1) rcb2 = np.dot(iss.transpose(), rc2) #ll = lltest(rcb1, rcb2) _prow(rcb1, rcb2, 2, 3, True, ll) f = plt.figure(3) f.subplots_adjust(left=.04, right=.99, bottom=.05, top=.99, wspace=.05, hspace=.05) f.canvas.draw()