-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modifications to make demo_analysis_ERD work
- Loading branch information
1 parent
afc1806
commit 024eaea
Showing
6 changed files
with
131 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
file= 'Pavel_01_11_23/selfpaced2sPavel'; | ||
|
||
%% Load data | ||
hdr= file_readBVheader(file); | ||
Wps= [42 49]/hdr.fs*2; | ||
[n, Ws]= cheb2ord(Wps(1), Wps(2), 3, 40); | ||
[filt.b, filt.a]= cheby2(n, 50, Ws); | ||
[cnt, mrk_orig]= file_readBV([file '*'], 'Fs',100, 'Filt',filt, ... | ||
'Clab', {'not','E*'}); | ||
|
||
%% Marker struct | ||
stimDef= {[65 70], [74 192]; | ||
'left','right'}; | ||
mrk= mrk_defineClasses(mrk_orig, stimDef); | ||
|
||
%% Electrode Montage | ||
grd= sprintf(['scale,_,F3,Fz,F4,_,legend\n' ... | ||
'FC5,FC3,FC1,FCz,FC2,FC4,FC6\n' ... | ||
'C5,C3,C1,Cz,C2,C4,C6\n' ... | ||
'CP5,CP3,CP1,CPz,CP2,CP4,CP6']); | ||
mnt= get_electrodePositions(cnt.clab); | ||
mnt= mnt_setGrid(mnt, grd); | ||
|
||
colOrder= [245 159 0; 0 150 200]/255; | ||
ival_erd= [-1000 500]; | ||
band_erd= [11 14]; | ||
ival_scalps= -800:200:200; | ||
|
||
% Bandpass to the frequency band of interest | ||
[b,a]= butter(5, band_erd/cnt.fs*2); | ||
cnt= proc_filt(cnt, b, a); | ||
|
||
% Artifact rejection based on variance criterion | ||
mrk= reject_varEventsAndChannels(cnt, mrk, ival_erd, ... | ||
'DoBandpass', 0, ... | ||
'Verbose', 1); | ||
|
||
epo= proc_segmentation(cnt, mrk, ival_erd); | ||
erd_lar= proc_localAverageReference(epo, mnt, 'Radius',0.4); | ||
erd_lar= proc_envelope(erd_lar, 'MovAvgMsec', 200); | ||
erd_lar= proc_baseline(erd_lar, [], 'trialwise', 0); | ||
erd= proc_envelope(epo, 'MovAvgMsec', 200); | ||
erd= proc_baseline(erd, [], 'trialwise', 0); | ||
erd_lar_r= proc_rSquareSigned(erd_lar); | ||
erd_r= proc_rSquareSigned(erd); | ||
|
||
fig_set(1) | ||
H= grid_plot(erd, mnt, defopt_erps, 'colorOrder',colOrder); | ||
grid_addBars(erd_r, 'HScale',H.scale); | ||
fig_set(5) | ||
H= grid_plot(erd_lar, mnt, defopt_erps, 'colorOrder',colOrder); | ||
grid_addBars(erd_lar_r, 'HScale',H.scale); | ||
|
||
fig_set(2); | ||
H= plot_scalpEvolutionPlusChannel(erd, mnt, clab, ival_scalps, ... | ||
defopt_scalp_erp, ... | ||
'ExtrapolateToMean', 1, ... | ||
'ColorOrder',colOrder); | ||
grid_addBars(erd_r); | ||
|
||
fig_set(4, 'shrink',[1 2/3]); | ||
plot_scalpEvolutionPlusChannel(erd_r, mnt, clab, ival_scalps, defopt_scalp_r); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
function opt= defopt_scalp_erp(varargin) | ||
|
||
props= {'Shading','interp', ... | ||
'Extrapolation',1, ... | ||
'ExtrapolateToMean',0, ... | ||
'Resolution', 71, ... | ||
'CLim','sym', ... | ||
'ShrinkColorbar', 0.2, ... | ||
'Colormap',jet(51), ... | ||
'Contour',5, ... | ||
'LineWidth', 2, ... | ||
'ChannelLineStyleOrder', {'thick','thin'}, ... | ||
'IvalColor', [0.8 0.8 0.8; 0.6 0.6 0.6], ... | ||
'ContourPolicy', 'strict', ... | ||
'ContourLineprop', {'LineWidth',0.3}, ... | ||
'MarkMarkerProperties', {'MarkerSize',6, 'LineWidth',1}, ... | ||
'GlobalCLim',1, ... | ||
'Renderer', 'contourf', ... | ||
'LegendPos','NorthWest'}; | ||
props= {'Shading' 'flat' | ||
'Extrapolation' 1 | ||
'ExtrapolateToMean' 0 | ||
'Resolution' 71 | ||
'CLim' 'sym' | ||
'ShrinkColorbar' 0.2 | ||
'Colormap' jet(51) | ||
'Contour' 5 | ||
'LineWidth' 2 | ||
'ChannelLineStyleOrder' {'thick' 'thin'} | ||
'IvalColor' [0.8 0.8 0.8; 0.6 0.6 0.6] | ||
'ContourPolicy' 'strict' | ||
'ContourLineprop' {'LineWidth' 0.3} | ||
'MarkMarkerProperties' {'MarkerSize' 6, 'LineWidth' 1} | ||
'GlobalCLim' 1 | ||
'LegendPos' 'NorthWest'}; | ||
|
||
opt= opt_proplistToStruct(varargin{:}); | ||
opt= opt_setDefaults(opt, props); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
function opt= defopt_scalp_power(varargin) | ||
|
||
props= {'Shading', 'flat'; | ||
'Extrapolation', 1; | ||
'ExtrapolateToMean', 0; | ||
'Resolution', 61; | ||
'CLim', 'range'; | ||
'IvalColor', [0.8 0.8 0.8; 0.6 0.6 0.6]; | ||
'LineWidth', 2; | ||
'ChannelLineStyleOrder', {'thick','thin'}; | ||
'Colormap', cmap_hsvFade(51, [4/6 0], 1, 1); | ||
'Contour', 5; | ||
'ContourPolicy', 'strict'; | ||
'ContourLineprop', {'LineWidth',0.3}; | ||
'MarkMarkerProperties', {'MarkerSize',6, 'LineWidth',1}; | ||
'GlobalCLim', 1; | ||
'LegendPos', 'NorthEast'}; | ||
props= {'Shading' 'flat' | ||
'Extrapolation' 1 | ||
'ExtrapolateToMean' 0 | ||
'Resolution' 61 | ||
'CLim' 'range' | ||
'IvalColor' [0.8 0.8 0.8; 0.6 0.6 0.6] | ||
'LineWidth' 2 | ||
'ChannelLineStyleOrder' {'thick' 'thin'} | ||
'Colormap' cmap_hsvFade(51, [4/6 0], 1, 1) | ||
'Contour' 5 | ||
'ContourPolicy' 'strict' | ||
'ContourLineprop' {'LineWidth' 0.3} | ||
'MarkMarkerProperties' {'MarkerSize' 6, 'LineWidth' 1} | ||
'GlobalCLim' 1 | ||
'LegendPos' 'NorthEast'}; | ||
|
||
opt= opt_proplistToStruct(varargin{:}); | ||
opt= opt_setDefaults(opt, props); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
function opt= defopt_scalp_r(varargin) | ||
|
||
props= {'Extrapolation', 1; | ||
'ExtrapolateToMean', 0; | ||
'Resolution', 71; | ||
'CLim', 'sym'; | ||
'ShrinkColorbar', 0.2; | ||
'ColorOrder', [0 0 0]; | ||
'Colormap', cmap_posneg(51); | ||
'LineWidth', 2; | ||
'ChannelLineStyleOrder', {'thick','thin'}; | ||
'IvalColor', [0.8 0.8 0.8; 0.6 0.6 0.6]; | ||
'Contour', 5; | ||
'ContourPolicy', 'withinrange'; | ||
'ContourLineprop', {'LineWidth',0.3}; | ||
'MarkMarkerProperties', {'MarkerSize',6, 'LineWidth',1}; | ||
'ChannelAtBottom', 1; | ||
'GlobalCLim', 1; | ||
'LegendPos', 'NorthWest'}; | ||
props= {'Extrapolation' 1 | ||
'ExtrapolateToMean' 0 | ||
'Resolution' 71 | ||
'CLim' 'sym' | ||
'ShrinkColorbar' 0.2 | ||
'ColorOrder' [0 0 0] | ||
'Colormap' cmap_posneg(51) | ||
'LineWidth' 2 | ||
'ChannelLineStyleOrder' {'thick' 'thin'} | ||
'IvalColor' [0.8 0.8 0.8; 0.6 0.6 0.6] | ||
'Contour' 5 | ||
'ContourPolicy' 'withinrange' | ||
'ContourLineprop' {'LineWidth' 0.3} | ||
'MarkMarkerProperties' {'MarkerSize' 6, 'LineWidth' 1} | ||
'ChannelAtBottom' 1 | ||
'GlobalCLim' 1 | ||
'LegendPos' 'NorthWest'}; | ||
|
||
opt= opt_proplistToStruct(varargin{:}); | ||
opt= opt_setDefaults(opt, props); |