diff --git a/+ndr/+reader/base.m b/+ndr/+reader/base.m index ef2a3db..1c9b32f 100644 --- a/+ndr/+reader/base.m +++ b/+ndr/+reader/base.m @@ -131,11 +131,10 @@ % 'name' | The name of the channel (e.g., 'ai1') % 'type' | The type of data stored in the channel % | (e.g., 'analogin', 'digitalin', 'image', 'timestamp') + % 'time_channel' | The index of the time channel that describes the time of this channel % % - % - channels = struct('name',[],'type',[]); - channels = channels([]); + channels = vlt.data.emptystruct('name','type','time_channel'); end; % getchannelsepoch() function [datatype,p,datasize] = underlying_datatype(ndr_reader_obj, epochstreams, epoch_select, channeltype, channel) diff --git a/+ndr/+reader/ced_smr.m b/+ndr/+reader/ced_smr.m index cecc7a3..d92804a 100755 --- a/+ndr/+reader/ced_smr.m +++ b/+ndr/+reader/ced_smr.m @@ -42,7 +42,7 @@ if epochselect~=1, error(['For CED SOM/SMR files, epochselect should be 1.']); end; - channels = vlt.data.emptystruct('name','type'); + channels = vlt.data.emptystruct('name','type','time_channel'); % open SMR files, and examine the headers for all channels present % for any new channel that hasn't been identified before, @@ -52,13 +52,14 @@ header = ndr.format.ced.read_SOMSMR_header(filename); if isempty(header.channelinfo), - channels = struct('name','t1','type','time'); + channels = struct('name','t1','type','time','time_channel',1); end; for k=1:length(header.channelinfo), %header.channelinfo(k).kind newchannel.type = ndr.reader.ced_smr.cedsmrheader2readerchanneltype(header.channelinfo(k).kind); newchannel.name = [ ndr.reader.base.mfdaq_prefix(newchannel.type) int2str(header.channelinfo(k).number) ]; + newchannel.time_channel = header.channelinfo(k).number; channels(end+1) = newchannel; end end % getchannels() diff --git a/+ndr/+reader/intan_rhd.m b/+ndr/+reader/intan_rhd.m index fa2d1a1..5aa7482 100755 --- a/+ndr/+reader/intan_rhd.m +++ b/+ndr/+reader/intan_rhd.m @@ -176,8 +176,6 @@ % | (e.g., 'analogin', 'digitalin', 'image', 'timestamp') % - channels = vlt.data.emptystruct('name','type'); - intan_channel_types = { 'amplifier_channels' 'aux_input_channels' @@ -192,6 +190,14 @@ filename = intan_rhd_obj.filenamefromepochfiles(epochstreams); header = ndr.format.intan.read_Intan_RHD2000_header(filename); + + channels = vlt.data.emptystruct('name','type','time_channel'); + + channels(1) = struct('name','t1','type','time','time_channel',1); + + if isfield(header,'aux_input_channels') & ~isempty(header.aux_input_channels), + channels(2) = struct('name','t2','type','time','time_channel',2); + end; for k=1:length(intan_channel_types) if isfield(header,intan_channel_types{k}), @@ -205,6 +211,11 @@ intan_rhd_obj,... channel_type_entry,... channel(p)); + if strcmpi(newchannel.type,'auxiliary_in'), + newchannel.time_channel = 2; + else, + newchannel.time_channel = 1; + end; channels(end+1) = newchannel; end end diff --git a/+ndr/+reader/neo.m b/+ndr/+reader/neo.m index 82893fc..6ff15cb 100644 --- a/+ndr/+reader/neo.m +++ b/+ndr/+reader/neo.m @@ -12,10 +12,14 @@ py_channels = py.neo_python.getchannelsepoch(epochfiles, epochselect); % Formatting objects from python to matlab - channels = vlt.data.emptystruct('name', 'type'); + channels = vlt.data.emptystruct('name', 'type', 'time_channel'); + + channels(1) = struct('name','t1','type','time','time_channel',1); + for k = 1:length(py_channels) new_channel.type = char(py_channels{k}{'type'}); new_channel.name = char(py_channels{k}{'name'}); + new_channel.time_channel = 1; channels(end + 1) = new_channel; end end diff --git a/+ndr/+reader/spikegadgets_rec.m b/+ndr/+reader/spikegadgets_rec.m index cb50893..4ccb423 100755 --- a/+ndr/+reader/spikegadgets_rec.m +++ b/+ndr/+reader/spikegadgets_rec.m @@ -103,6 +103,15 @@ remove = {'startbyte','bit','number'}; channels = rmfield(channels, remove); + + % Add time channel + if isempty(channels), + channels = struct('name','t1','type','time','time_channel',1); + else, + [channels.time_channel] = deal(1); + time_channel = struct('name','t1','type','time','time_channel',1); + channels = [time_channel; channels(:)]; + end; end diff --git a/.github/badges/code_issues.svg b/.github/badges/code_issues.svg index 805a27b..ceafabb 100644 --- a/.github/badges/code_issues.svg +++ b/.github/badges/code_issues.svg @@ -1 +1 @@ -code issuescode issues12701270 \ No newline at end of file +code issuescode issues12781278 \ No newline at end of file