import nonlinearity as nlt import genlinmod as glm from omb import OMB from stimulus import Stimulus #exp, stim_nr = '20180710', 8 #exp, stim_nr = 'Kuehn', 13 fff_stimnr = asc.stimulisorter(exp)['fff'][0] st = OMB(exp, stim_nr) fff = Stimulus(exp, fff_stimnr) # Get rid of list of numpy arrays fff_stas = np.array(fff.read_datafile()['stas']) glmlabel = 'GLM_contrast' savepath = os.path.join(st.stim_dir, glmlabel) os.makedirs(savepath, exist_ok=True) texture_data = st.read_texture_analysis() all_spikes = st.allspikes() start = dt.datetime.now() kall = np.zeros((st.nclusters, st.filter_length)) muall = np.zeros(st.nclusters)
phasic_index = np.abs(posarea + negarea) / (np.abs(negarea) + np.abs(posarea)) # Ravi et al., 2019 J.Neurosci biphasic_index = 1 - phasic_index return biphasic_index def biphasic_index3(sta): return np.abs(sta.max() + sta.min()) / (np.abs(sta.max()) + np.abs(sta.min())) def biphasic_index3_stas(stas): maxs = stas.max(axis=1) mins = stas.min(axis=1) return 1 - (np.abs(maxs + mins) / (np.abs(maxs) + np.abs(mins))) ff = Stimulus('20180710', 1) ff = Stimulus('Kuehn', 2) data = ff.read_datafile() stas = np.array(data['stas']) bps = np.empty(ff.nclusters) bps2 = np.empty(ff.nclusters) bps3 = biphasic_index3_stas(stas) #%% for i in range(ff.nclusters): pospeaks = find_peaks(stas[i, :], prominence=.2)[0] negpeaks = find_peaks(-stas[i, :], prominence=.2)[0] peaks = np.sort(np.hstack((pospeaks, negpeaks))) plt.plot(stas[i, :]) plt.plot(peaks, stas[i, peaks], 'ro') if peaks.shape[0] == 2: