Browse Source

gin commit from med068pc183

Deleted files: 6
Andrey Vinogradov 3 years ago
parent
commit
33eeefe0da

+ 0 - 27
Codes/MATLAB spike detection/BatchAnalyser_1.2/FileInput/MMa_FetchFileNames.m

@@ -1,27 +0,0 @@
-function [ Filenames ] = MMa_FetchFileNames( Folder )
-%UNTITLED2 Summary of this function goes here
-%   Detailed explanation goes here
-%    DataInputDir = 'D:\TestFiles\';
-
-   Filenames = cell.empty();
-   list = dir(Folder);
-   %save('C:\Users\meandvi\Desktop\HDF5\Results\list.mat', 'Filenames', 'list', 'Folder');
-   for f = 3:length(list) % skipataan . ja ..
-       if list(f).isdir
-           Filenames = [Filenames; MMa_FetchFileNames(strcat(Folder, list(f).name,'\'))]; 
-           %for folder inside the folder(Andrey)
-       else
-           % jos tiedosto on .mcd tiedosto
-        
-           if (size(list(f).name,2)-3) > 0 % tiedostonimess? v?hint??n 4 merkki?
-               if strcmpi(list(f).name(size(list(f).name,2)-2:size(list(f).name,2)),'.h5') % multichannel systems
-                    Filenames{size(Filenames,1)+1,1} = strcat(Folder, list(f).name);
-               elseif strcmpi(list(f).name(size(list(f).name,2)-3:size(list(f).name,2)),'.raw') % axion
-                    Filenames{size(Filenames,1)+1,1} = strcat(Folder, list(f).name);
-               end
-           end
-           % Axion has .raw and .spikes --> olisiko luotettavampaa tapaa p??tell?
-       end
-   end
-end
-

+ 0 - 115
Codes/MATLAB spike detection/BatchAnalyser_1.2/FileInput/MMa_SelectFiles.m

@@ -1,115 +0,0 @@
-function [ SelectedFiles ] = MMa_SelectFiles(OutputDir)
-%UNTITLED2 Summary of this function goes here
-%   Detailed explanation goes here
-
-    % FileNameDataBaseInfo
-    clc;
-    msg0 = 'Give a folder to read files from. Remember to add final \\ ! ';
-    Folder = input(msg0, 's');
-    Filenames = MMa_FetchFileNames(Folder);
-        %save('C:\Users\meandvi\Desktop\HDF5\Results\finalfilenames.mat', 'Filenames');
-    SelectedFiles = Filenames;
-    
-    msg1 = ['The search found ' num2str(length(Filenames))...
-        ' MCD (.h5) and Axion files. Do you want to select a subset of files? (y/n): '];
-    msg2 = ['Add criteria to your selection:' char(10)...
-        '(0) Stop adding criteria' char(10)...
-        '(1) Date selection' char(10)...
-        '(2) Experimenter selection' char(10)...
-        '(3) N number selection' char(10)...
-        '(4) Cell line selection' char(10)...
-        '(5) Text in the file name or path' char(10)...
-        '(6) List selected files' char(10)...
-        '(7) List all original files' char(10)...
-        '(8) Save all the found files' char(10)];
-    msg21 = 'Give the date selection in the format of yymmdd-yymmdd : ';
-    msg22 = 'Give a 3 character experimenter ID : ';
-    msg23 = 'Give a range of N numbers in the format of number-number : ';
-    msg24 = 'Give a cell line identificator : ';
-    msg25 = 'Enter text to be searched : ';
-    msg26 = 'THE FILES IN THE DATABASE HAVE BEEN MOVED. DATABASE MUST BE UPDATED!';
-    
-    ansv1 = input(msg1,'s');
-    clc;
-    
-    if strcmp(ansv1,'y')
-        ansv2 = 1;
-        
-        parameters.dates = cell.empty();
-        parameters.experimenters = cell.empty();
-        parameters.nnumbers = cell.empty();
-        parameters.celllines = cell.empty();
-        parameters.texts = cell.empty();
-        
-        while ~(ansv2 == '0')
-            ansv2 = input(msg2,'s');
-            clc;
-            
-            if ansv2 == '1' % yymmdd-yymmdd 140516-140812
-                ansv21 = input(msg21,'s');
-                parameters.dates{length(parameters.dates)+1} = strsplit(ansv21,'-');
-                                
-            elseif ansv2 == '2'
-                ansv22 = input(msg22,'s');
-                parameters.experimenters{length(parameters.experimenters)+1} = ansv22;
-                
-            elseif ansv2 == '3' % number-number
-                ansv23 = input(msg23,'s');
-                parameters.nnumbers{length(parameters.nnumbers)+1} = strsplit(ansv23,'-');
-                
-            elseif ansv2 == '4'
-                ansv24 = input(msg24,'s');
-                parameters.celllines{length(parameters.celllines)+1} = ansv24;
-
-            elseif ansv2 == '5'
-                ansv25 = input(msg25,'s'); 
-                parameters.texts{length(parameters.texts)+1} = ansv25;
-                
-            elseif ansv2 == '6'
-                disp(SelectedFiles);
-            
-            elseif ansv2 == '7'
-                disp(Filenames);
-                       
-            elseif ansv2 == '8'
-                filedates = cellfun(@dir, SelectedFiles);
-                filedates = {filedates(:).date}';
-                nnumbrs = cellfun(@findMEAID, SelectedFiles, 'UniformOutput', false);
-                xlswrite(strcat(OutputDir, '_SelectedFiles_', MMa_timestamp(), '.xls'), [nnumbrs, filedates, SelectedFiles]);
-            end
-             
-           if str2num(ansv2) < 7
-               SelectedFiles = MMa_StrSelection(parameters, Filenames); 
-               disp([char(10) 'The analysis now includes ' num2str(length(SelectedFiles)) ' files.' char(10)]);
-           end 
-           
-        end % end parametrien kysely loppuu t?h?n
-        save(strcat(OutputDir,'file_selection_parameters_',MMa_timestamp(),'.mat'), 'parameters');
-   
-    end
-        
-        try
-            % datenums are only used if the filename is missing date
-            % information
-            fndates = cellfun(@findMEAdate, SelectedFiles, 'UniformOutput', false);
-            fileinfos = cellfun(@dir, SelectedFiles); %, 'UniformOutput', false);
-            
-            % if filename is missing date information that file
-            % modification date is used as date
-            for r = 1:length(fndates)
-                if fndates{r} == 0
-                    fndates{r} = str2num(datestr(fileinfos(r).date,'yymmdd'));
-                end
-            end
-            
-            fileinfos = {fileinfos(:).datenum}';
-
-            SelectedFiles = [SelectedFiles fndates fileinfos];
-            
-        catch err
-            disp(msg26);
-            SelectedFiles = [];
-        end
-end
-
-% isdir

+ 0 - 98
Codes/MATLAB spike detection/BatchAnalyser_1.2/FileInput/MMa_StrSelection.m

@@ -1,98 +0,0 @@
-function [ Selected ] =  MMa_StrSelection(parameters, list) 
-%UNTITLED Summary of this function goes here
-%   Detailed explanation goes here
-
-%         parameters.dates % yymmdd-yymmdd 140516-140812
-%         parameters.experimenters % JHe
-%         parameters.nnumbers % number-number
-%         parameters.celllines % text
-%         parameters.texts % text
-        
-        matches = ones(length(list),1);
-        
-        % oltava tältä väliltä jos määritelty
-        % yymmdd-yymmdd 140516-140812
-        if ~isempty(parameters.dates)
-            temp_matches = zeros(length(matches),1);
-            
-            for a = 1:length(parameters.dates) % kullekin päivämäärälle
-                dates = parameters.dates{a};
-                startdate = datenum(dates{1}, 'yymmdd');
-                enddate = datenum(dates{2}, 'yymmdd');
-                    
-                % hae kustakin tiedo pathista pvm ja vertaa tähän
-                filedatestarts = regexp(list,'\d\d\d\d\d\d');
-                
-                % select a date for file based on file name or if not in
-                % file name then folder above
-                datelist = zeros(length(list),1);
-                for m = 1:size(datelist,1)
-                    datezor = list{m}(filedatestarts{m,end}:filedatestarts{m,end}+5);
-                    if ~isempty(datezor)
-                        datelist(m) = datenum(datezor,'yymmdd');
-                    end
-                end
-                
-               temp_matches = temp_matches | ((startdate <= datelist) & (datelist <= enddate)); 
-                
-            end % yksi päivämäärä saatu käsiteltyä
-            matches = temp_matches & matches;
-        end % tähän asti suoritetaan jos päivämääriä oli annettu
-        
-        
-        % oltava tämän not case sensitive nauhoittajan jos määritelty
-        %length(parameters.experimenters) % JHe % _JHe % Lyl
-        if ~isempty(parameters.experimenters) % jos määritelty kriteeriksi
-            temp_matches = zeros(length(matches),1);
-            for i = 1:length(parameters.experimenters) % käydään läpi kaikki mainitut experimentterit
-                temp_matches = temp_matches | ...
-                    ~cellfun(@isempty, regexpi(list,parameters.experimenters(i)));
-            end
-            matches = temp_matches & matches;
-        end % tähän asti suoritetaan jos oltiin määritelty kriteeriksi
-        
-        % oltava tältä väliltä
-        % length(parameters.nnumbers) % number-number
-        if ~isempty(parameters.nnumbers)
-            temp_matches = zeros(length(matches),1);
-            % find mea ids
-            IDs = zeros(length(list),1);
-            for i = 1:length(list)
-                IDs(i) = str2num(findMEAID(list{i}));
-            end
-            
-            for i = 1:length(parameters.nnumbers)
-                [startn,endn] = parameters.nnumbers{i}{1:2};
-                
-                temp_matches = temp_matches | ...
-                    ((str2num(startn) <= IDs) & (IDs <= str2num(endn)));
-            end
-            matches = temp_matches & matches;
-        end % tähän asti suoritetaan jos oltiin määritelty, että n numero
-        
-        % oltava joku näistä
-        %length(parameters.celllines) % text
-        if ~isempty(parameters.celllines)
-            temp_matches = zeros(length(matches),1);
-            for i = 1:length(parameters.celllines)
-                temp_matches = temp_matches | ...
-                    ~cellfun(@isempty, regexpi(list,parameters.celllines(i)));
-            end
-            matches = temp_matches & matches;
-        end % tähän asti suoritetaan jos oltiin määritelty, että ... 
-            % tietty solulinja
-        
-        % sisällettävä joku näistä, jos määritelty
-        % length(parameters.texts) % text
-        if ~isempty(parameters.texts)
-            temp_matches = zeros(length(matches),1);
-            for i = 1:length(parameters.texts)
-                temp_matches = temp_matches | ...
-                    ~cellfun(@isempty, regexpi(list,parameters.texts(i)));
-            end
-            matches = temp_matches & matches;
-         end
-        
-        Selected = list(matches);
-end
-

+ 0 - 38
Codes/MATLAB spike detection/BatchAnalyser_1.2/FileInput/MMa_timestamp.m

@@ -1,38 +0,0 @@
-function [ timestr ] = MMa_timestamp( )
-%UNTITLED4 Summary of this function goes here
-%   Detailed explanation goes here
-    ny = fix(clock);
-    
-    year = num2str(ny(1));
-    while length(year) < 4
-        year = strcat('0', year);
-    end
-    
-    month = num2str(ny(2));
-    while length(month) < 2
-        month = strcat('0', month);
-    end
-    
-    day = num2str(ny(3));
-    while length(day) < 2
-        day = strcat('0', day);
-    end
-    
-    hour = num2str(ny(4));
-    while length(hour) < 2
-        hour = strcat('0', hour);
-    end
-    
-    min = num2str(ny(5));
-    while length(min) < 2
-        min = strcat('0', min);
-    end
-    
-    sec = num2str(ny(6));
-    while length(sec) < 2
-        sec = strcat('0', sec);
-    end
-    
-    timestr = [year '_' month '_' day '_' hour '_' min '_' sec];
-end
-

+ 0 - 20
Codes/MATLAB spike detection/BatchAnalyser_1.2/FileInput/findMEAID.m

@@ -1,20 +0,0 @@
-function [ MEAID ] = findMEAID( filename )
-%UNTITLED Summary of this function goes here
-%   Detailed explanation goes here
-
-    % ennen N saa olla '\' ' ' tai '-' tai '_' 
-    %[startIndex,endIndex] = regexp(filename, '[\\\-_]N\d\d\d*');
-    %before N can be '\' ' ' or '-' or '_' and after the number the same
-    %symbols (by Andrey)
-    [startIndex,endIndex] = regexp(filename, '[Nn]\d+'); %'[_\s\\][Nn]\d*[_\s\\]'
-    %hae alku ja loppu merkkijonon osalle NXXX*, jossa X = numero
-    if ~isempty(startIndex)
-        %MEAID = filename(startIndex+1:endIndex);
-        % +1 koska otetaan N pois <-- Andrey: By this  you remove "_" or "-",
-        % not "N" in your code
-        MEAID = filename(startIndex:endIndex); %remove additional starting/ending (" " "_" "\")
-    else
-        MEAID = '0';
-        warning(strcat('File name: "', filename, '" does not contain MEA id!'));
-    end
-end

+ 0 - 18
Codes/MATLAB spike detection/BatchAnalyser_1.2/FileInput/findMEAdate.m

@@ -1,18 +0,0 @@
-function [ MEAdate ] = findMEAdate( filename )
-%UNTITLED Summary of this function goes here
-%   Detailed explanation goes here
-    if ischar(filename)
-        % returns the starting and ending indices of all matches
-        [startIndex,endIndex] = regexp(filename, '\d\d[0-3]\d\d\d');
-        %hae alku ja loppu merkkijonon osalle yymmdd
-        if ~isempty(startIndex)
-            MEAdate = str2num(filename(startIndex(end):endIndex(end)));
-        else
-            MEAdate = 0;
-            % warning(strcat('File name: "', filename, '" does not contain MEA id!'));
-        end
-    else
-        MEAdate = 0;
-    end
-    
-end

Codes/MATLAB spike detection/BatchAnalyser_1.2/SpikeDetection/DetectSpikes_Amp.m → Codes/MATLAB spike detection/DetectSpikes_Amp.m


Codes/MATLAB spike detection/BatchAnalyser_1.2/FileInput/FileRunner.m → Codes/MATLAB spike detection/FileRunner.m


Codes/MATLAB spike detection/BatchAnalyser_1.2/SpikeDetection/Wave_clus/amp_detect.m → Codes/MATLAB spike detection/amp_detect.m


Codes/MATLAB spike detection/BatchAnalyser_1.2/SpikeDetection/Wave_clus/fix_filter.m → Codes/MATLAB spike detection/fix_filter.m


Codes/MATLAB spike detection/BatchAnalyser_1.2/SpikeDetection/Wave_clus/int_spikes.m → Codes/MATLAB spike detection/int_spikes.m