diff --git a/eMouse_drift/main_eMouse_drift.m b/eMouse_drift/main_eMouse_drift.m index cbbdf57a..e87af851 100644 --- a/eMouse_drift/main_eMouse_drift.m +++ b/eMouse_drift/main_eMouse_drift.m @@ -4,18 +4,18 @@ sortData = 1; runBenchmark = 1; %set to 1 to compare sorted data to ground truth for the simulation -fpath = 'C:\Users\labadmin\Documents\jic\050320_sim_test\'; % where on disk do you want the simulation? ideally an SSD... +fpath = 'G:\Spikes\eMouse\'; % where on disk do you want the simulation? ideally an SSD... if ~exist(fpath, 'dir'); mkdir(fpath); end %KS2 path -- also has the waveforms for the simulation -KS2path = 'C:\Users\labadmin\Documents\jic\KS2_040920\Kilosort2\'; +KS2path = 'D:\GitHub\KiloSort2\'; % add paths to the matlab path -addpath(genpath('C:\Users\labadmin\Documents\jic\KS2_040920\Kilosort2\')); % path to kilosort2 folder -addpath(genpath('C:\Users\labadmin\Documents\jic\npy-matlab-master\')); +addpath(genpath('D:\GitHub\KiloSort2')) % path to kilosort folder +addpath('D:\GitHub\npy-matlab') % for converting to Phy % path to whitened, filtered proc file (on a fast SSD) -rootH = 'D:\kilosort_datatemp\'; +rootH = 'G:\Spikes\eMouse\'; % path to config file; if running the default config, no need to change. pathToYourConfigFile = [KS2path,'eMouse_drift\']; % path to config file @@ -42,7 +42,7 @@ end % % Run kilosort2 on the simulated data - +%% if( sortData ) % common options for every probe @@ -51,6 +51,10 @@ ops.NchanTOT = NchanTOT; % total number of channels in your recording ops.trange = [0 Inf]; % TIME RANGE IN SECONDS TO PROCESS + ops.sig = 20; % spatial smoothness constant for registration + ops.fshigh = 300; % high-pass more aggresively + ops.nblocks = 5; % blocks for registration. 0 turns it off, 1 does rigid registration. Replaces "datashift" option. + ops.fproc = fullfile(rootH, 'temp_wh.dat'); % proc file on a fast SSD @@ -64,14 +68,14 @@ % preprocess data to create temp_wh.dat rez = preprocessDataSub(ops); - % pre-clustering to re-order batches by depth - rez = clusterSingleBatches(rez); + % NEW STEP TO DO DATA REGISTRATION + rez = datashift2(rez, 1); % last input is for shifting data +% rez2 = datashift2(rez, 0); % last input is for shifting data + % main optimization - % learnAndSolve8; - rez = learnAndSolve8b(rez); + rez = learnAndSolve8b(rez, 1); - % final splits rez = find_merges(rez, 1); @@ -79,12 +83,10 @@ % final splits by SVD rez = splitAllClusters(rez, 1); - % final splits by amplitudes - rez = splitAllClusters(rez, 0); - % decide on cutoff rez = set_cutoff(rez); - + rez.good = get_good_units(rez); + % this saves to Phy rezToPhy(rez, rootZ); @@ -108,7 +110,7 @@ fclose(fileID); % remove temporary file - delete(ops.fproc); +% delete(ops.fproc); end diff --git a/eMouse_drift/make_eMouseData_drift.m b/eMouse_drift/make_eMouseData_drift.m index 527e5eb4..23315a77 100644 --- a/eMouse_drift/make_eMouseData_drift.m +++ b/eMouse_drift/make_eMouseData_drift.m @@ -5,8 +5,8 @@ function make_eMouseData_drift(fpath, KS2path, chanMapName, useGPU, useParPool) % probe sites. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % you can play with the parameters just below here to achieve a signal more similar to your own data!!! -norm_amp = 16.7; % if 0, use amplitudes of input waveforms; if > 0, set all amplitudes to norm_amp*rms_noise -mu_mean = 0.75; % mean of mean spike amplitudes. Incoming waveforms are in uV; make <1 to make sorting harder +norm_amp = 1.5 * 16.7; % if 0, use amplitudes of input waveforms; if > 0, set all amplitudes to norm_amp*rms_noise +mu_mean = .75; %0.75; % mean of mean spike amplitudes. Incoming waveforms are in uV; make <1 to make sorting harder noise_model = 'gauss'; %'gauss' or 'fromData'; 'fromData' requires a noiseModel.mat built by make_noise_model rms_noise = 10; % rms noise in uV. Will be added to the spike signal. 15-20 uV an OK estimate from real data t_record = 1200; % duration in seconds of simulation. longer is better (and slower!) (1000) @@ -24,7 +24,7 @@ function make_eMouseData_drift(fpath, KS2path, chanMapName, useGPU, useParPool) drift.y0 = 3800; %in um, position along probe where motion is largest %y = 0 is the tip of the probe drift.halfDistance = 1000; %in um, distance along probe over which the motion decays -drift.amplitude = 10; %in um for a sine wave +drift.amplitude = 5; %in um for a sine wave % peak variation is 2Xdrift.amplitude drift.halfLife = 2; %in seconds drift.period = 600; %in seconds diff --git a/preProcess/datashift2.m b/preProcess/datashift2.m index e375d01b..21bdf181 100644 --- a/preProcess/datashift2.m +++ b/preProcess/datashift2.m @@ -23,7 +23,7 @@ npt = floor(xrange/16); % this would come out as 16um for Neuropixels probes, which aligns with the geometry. rez.ops.xup = linspace(xmin, xmax, npt+1); % centers of the upsampled x positions -spkTh = 10; % same as the usual "template amplitude", but for the generic templates +spkTh = 8; % same as the usual "template amplitude", but for the generic templates % Extract all the spikes across the recording that are captured by the % generic templates. Very few real spikes are missed in this way.