import genlinmod_multidimensional as glm from omb import OMB from stimulus import Stimulus exp, stim_nr = '20180710', 8 #exp, stim_nr = 'Kuehn', 13 st = OMB(exp, stim_nr) glmlabel = 'GLM_motion' savepath = os.path.join(st.stim_dir, glmlabel) os.makedirs(savepath, exist_ok=True) omb_stas = np.array(st.read_datafile()['stas']) texture_data = st.read_texture_analysis() all_spikes = st.allspikes() start = dt.datetime.now() kall = np.zeros((st.nclusters, 2, st.filter_length)) muall = np.zeros(st.nclusters) frs = np.zeros(all_spikes.shape) cross_corrs = np.zeros(st.nclusters) t = np.linspace(0, st.filter_length * st.frame_duration * 1000, st.filter_length)
import nonlinearity as nlt from omb import OMB exp_name, stim_nr = '20180710_kilosorted', 8 #exp_name, stim_nr = 'Kuehn', 13 val_split_size = 0.1 val_split_pos = 0.5 st = OMB(exp_name, stim_nr, maxframes=None) data = st.read_datafile() stimdim = 3 # Add placeholder contrast row, this will be different for # each cell stimulus = np.zeros((stimdim, st.ntotal)) stimulus[:2, ...] = st.bgsteps gqmlabel = 'GQM_motioncontrast_val' fl = st.filter_length t = np.arange(0, st.filter_length*st.frame_duration, st.frame_duration)*1000 savedir = os.path.join(st.exp_dir, 'data_analysis', st.stimname, gqmlabel)
exp, ombstimnr = '20180710_kilosorted', 8 checkerstimnr = 6 st = OMB(exp, ombstimnr, maxframes=None) choosecells = [8, 33, 61, 73, 79] nrcells = len(choosecells) all_spikes = st.allspikes()[choosecells, :] rw = asc.rolling_window(st.bgsteps, st.filter_length) motionstas = np.array(st.read_datafile()['stas'])[choosecells, :] motionstas /= all_spikes.sum(axis=(-1))[:, np.newaxis, np.newaxis] #%% Filter the stimuli # Euclidian norm motionstas_norm = motionstas / np.sqrt( (motionstas**2).sum(axis=-1))[:, :, None] bgsteps = st.bgsteps / np.sqrt(st.bgsteps.var()) rw = asc.rolling_window(bgsteps, st.filter_length) steps_proj = np.einsum('abc,bdc->ad', motionstas_norm, rw) nbins = 15 bins = np.zeros((nrcells, nbins))