Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added doc/Figures/screenshot-000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/Figures/screenshot-002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/Figures/screenshot-004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions doc/PsPM_Developers_Guide.lyx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Binary file modified doc/PsPM_Developers_Guide.pdf
Binary file not shown.
7 changes: 6 additions & 1 deletion doc/PsPM_Manual.lyx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file modified doc/PsPM_Manual.pdf
Binary file not shown.
24 changes: 13 additions & 11 deletions src/pspm_get_smr.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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;
Expand Down
9 changes: 5 additions & 4 deletions test/pspm_get_smr_test.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down