From 73cb7e97a9b5a37f0bb8b68ca4a4798ab8a3e362 Mon Sep 17 00:00:00 2001
From: "google-labs-jules[bot]"
<161369871+google-labs-jules[bot]@users.noreply.github.com>
Date: Fri, 12 Dec 2025 22:45:54 +0000
Subject: [PATCH 1/6] ndr.reader.base and subclasses: update getchannelsepoch
to return time_channel
Modified `ndr.reader.base` and several subclasses (`ced_smr`, `intan_rhd`, `neo`, `spikegadgets_rec`) to ensure that `getchannelsepoch` returns a channel structure that includes the `time_channel` field.
Specifically:
- Updated `ndr.reader.base.getchannelsepoch` to include `time_channel` in the empty struct.
- Updated `ndr.reader.ced_smr.getchannelsepoch`, `ndr.reader.intan_rhd.getchannelsepoch`, `ndr.reader.neo.getchannelsepoch`, and `ndr.reader.spikegadgets_rec.getchannelsepoch` to:
1. Include `time_channel` in the struct.
2. Explicitly add a time channel `t1` at index 1.
3. Set `time_channel` to 1 for all channels.
---
+ndr/+reader/base.m | 5 ++---
+ndr/+reader/ced_smr.m | 7 +++----
+ndr/+reader/intan_rhd.m | 7 +++++--
+ndr/+reader/neo.m | 6 +++++-
+ndr/+reader/spikegadgets_rec.m | 10 ++++++++++
5 files changed, 25 insertions(+), 10 deletions(-)
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..06a470a 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,
@@ -51,14 +51,13 @@
header = ndr.format.ced.read_SOMSMR_header(filename);
- if isempty(header.channelinfo),
- channels = struct('name','t1','type','time');
- end;
+ channels(1) = struct('name','t1','type','time','time_channel',1);
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 = 1;
channels(end+1) = newchannel;
end
end % getchannels()
diff --git a/+ndr/+reader/intan_rhd.m b/+ndr/+reader/intan_rhd.m
index fa2d1a1..e153b52 100755
--- a/+ndr/+reader/intan_rhd.m
+++ b/+ndr/+reader/intan_rhd.m
@@ -176,8 +176,10 @@
% | (e.g., 'analogin', 'digitalin', 'image', 'timestamp')
%
- channels = vlt.data.emptystruct('name','type');
-
+ channels = vlt.data.emptystruct('name','type','time_channel');
+
+ channels(1) = struct('name','t1','type','time','time_channel',1);
+
intan_channel_types = {
'amplifier_channels'
'aux_input_channels'
@@ -205,6 +207,7 @@
intan_rhd_obj,...
channel_type_entry,...
channel(p));
+ newchannel.time_channel = 1;
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..e7a8732 100755
--- a/+ndr/+reader/spikegadgets_rec.m
+++ b/+ndr/+reader/spikegadgets_rec.m
@@ -103,6 +103,16 @@
remove = {'startbyte','bit','number'};
channels = rmfield(channels, remove);
+
+ % Add time channel
+ time_channel = struct('name','t1','type','time');
+ if isempty(channels),
+ channels = time_channel;
+ else,
+ channels = [time_channel; channels(:)];
+ end;
+
+ [channels.time_channel] = deal(1);
end
From 802787b816827235fe9d5af8d2bc57ea338fffba Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
<41898282+github-actions[bot]@users.noreply.github.com>
Date: Fri, 12 Dec 2025 22:48:14 +0000
Subject: [PATCH 2/6] Update GitHub badges
---
.github/badges/code_issues.svg | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/badges/code_issues.svg b/.github/badges/code_issues.svg
index 805a27b..15e23db 100644
--- a/.github/badges/code_issues.svg
+++ b/.github/badges/code_issues.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
From 3aa8d1c3318ce9ba3ddc2b5f9cd1442e6b57d620 Mon Sep 17 00:00:00 2001
From: "google-labs-jules[bot]"
<161369871+google-labs-jules[bot]@users.noreply.github.com>
Date: Sat, 13 Dec 2025 13:59:08 +0000
Subject: [PATCH 3/6] ndr.reader.base and subclasses: update getchannelsepoch
to return time_channel with specific logic
Modified `ndr.reader.base` and several subclasses to ensure that `getchannelsepoch` returns a channel structure that includes the `time_channel` field.
Specifically:
- Updated `ndr.reader.base.getchannelsepoch` to include `time_channel` in the empty struct.
- Updated `ndr.reader.ced_smr.getchannelsepoch` to set `time_channel` to the channel ID found in the header.
- Updated `ndr.reader.intan_rhd.getchannelsepoch` to add two time channels (`t1`, `t2`) and map `auxiliary_in` channels to `t2` (time channel 2) and others to `t1` (time channel 1).
- Updated `ndr.reader.neo.getchannelsepoch` and `ndr.reader.spikegadgets_rec.getchannelsepoch` to add a time channel `t1` and set `time_channel` to 1.
- Ensured struct field consistency in `spikegadgets_rec` concatenation.
---
+ndr/+reader/ced_smr.m | 6 ++++--
+ndr/+reader/intan_rhd.m | 7 ++++++-
+ndr/+reader/spikegadgets_rec.m | 7 +++----
.github/badges/code_issues.svg | 2 +-
4 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/+ndr/+reader/ced_smr.m b/+ndr/+reader/ced_smr.m
index 06a470a..d92804a 100755
--- a/+ndr/+reader/ced_smr.m
+++ b/+ndr/+reader/ced_smr.m
@@ -51,13 +51,15 @@
header = ndr.format.ced.read_SOMSMR_header(filename);
- channels(1) = struct('name','t1','type','time','time_channel',1);
+ if isempty(header.channelinfo),
+ 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 = 1;
+ 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 e153b52..6dd6c40 100755
--- a/+ndr/+reader/intan_rhd.m
+++ b/+ndr/+reader/intan_rhd.m
@@ -179,6 +179,7 @@
channels = vlt.data.emptystruct('name','type','time_channel');
channels(1) = struct('name','t1','type','time','time_channel',1);
+ channels(2) = struct('name','t2','type','time','time_channel',2);
intan_channel_types = {
'amplifier_channels'
@@ -207,7 +208,11 @@
intan_rhd_obj,...
channel_type_entry,...
channel(p));
- newchannel.time_channel = 1;
+ 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/spikegadgets_rec.m b/+ndr/+reader/spikegadgets_rec.m
index e7a8732..4ccb423 100755
--- a/+ndr/+reader/spikegadgets_rec.m
+++ b/+ndr/+reader/spikegadgets_rec.m
@@ -105,14 +105,13 @@
channels = rmfield(channels, remove);
% Add time channel
- time_channel = struct('name','t1','type','time');
if isempty(channels),
- channels = time_channel;
+ 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;
-
- [channels.time_channel] = deal(1);
end
diff --git a/.github/badges/code_issues.svg b/.github/badges/code_issues.svg
index 15e23db..805a27b 100644
--- a/.github/badges/code_issues.svg
+++ b/.github/badges/code_issues.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
From 38073f60e710dfc3eb9d2b11a49ecba5aa5233e8 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
<41898282+github-actions[bot]@users.noreply.github.com>
Date: Sat, 13 Dec 2025 14:01:56 +0000
Subject: [PATCH 4/6] Update GitHub badges
---
.github/badges/code_issues.svg | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/badges/code_issues.svg b/.github/badges/code_issues.svg
index 805a27b..1bd6d59 100644
--- a/.github/badges/code_issues.svg
+++ b/.github/badges/code_issues.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
From 9d247b23658ec5841c641571d120a78fcf501f97 Mon Sep 17 00:00:00 2001
From: "google-labs-jules[bot]"
<161369871+google-labs-jules[bot]@users.noreply.github.com>
Date: Sat, 13 Dec 2025 14:27:59 +0000
Subject: [PATCH 5/6] ndr.reader.base and subclasses: return time_channel with
conditional Intan logic
Modified `ndr.reader.base` and several subclasses to ensure `getchannelsepoch` returns a channel structure with the `time_channel` field.
Specifically:
- Updated `ndr.reader.base.getchannelsepoch` to include `time_channel`.
- Updated `ndr.reader.intan_rhd.getchannelsepoch` to conditionally add a second time channel (`t2`) at index 2 only if auxiliary input channels are present in the header. `auxiliary_in` channels use `time_channel` 2, others use 1.
- Updated `ndr.reader.ced_smr.getchannelsepoch` to set `time_channel` to the channel ID.
- Updated `ndr.reader.neo` and `ndr.reader.spikegadgets_rec` to default `time_channel` to 1 and add `t1`.
---
+ndr/+reader/intan_rhd.m | 13 ++++++++-----
.github/badges/code_issues.svg | 2 +-
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/+ndr/+reader/intan_rhd.m b/+ndr/+reader/intan_rhd.m
index 6dd6c40..5aa7482 100755
--- a/+ndr/+reader/intan_rhd.m
+++ b/+ndr/+reader/intan_rhd.m
@@ -176,11 +176,6 @@
% | (e.g., 'analogin', 'digitalin', 'image', 'timestamp')
%
- channels = vlt.data.emptystruct('name','type','time_channel');
-
- channels(1) = struct('name','t1','type','time','time_channel',1);
- channels(2) = struct('name','t2','type','time','time_channel',2);
-
intan_channel_types = {
'amplifier_channels'
'aux_input_channels'
@@ -195,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}),
diff --git a/.github/badges/code_issues.svg b/.github/badges/code_issues.svg
index 1bd6d59..805a27b 100644
--- a/.github/badges/code_issues.svg
+++ b/.github/badges/code_issues.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
From c64a5e62211f5ecf56ba42e69b386c5860129588 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
<41898282+github-actions[bot]@users.noreply.github.com>
Date: Sat, 13 Dec 2025 14:30:21 +0000
Subject: [PATCH 6/6] Update GitHub badges
---
.github/badges/code_issues.svg | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 @@
-
\ No newline at end of file
+
\ No newline at end of file