Main.m 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. %Written by Andrey Vinogradov, 2021
  2. %ADD THE CODE DIRECTORY TO MATLAB PATH [either manually or]:
  3. %addpath(genpath('your folder'));
  4. [files,path] = uigetfile('*.h5*', 'Select files for analysis','MultiSelect','on');%(filter)
  5. if iscell(files)
  6. list=cellfun(@(x) [path x], files,'UniformOutput',false);
  7. list=list';
  8. else
  9. list={[path files]};
  10. end
  11. %% PARAMETERS
  12. parameters.min_ref_per = 1.5; %detector dead time (in ms)
  13. parameters.w_pre = 20; %number of pre-event data points stored (def. 20)
  14. parameters.w_post = 44; %number of post-event data points stored (def. 44)
  15. %for sampling frequency 24000Hz, pre 20 events, post 44 events
  16. %Reference values. Adjusted for actual sampling frequency deeper in the code
  17. % 24000 events/s -> 20/24000, 44/24000 = handles.par.w_post/handles.par.sr
  18. % pre + post ==> amount of points stored per spike
  19. parameters.detection = 'both'; %type of threshold 'both','neg' or 'pos'
  20. parameters.stdmin = 4.5; %minimum threshold (def. 5) for the operation with SWTTEO 4.5 should be selected
  21. parameters.stdmax = 50; %maximum threshold. Is used for artefact removal
  22. parameters.interpolation = 'y'; %interpolation for alignment
  23. parameters.int_factor = 2; %interpolation factor (def. 2)
  24. parameters.detect_fmin = 200; %high pass filter for detection (def. 300)
  25. parameters.detect_fmax = 3000; %low pass filter for detection (def. 3000)
  26. parameters.sort_fmin = 200; %high pass filter for sorting (def. 300)
  27. parameters.sort_fmax = 3000; %low pass filter for sorting (def. 3000)
  28. parameters.segments = 1; %nr. of segments in which the data is cutted. --> segmentit voisi analysoida rinnakkain?
  29. %handles.par.sr = []; %sampling frequency in Hz extracted from the recording file metadata during the processiong
  30. %setting of the output directory
  31. csv_directory = uigetdir('title','SELECT YOUR OUTPUT FOLDER');
  32. %% RUN
  33. runrunman = FileRunner(parameters, list(:,1),csv_directory); %constructor method application
  34. [result, runrunman] = runrunman.ReadSpikesFromNextChannel();
  35. while ~isempty(result)
  36. clear result;
  37. [result, runrunman] = runrunman.ReadSpikesFromNextChannel();
  38. end