diff --git a/doc/Figures/screenshot-000.png b/doc/Figures/screenshot-000.png new file mode 100644 index 000000000..d0cf24ee6 Binary files /dev/null and b/doc/Figures/screenshot-000.png differ diff --git a/doc/Figures/screenshot-002.png b/doc/Figures/screenshot-002.png new file mode 100644 index 000000000..4f79925d4 Binary files /dev/null and b/doc/Figures/screenshot-002.png differ diff --git a/doc/Figures/screenshot-004.png b/doc/Figures/screenshot-004.png new file mode 100644 index 000000000..9ef9a0b94 Binary files /dev/null and b/doc/Figures/screenshot-004.png differ diff --git a/doc/PsPM_Developers_Guide.lyx b/doc/PsPM_Developers_Guide.lyx index 6fe5e866a..4c18868ef 100644 --- a/doc/PsPM_Developers_Guide.lyx +++ b/doc/PsPM_Developers_Guide.lyx @@ -29400,7 +29400,8 @@ In the line 1-5 of a markdown file, \begin_layout Standard \begin_inset Graphics - filename /Users/teddy/Desktop/Screenshot 2025-02-06 at 14.51.44.png + filename Figures/screenshot-000.png + scale 50 \end_inset @@ -29468,7 +29469,7 @@ The second line is the title of this webpage. \begin_layout Standard \begin_inset Graphics - filename /Users/teddy/Desktop/Screenshot 2025-02-06 at 15.14.02.png + filename Figures/screenshot-002.png width 90text% \end_inset @@ -29612,7 +29613,7 @@ toc-date.html \begin_layout Standard \begin_inset Graphics - filename /Users/teddy/Desktop/Screenshot 2025-02-07 at 03.32.35.png + filename Figures/screenshot-004.png width 95text% \end_inset diff --git a/doc/PsPM_Developers_Guide.pdf b/doc/PsPM_Developers_Guide.pdf index 617a42ceb..8d1c8934d 100644 Binary files a/doc/PsPM_Developers_Guide.pdf and b/doc/PsPM_Developers_Guide.pdf differ diff --git a/doc/PsPM_Manual.lyx b/doc/PsPM_Manual.lyx index f448dd2c5..1a0b709e8 100644 --- a/doc/PsPM_Manual.lyx +++ b/doc/PsPM_Manual.lyx @@ -5584,7 +5584,12 @@ Here, \end_layout \begin_layout Paragraph -CED Spike +CED Spike +\end_layout + +\begin_layout Standard +When importing SMR files, + channels that are empty are still imported as empty channels rather than being removed. \end_layout \begin_layout Paragraph diff --git a/doc/PsPM_Manual.pdf b/doc/PsPM_Manual.pdf index f18f5827c..eb949c432 100644 Binary files a/doc/PsPM_Manual.pdf and b/doc/PsPM_Manual.pdf differ diff --git a/src/pspm_get_smr.m b/src/pspm_get_smr.m index 1ccfc2d1e..2d6039028 100644 --- a/src/pspm_get_smr.m +++ b/src/pspm_get_smr.m @@ -7,7 +7,7 @@ % ● Arguments % * datafile : the data file to be imported. % ┌───import -% ├───channel : X +% ├───channel : the number of the channel to load. % └───denoise : for marker channels in CED spike format (recorded as 'level'), % only retains markers with duration longer than the value given here (in ms). % ● Outputs @@ -44,17 +44,10 @@ errorflag(channel)=1; chandata{channel}=[]; chanhead{channel}.title=''; + chanhead{channel}.kind = -1 ; end end fclose(fid); -% 2.5 delete empty channels -if ~isempty(errorflag) - ind=find(errorflag); - for channel=ind(end:-1:1) - chandata(channel)=[]; - chanhead(channel)=[]; - end -end warning on; %% 3 extract individual channels % 3.1 loop through import jobs @@ -75,7 +68,11 @@ sourceinfo.channel{iImport, 1} = sprintf('Channel %02.0f: %s', channel, chanhead{channel}.title); % 3.1.2 convert to waveform or get sample rate for wave channel types if strcmpi(settings.channeltypes(import{iImport}.typeno).data, 'wave') - if chanhead{channel}.kind == 1 % waveform + if chanhead{channel}.kind == -1 % empty channel + import{iImport}.data = zeros(1,0); + import{iImport}.units = ''; + import{iImport}.sr = 1; + elseif chanhead{channel}.kind == 1 % waveform import{iImport}.data = chandata{channel}; import{iImport}.sr = 1./chanhead{channel}.sampleinterval; elseif chanhead{channel}.kind == 3 % timestamps @@ -100,7 +97,12 @@ end % extract, and possibly denoise event channels elseif strcmpi(settings.channeltypes(import{iImport}.typeno).data, 'events') - if chanhead{channel}.kind == 1 % waveform + if chanhead{channel}.kind == -1 % empty channel + import{iImport}.marker = 'continuous' ; % or '' + import{iImport}.data = zeros(1,0); + import{iImport}.units = 'event'; + import{iImport}.sr = 1; + elseif chanhead{channel}.kind == 1 % waveform import{iImport}.marker = 'continuous'; import{iImport}.data = chandata{channel}; import{iImport}.sr = 1./chanhead{channel}.sampleinterval; diff --git a/test/pspm_get_smr_test.m b/test/pspm_get_smr_test.m index 1528755b6..f3983097c 100644 --- a/test/pspm_get_smr_test.m +++ b/test/pspm_get_smr_test.m @@ -13,14 +13,15 @@ function define_testcases(this) % testcase 1 this.testcases{1}.pth = 'ImportTestData/spike/AEC_11.smr'; this.testcases{1}.import{1} = struct('type', 'scr' , 'channel', 1); - this.testcases{1}.import{2} = struct('type', 'marker', 'channel', 2); - this.testcases{1}.import{3} = struct('type', 'marker', 'channel', 3); + this.testcases{1}.import{2} = struct('type', 'marker', 'channel', 2);% empty + this.testcases{1}.import{3} = struct('type', 'marker', 'channel', 3);% empty this.testcases{1}.import{4} = struct('type', 'marker', 'channel', 4); this.testcases{1}.import{5} = struct('type', 'marker', 'channel', 5); this.testcases{1}.import{6} = struct('type', 'marker', 'channel', 6); this.testcases{1}.import{7} = struct('type', 'marker', 'channel', 7); - % this.testcases{1}.import{8} = struct('type', 'marker', 'channel', 8); - % this.testcases{1}.import{9} = struct('type', 'marker', 'channel', 9); + this.testcases{1}.import{8} = struct('type', 'marker', 'channel', 8); + this.testcases{1}.import{9} = struct('type', 'marker', 'channel', 9); + this.testcases{1}.import{10} = struct('type', 'marker', 'channel', 10);% empty % testcase 2 this.testcases{2}.pth = 'ImportTestData/spike/Spike_SCR_Marker.smr'; this.testcases{2}.import{1} = struct('type', 'scr' , 'channel', 1);