Saving configs in .mat, hdsort_master.m as function
+function hdsort_master(outputFolder, hdsortPath)
try
% prepare for kilosort execution
- addpath(genpath('{hdsort_path}'));
+ addpath(genpath(hdsortPath));
- %% Add 'External' functions to path:
- setup()
-
- mainFolder = '.';
- rawFile = '{file_name}';
-
- %% Get a handle onto the raw file, which will then be used as input to the sorter:
- sortingName = '{sort_name}';
- fileFormat = '{file_format}';
-
- %% Load params
- load(fullfile('{output_folder}', 'Params.mat'))
+ %% Load sorter configs and params
+ load(fullfile(outputFolder, 'configsParams.mat'))
if (strcmp(fileFormat, 'maxwell'))
RAW = hdsort.file.MaxWellFile(rawFile);
@@ -24,6 +15,7 @@ try
RAW.restrictToConnectedChannels(); % This line is very important to not sort empty electrodes!
%% Create the object that performs the sorting:
+ mainFolder = '.';
HDSorting = hdsort.Sorting(RAW, mainFolder, sortingName)
%% Preprocess:
@@ -39,11 +31,11 @@ try
% allowing the parallel processes to be run on a small desktop computer or
% laptop.
- chunkSize = {chunk_size}; % This number depends a lot on the available RAM
+ chunkSize = chunkSize; % This number depends a lot on the available RAM
HDSorting.preprocess('chunkSize', chunkSize, 'forceFileDeletionIfExists', true);
%% Sort each LEG independently:
- HDSorting.sort('sortingMode', '{loop_mode}'); % (default)
+ HDSorting.sort('sortingMode', loopMode); % (default)
% Alternative sorting modes are:
% HDSorting.sort('sortingMode', 'local'); % for loop over each LEG
% HDSorting.sort('sortingMode', 'grid'); % requires a computer grid architecture
@@ -62,3 +54,4 @@ catch
quit(1);
end
quit(0);
+end
