Prechádzať zdrojové kódy

Aggiorna 'code/matlab/H5_ISI.m'

Stefano Diomedi 5 mesiacov pred
rodič
commit
ccd5a84a04
1 zmenil súbory, kde vykonal 31 pridanie a 29 odobranie
  1. 31 29
      code/matlab/H5_ISI.m

+ 31 - 29
code/matlab/H5_ISI.m

@@ -1,30 +1,32 @@
-% The script calculates the Inter Spike Intervals (ISIs) and plots the
-% results in a histogram. The proportion of ISIs violating a threshold
-% is also calculated and indicated in the histogram.
-clear all; clc; close all;
-addpath('supportFunctions')
-currentFolder = pwd;
-parentFolder = fileparts(fileparts(currentFolder));
-[filename,path_folder_data] = uigetfile('*.h5','Select a h5 dataset',[parentFolder '\data']);
-
-str = '/DATA'; %it can be either unit_XX, unit_XX/condition_YY or unit_XX/condition_YY/trial_ZZ
-threshold = 1; %threshold for violations in ms
-
-[spikes, markers, all_strings] = get_all_data_from_level_h5([path_folder_data filename],str); %extract data
-
-ISIs = cellfun(@diff, spikes, 'UniformOutput', false);
-ISIs = cell2mat(ISIs');
-
-violations = length(find(ISIs<threshold)) / numel(ISIs) * 100; %percentage over the total number of ISIs
-
-figure
-time = 0:0.5:100;
-histogram(ISIs,time);
-hold on
-xline(threshold,'--')
-xLimits = get(gca,'XLim');
-yLimits = get(gca,'YLim');
-text(xLimits(2)/4, yLimits(2)*2/3, ['Violations (ISI below ' num2str(threshold) 'ms threshold) = ' num2str(violations) '%'])
-xlabel('ISI duration (ms)')
-ylabel('events num.')
+% The script calculates the Inter Spike Intervals (ISIs) and plots the
+% results in a histogram. The proportion of ISIs violating a threshold
+% is also calculated and indicated in the histogram.
+% Francesco E. Vaccari 10/2022 
+
+clear all; clc; close all;
+addpath('supportFunctions')
+currentFolder = pwd;
+parentFolder = fileparts(fileparts(currentFolder));
+[filename,path_folder_data] = uigetfile('*.h5','Select a h5 dataset',[parentFolder '\data']);
+
+str = '/DATA'; %it can be either unit_XX, unit_XX/condition_YY or unit_XX/condition_YY/trial_ZZ
+threshold = 1; %threshold for violations in ms
+
+[spikes, markers, all_strings] = get_all_data_from_level_h5([path_folder_data filename],str); %extract data
+
+ISIs = cellfun(@diff, spikes, 'UniformOutput', false);
+ISIs = cell2mat(ISIs');
+
+violations = length(find(ISIs<threshold)) / numel(ISIs) * 100; %percentage over the total number of ISIs
+
+figure
+time = 0:0.5:100;
+histogram(ISIs,time);
+hold on
+xline(threshold,'--')
+xLimits = get(gca,'XLim');
+yLimits = get(gca,'YLim');
+text(xLimits(2)/4, yLimits(2)*2/3, ['Violations (ISI below ' num2str(threshold) 'ms threshold) = ' num2str(violations) '%'])
+xlabel('ISI duration (ms)')
+ylabel('events num.')
 title('ISI')