Main.m 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 factor (def. 5) for the operation with SWTTEO 4.5 should be selected
  21. parameters.stdmax = 50; %maximum threshold factor. Is used for artefact removal
  22. parameters.interpolation = 'y'; %interpolation for alignment (not in use here as spike storage is not involved)
  23. parameters.int_factor = 2; %interpolation factor (interpolation for spike storing is not in use)
  24. parameters.detect_fmin = 200; %high pass filter for detection (def. 200)
  25. parameters.detect_fmax = 3000; %low pass filter for detection (def. 3000)
  26. parameters.segments = 1; %nr. of segments in which the data is cutted. --> segmentit voisi analysoida rinnakkain?
  27. %setting of the output directory
  28. csv_directory = uigetdir('title','SELECT YOUR OUTPUT FOLDER');
  29. %% RUN
  30. runrunman = FileRunner(parameters, list(:,1),csv_directory); %constructor method application
  31. [result, runrunman] = runrunman.ReadSpikesFromNextChannel(); %reading the next channel
  32. while ~isempty(result)
  33. clear result;
  34. [result, runrunman] = runrunman.ReadSpikesFromNextChannel();
  35. end