From a6b30cd9879fcf6fe508e81ceb5f0c9c134e5350 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Mar 2026 23:37:28 +0000 Subject: [PATCH 1/3] Fix epochtable() tuple unpacking in timeseries probe classes epochtable() returns (list, hash) but getchanneldevinfo() and _readtimeseries_via_syncgraph() assigned the tuple directly to et, causing et[epoch-1] to return the list instead of a dict entry, leading to AttributeError: 'list' object has no attribute 'get'. https://claude.ai/code/session_017Sfgtomgo9AEEGfKP57eJZ --- src/ndi/probe/timeseries.py | 2 +- src/ndi/probe/timeseries_mfdaq.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ndi/probe/timeseries.py b/src/ndi/probe/timeseries.py index 50f8522..2987b38 100644 --- a/src/ndi/probe/timeseries.py +++ b/src/ndi/probe/timeseries.py @@ -95,7 +95,7 @@ def _readtimeseries_via_syncgraph( return None, None, None # Get epoch table - et = self.epochtable() + et, _ = self.epochtable() if not et: return None, None, None diff --git a/src/ndi/probe/timeseries_mfdaq.py b/src/ndi/probe/timeseries_mfdaq.py index 2d5a1b9..5fd8949 100644 --- a/src/ndi/probe/timeseries_mfdaq.py +++ b/src/ndi/probe/timeseries_mfdaq.py @@ -168,7 +168,7 @@ def getchanneldevinfo( return None # Get epoch probe map - et = self.epochtable() + et, _ = self.epochtable() if not et: return None From c216f6e7d80755e81fe5c237dc53eff4ba2b9dd3 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Mar 2026 23:39:17 +0000 Subject: [PATCH 2/3] Fix epochtable() tuple unpacking in 3 more locations - epoch/functions.py:epochrange() - was not unpacking tuple - element/functions.py:_get_epoch_table() - could return tuple to callers expecting a list; now handles both return types - fun/probe/export_binary.py - replace ad-hoc isinstance check with proper tuple unpacking https://claude.ai/code/session_017Sfgtomgo9AEEGfKP57eJZ --- src/ndi/element/functions.py | 5 ++++- src/ndi/epoch/functions.py | 2 +- src/ndi/fun/probe/export_binary.py | 4 +--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ndi/element/functions.py b/src/ndi/element/functions.py index 3a74bb0..e7f1d97 100644 --- a/src/ndi/element/functions.py +++ b/src/ndi/element/functions.py @@ -296,7 +296,10 @@ def _get_epoch_table(obj: Any) -> list[dict]: Handles ndi_element, ndi_probe, and dict-like objects. """ if hasattr(obj, "epochtable"): - return obj.epochtable() + result = obj.epochtable() + if isinstance(result, tuple): + return result[0] + return result if isinstance(obj, dict): return obj.get("epochtable", []) if isinstance(obj, list): diff --git a/src/ndi/epoch/functions.py b/src/ndi/epoch/functions.py index c612360..fb6dd3a 100644 --- a/src/ndi/epoch/functions.py +++ b/src/ndi/epoch/functions.py @@ -41,7 +41,7 @@ def epochrange( Raises: ValueError: If epochs are not found or range is invalid """ - et = epochset_obj.epochtable() + et, _ = epochset_obj.epochtable() if not et: return [], [], [] diff --git a/src/ndi/fun/probe/export_binary.py b/src/ndi/fun/probe/export_binary.py index 62a4927..e7e54bd 100644 --- a/src/ndi/fun/probe/export_binary.py +++ b/src/ndi/fun/probe/export_binary.py @@ -45,9 +45,7 @@ def export_binary( outputfile = Path(outputfile) metafile = outputfile.with_suffix(outputfile.suffix + ".metadata") - et = probe.epochtable() - if isinstance(et, tuple): - et = et[0] + et, _ = probe.epochtable() dtype = np.dtype(precision) chunk_duration = 100 # seconds From 937bab170ef996af91de5ba7ce36e24a4cce22c7 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Mar 2026 23:43:15 +0000 Subject: [PATCH 3/3] Fix epochrange() to handle both tuple and list epochtable() returns epochrange() accepts any object with an epochtable() method, which may return either a tuple (epochset subclasses) or a plain list (daq/navigator). Use isinstance check to handle both cases. https://claude.ai/code/session_017Sfgtomgo9AEEGfKP57eJZ --- src/ndi/epoch/functions.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ndi/epoch/functions.py b/src/ndi/epoch/functions.py index fb6dd3a..ce02393 100644 --- a/src/ndi/epoch/functions.py +++ b/src/ndi/epoch/functions.py @@ -41,7 +41,8 @@ def epochrange( Raises: ValueError: If epochs are not found or range is invalid """ - et, _ = epochset_obj.epochtable() + result = epochset_obj.epochtable() + et = result[0] if isinstance(result, tuple) else result if not et: return [], [], []