def processSTA(expName='GNS', spikeFile='GaussianNatScene.spk', dnew={}): ''' Load spikes from spikeFile Extract last parameters used from expName in parameters.txt Update any parameters according to dnew (in case I want to change something) do whatever processing I feel is necessary ''' # load basic dictionary with experimental data and all cells print('Loading cells and variables') d, cells = divideSpikesPerCondition(*preProcess(expName, spikeFile)) d.update(dnew) # compute PSTHs psths = ba.processNested(ba.psth, 0, cells, d['fixationLength'], d['trialsN'], returnFlag=1) psthsX = ba.psth(cells[0][0][0], d['fixationLength'], d['trialsN'], returnFlag=2) # load Gaussian noise wave to be able to correlate print('Loading noise') noise = loadNoise(d, (2)) # create stimulus object stim = st.stimulus(noise, d=d) # upsample stim to about 5ms time bins stim = stim.upsamplestim(int(stim.deltaT/.005)) # compute STA for each condition print('Computing stas') stas = ba.processNested(ft.getsta, 2, stim.tsa, stim.stim, cells, 100, returnFlag = 1) # compute one x axis for all stas print('Computing stas X axis') stasX = ft.getsta(stim.tsa, stim.stim, cells[0][0][0], 100, returnFlag=2) # since in GNS filter sign is irrelevant, flip them to have negative peaks (off like filters) stas = ba.processNested(flipSTA, 0, stas) # since on/off filters are somewhat arbitrary with these stimulus, force them all to be of the same type (peak being off) #return d, cells, psths, psthsX return d, stim, cells, psths, psthsX, stas, stasX, stim
def getsta(*argv, **kwargv): #_pdb.set_trace() a1=ft.getsta(*argv, **kwargv) b1=flipSTA(a1) return b1