import catacomb from string import ljust csys = catacomb.Sys csys.init() csys.setInteractor(catacomb.GuiInteractor()) def iafdemo(): csys.setBatchMode() csys.loadFile("iafdemo.ccm") calc = csys.getObjectByName("iafcalc") spikes = csys.getObjectByName("spikes") wf = csys.getObjectByName("wavefo_0") f = open('batchresults.txt','w') for i in range(50): yin = -20 + 1.5 * i wf.movePoint(2, 0, yin) calc.batchRun() tspk = spikes.getSpikes() n23 = nBetween(tspk[2][3], 30, 60) n24 = nBetween(tspk[2][4], 30, 60) print 'stim, n23, n24: ' + `yin` + ' ' + `n23` + ' ' + `n24` f.write(ljust(`yin`, 12)) f.write(ljust(`n23`, 12)) f.write(ljust(`n24`, 12)) f.write('\n') f.close() def nBetween (a, t1, t2): n = 0 for x in a: if x > t1 and x < t2: n = n + 1 return n