Browse Source

gin commit from med068pc183

Modified files: 1
Deleted files: 1
Andrey Vinogradov 3 years ago
parent
commit
0f89631578
2 changed files with 22 additions and 20 deletions
  1. 22 9
      Codes/MATLAB spike detection/FileRunner.m
  2. 0 11
      LICENSE.txt

+ 22 - 9
Codes/MATLAB spike detection/FileRunner.m

@@ -63,7 +63,13 @@ classdef FileRunner
         
         % onnistuiko,indexes,spikes,chlabel,duration,record_time,detection threshold,noise
         function [r_result, obj] = ReadSpikesFromNextChannel(obj) % palauttaa seuraavan kanavan indexes & waves etc
-
+            %curr_well=strcat(char(64+obj.last_well_row+1),num2str(obj.last_well_col+1));
+            %splitter=@(x) strsplit(x, '/'); 
+            %while ~any(strcmp(cellfun(@(z) z{end}, cellfun(splitter,{h5info(obj.getCurrentFile()).Groups(1).Groups.Name}, 'UniformOutput',false), 'UniformOutput',false), curr_well)) 
+                %fprintf([curr_well '_' 'seems to be excluded\n']);
+                %obj = obj.JumpNextWell;
+                %curr_well=strcat(char(64+obj.last_well_row+1),num2str(obj.last_well_col+1));
+            %end
             % onko viel? elektrodeita, jotka pit?isi lukea
             if obj.file_finished &&...% jos oli viimeinen tai eka kanava
                 obj.last_file >= length(obj.files) % ja jos ei ole tiedostoja jotka pit?isi lukea                        
@@ -79,8 +85,9 @@ classdef FileRunner
                 if obj.file_finished&&...
                     obj.last_file>0
                     Finalcsv=sortrows(obj.T, 2);
-                    thefilename=strsplit(obj.getCurrentFile(), '.');
-                    thefilename=thefilename{1};
+                    thefilenamefull=strsplit(obj.getCurrentFile(), '.');
+                    thefilename=strsplit(thefilenamefull{1}, '\');
+                    thefilename=thefilename{end};
                     writetable(Finalcsv, strcat(obj.csv_directory, '\',thefilename,'_', 'spikes.csv'));
                     obj.T=table; %zeroing the table
                     obj = obj.OpenNewFile();
@@ -92,6 +99,8 @@ classdef FileRunner
                 
                 %if ~obj.file_read_error
                 %Reading the channel 
+
+                
                 [r_result.error,m_data, r_result.chlabel, obj] = obj.ReadAxionChannel();
                 
                 %disp(r_result.chlabel)
@@ -115,7 +124,7 @@ classdef FileRunner
      
                
                  
-        function [error,data,chlabel, obj] = ReadAxionChannel(obj)
+        function [errorread,data,chlabel, obj] = ReadAxionChannel(obj)
             
             %well does not exist jump to another and display...might be not
             %recorded or so
@@ -127,11 +136,15 @@ classdef FileRunner
             %error = 0;
             %duration = [];
             m_well=strcat(char(64+obj.last_well_row+1),num2str(obj.last_well_col+1));
+            
             splitter=@(x) strsplit(x, '/'); 
             while ~any(strcmp(cellfun(@(z) z{end}, cellfun(splitter,{h5info(obj.getCurrentFile()).Groups(1).Groups.Name}, 'UniformOutput',false), 'UniformOutput',false), m_well)) 
                 fprintf([m_well '_' 'seems to be excluded\n']);
                 obj = obj.JumpNextWell;
                 m_well=strcat(char(64+obj.last_well_row+1),num2str(obj.last_well_col+1));
+                if obj.file_finished == 1
+                    break
+                end
             end
             
             m_ch=strcat(num2str(obj.last_ch_col+1),num2str(obj.last_ch_row+1));
@@ -146,14 +159,14 @@ classdef FileRunner
                 %else
                     %duration = obj.duration;%better when open file?????
                 %end
-                error = 0;
+                errorread = 0;
             catch %err
-                error = 1;
+                errorread = 1;
                 InactiveChannels=h5read(obj.getCurrentFile(), '/DataInfo/InactiveChannels');
                 if any(contains(InactiveChannels, chlabel)) 
                     disp(['Channel' ' ' chlabel ' ' 'is inactive, it is not recorded in the initial analysed file.'])
                 else
-                    disp(['Smth wrong with' ' ' chlabel ' ' 'channel reading!']); %ADDED
+                    error(['Smth wrong with' ' ' chlabel ' ' 'channel reading!']); %ADDED
                 end
           
             end 
@@ -167,7 +180,7 @@ classdef FileRunner
                     if obj.final_well_col-1 <= obj.last_well_col % viimeinen kaivosarake, otetaan seuraavalta rivilt?
                         obj.last_well_col = obj.first_well_col-1;
                         if obj.final_well_row-1 <= obj.last_well_row
-                            disp('All channels have been read from!');
+                            disp('All channels have been read from1!');
                             obj.file_finished = 1;
                         else
                             obj.last_well_row = obj.last_well_row+1;
@@ -253,7 +266,7 @@ classdef FileRunner
             if obj.final_well_col-1 <= obj.last_well_col 
                 obj.last_well_col = obj.first_well_col-1;
                 if obj.final_well_row-1 <= obj.last_well_row
-                    disp('All channels have been read from!');
+                    disp('All channels have been read from2!');
                     obj.file_finished = 1;
                 else
                     obj.last_well_row = obj.last_well_row+1;

+ 0 - 11
LICENSE.txt

@@ -1,11 +0,0 @@
-Comparative microelectrode array dataset of functional development of human pluripotent stem cell-derived and rat neuronal networks in the directory `Data` by Neuro Group, Faculty of Medicine and Health Technology, Tampere University (TUNI), Tampere, Finland is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.
-
-The directory `Codes\MATLAB spike detection` contains folder `Functions from F. Lieb's SpikeDetection-Toolbox` which embeds functions imported from [SpikeDetection-Toolbox](https://github.com/flieb/SpikeDetection-Toolbox) distributed under GNU General Public License v3.0. 
-
-The directory `Codes` contains folder `meaRtools` with modified version of [meaRtools package](https://github.com/igm-team/meaRtools) distributed under GNU General Public License v3.0. Modifications imply user interface, input file reading and selection process and the addition of [LogISI algorithm](https://doi.org/10.1007/s10827-009-0175-1) for burst detection into the package. The LogISI algorithm originally received from its author Valentina Pasquale was modified for our data and the modifications are described in the publication [Kapucu et al., submitted](http://doi.org/to-be-inserted-after-publication). 
-
-The directory `Codes` contains folder `Connectivity Analysis` with [Spectral entropy based neuronal network synchronization analysis: CorSE](https://doi.org/10.3389/fncom.2016.00112) code distributed under the 3-Clause BSD License.
-
-All remaining codes in the directory `Codes` are published under the 3-Clause BSD License.
-
-See the `LICENSE.txt` or `LICENSE` files in the corresponding directories for the full license.