Browse Source

Dateien hochladen nach 'code_MATLAB'

Ece Boran 3 years ago
parent
commit
e49edea781
4 changed files with 35 additions and 35 deletions
  1. 29 29
      code_MATLAB/Figure_2.m
  2. 4 4
      code_MATLAB/Figure_3.m
  3. 1 1
      code_MATLAB/Main_Load_NIX_Data.m
  4. 1 1
      code_MATLAB/Main_Plot_Figures.m

+ 29 - 29
code_MATLAB/Figure_2.m

@@ -102,8 +102,8 @@ FR = SPIKES_All(nExampleNeuron).spikes;
 
 %% Firing rate for a single neuron
 c = [];
-fs = -2; % min(FR(:,3));
-ls = 24; % max(FR(:,3));
+fs = -2;
+ls = 24;
 binSize = 0.1;
 ranTrials = {};
 for i = 1:max(FR(:,2))
@@ -130,57 +130,57 @@ custom_statfun = @(y)([mean(y);
     mean(y) - std(y)/sqrt(17);
     mean(y) + std(y)/sqrt(17)]);
 g(1).stat_summary('setylim',true,'type',custom_statfun);
-g(1).set_names( 'x','','y','Rate [Hz]' );
-g(1).set_layout_options('position',[0.05 0.7 0.9 0.3])
-g(1).no_legend()
+g(1).set_names( 'x','','y','Rate [Hz]');
+g(1).set_layout_options('position',[0.05,0.7,0.9,0.3]);
+g(1).no_legend();
 g(1).axe_property('xlim',[fs 20],'XColor','none');
 % Inset
-g(6) = gramm('x',([1:64]-20)/32,'y',waveform(nExampleNeuron,:));
+g(6) = gramm('x',((1:64)-20)/32,'y',waveform(nExampleNeuron,:));
 g(6).geom_line();
-g(6).set_names( 'x','Time (ms)','y','uV' );
-g(6).set_layout_options('position',[0.1 0.9 0.1 0.1])
-g(6).set_text_options('base_size',4)
+g(6).set_names('x','Time (ms)','y','uV' );
+g(6).set_layout_options('position',[0.1,0.9,0.1,0.1]);
+g(6).set_text_options('base_size',4);
 g(6).set_color_options('chroma',0,'lightness',30);
 g(6).set_line_options('base_size',1);
-g(6).no_legend()
+g(6).no_legend();
 % g(6).axe_property('xlim',[fs 20],'XColor','none');
 % raster
 g(2) = gramm('x',ranTrials,'color',c);
-g(2).geom_raster( 'geom','point');
+g(2).geom_raster('geom','point');
 g(2).set_point_options('base_size',3);
-g(2).set_names( 'x','Time [s]','y','Trial no. (reordered)' );
-g(2).set_layout_options('position',[0.05 0.43 0.9 0.3])
-g(2).no_legend()
-g(2).axe_property('xlim',[fs 20],'ylim',[-1 9]);
+g(2).set_names('x','Time [s]','y','Trial no. (reordered)');
+g(2).set_layout_options('position',[0.05,0.43,0.9,0.3]);
+g(2).no_legend();
+g(2).axe_property('xlim',[fs,20],'ylim',[-1,9]);
 % ISI
 g(3) = gramm('x',isis);
 g(3).stat_bin();
-g(3).set_layout_options('position',[0.05 0.1 0.25 0.3])
-g(3).set_names( 'x','Percentage of ISI < 3 ms','y','No. of units' );
-g(3).set_color_options('hue_range',[155 200]);
+g(3).set_layout_options('position',[0.05,0.1,0.25,0.3]);
+g(3).set_names('x','Percentage of ISI < 3 ms','y','No. of units');
+g(3).set_color_options('hue_range',[155,200]);
 % FR all
 g(4) = gramm('x',FiringRatesHz);
 g(4).stat_bin();
-g(4).set_layout_options('position',[0.38 0.1 0.25 0.3])
-g(4).set_names( 'x','Firing rate [Hz]','y','No. of units' );
+g(4).set_layout_options('position',[0.38,0.1,0.25,0.3]);
+g(4).set_names('x','Firing rate [Hz]','y','No. of units');
 g(4).axe_property('xlim',[0 20]);
 g(4).set_color_options('hue_range',[155 200]);
 % SNR
 g(5) = gramm('x',snr);
 g(5).stat_bin();
-g(5).set_layout_options('position',[0.71 0.1 0.25 0.3])
-g(5).set_names( 'x','Waveform peak SNR','y','No. of neurons' );
+g(5).set_layout_options('position',[0.71,0.1,0.25,0.3]);
+g(5).set_names('x','Waveform peak SNR','y','No. of neurons');
 g(5).axe_property('xlim',[0 10]);
 g(5).set_color_options('hue_range',[155 200]);
 % Labels
-x = [0 0 0 0.35 0.68];
-y = [0.97 0.7 0.37 0.37 0.37];
-l = ['a' 'b' 'c' 'd' 'e'];
+x = [0,0,0,0.35,0.68];
+y = [0.97,0.7,0.37,0.37,0.37];
+l = ['a','b','c','d','e'];
 g(7) = gramm('x',x,'y',y,'label',l);
-g(7).geom_label('Color','k','fontweight','bold')
-g(7).axe_property('XColor','none','YColor','none','xlim',[0 1],...
-    'ylim',[0 1],'Visible','off');
-g(7).set_layout_options('position',[0 0 1 1])
+g(7).geom_label('Color','k','fontweight','bold');
+g(7).axe_property('XColor','none','YColor','none','xlim',[0,1],...
+    'ylim',[0,1],'Visible','off');
+g(7).set_layout_options('position',[0,0,1,1]);
 g.draw();
 
 % Save figure

+ 4 - 4
code_MATLAB/Figure_3.m

@@ -80,10 +80,10 @@ cind = [ones(chtot/2,1)*1;ones(chtot/2,1)*2];
 c = cval(cind);
 g = gramm('x',ff,'y',data,'color',c);
 custom_statfun = @(y)([10*log10(nanmean(y));
-    10*log10(nanmean(y)) - nanstd(10*log10(nanmean(y)))/sqrt(8*6);
-    10*log10(nanmean(y)) + nanstd(10*log10(nanmean(y)))/sqrt(8*6)]);
-g.stat_summary('setylim', true, 'type', custom_statfun);
-g.set_names( 'x', 'Frequency [Hz]', 'y', 'Power [dB]' );
+    10*log10(nanmean(y))-nanstd(10*log10(nanmean(y)))/sqrt(8*6);
+    10*log10(nanmean(y))+nanstd(10*log10(nanmean(y)))/sqrt(8*6)]);
+g.stat_summary('setylim',true,'type',custom_statfun);
+g.set_names( 'x', 'Frequency [Hz]','y','Power [dB]');
 g.draw();
 
 % Save figure

+ 1 - 1
code_MATLAB/Main_Load_NIX_Data.m

@@ -8,7 +8,7 @@ strMainPath = 'Human_Amygdala_MUA_sEEG_FearVideo'; % 'human_amygdala_mua_seeg_fe
 strNIXLibraryPath = 'nix-mx_Win64_1.4.1'; % or 'nix_mx_macOS_1.4.2_Matlab2020a'
 
 %% Add necessary folders to the MATLAB path
-addpath([strMainPath filesep,'code_MATLAB',filesep])
+addpath([strMainPath,filesep,'code_MATLAB',filesep])
 addpath(genpath(strNIXLibraryPath))
 
 warning('strMainPath should be the full path of the folder for the repository Human_Amygdala_MUA_sEEG_FearVideo (or human_amygdala_mua_seeg_fearvideo)')

+ 1 - 1
code_MATLAB/Main_Plot_Figures.m

@@ -32,4 +32,4 @@ nExampleNeuron = 32; % neuron 32 reproduces the publication figure
 fig2 = Figure_2([strMainPath,filesep,'data_NIX',filesep],nExampleNeuron);
 
 %% Figure 3
-fig3 = Figure_3([strMainPath,filesep,'data_NIX',filesep]);
+fig3 = Figure_3([strMainPath,filesep,'data_NIX',filesep]);