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
26 changes: 26 additions & 0 deletions src/ndi/probe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,26 @@ def buildepochtable(self) -> list[dict[str, Any]]:
for daqsys in daqsystems:
# Get device epoch table
device_et = daqsys.epochtable()
daqsys_name = getattr(daqsys, "name", getattr(daqsys, "_name", ""))

for device_entry in device_et:
# Check if any epochprobemap matches this probe
epochprobemaps = device_entry.get("epochprobemap", [])
matching_epm = self._find_matching_epochprobemap(epochprobemaps)

if matching_epm is not None:
# Only include if the matching epochprobemap's device
# belongs to this DAQ system
epm_devicename = ""
if hasattr(matching_epm, "devicename"):
epm_devicename = matching_epm.devicename
elif hasattr(matching_epm, "devicestring"):
parts = matching_epm.devicestring.split(":")
epm_devicename = parts[0] if parts else ""

if epm_devicename.lower() != daqsys_name.lower():
continue

epoch_number += 1

# Get clock and timing info from device entry
Expand Down Expand Up @@ -381,12 +394,25 @@ def buildmultipleepochtables(
for _daqsys_id, device_info in device_tables.items():
daqsys = device_info["system"]
device_et = device_info["epochtable"]
daqsys_name = getattr(daqsys, "name", getattr(daqsys, "_name", ""))

for device_entry in device_et:
epochprobemaps = device_entry.get("epochprobemap", [])
matching_epm = probe._find_matching_epochprobemap(epochprobemaps)

if matching_epm is not None:
# Only include if the matching epochprobemap's device
# belongs to this DAQ system
epm_devicename = ""
if hasattr(matching_epm, "devicename"):
epm_devicename = matching_epm.devicename
elif hasattr(matching_epm, "devicestring"):
parts = matching_epm.devicestring.split(":")
epm_devicename = parts[0] if parts else ""

if epm_devicename.lower() != daqsys_name.lower():
continue

epoch_number += 1
et.append(
{
Expand Down
2 changes: 2 additions & 0 deletions tests/test_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,8 @@ def test_buildepochtable_with_matching_epoch(self):
mock_session = MagicMock()

mock_daqsys = MagicMock()
mock_daqsys.name = "dev1"
mock_daqsys._name = "dev1"
mock_daqsys.epochtable.return_value = [
{
"epoch_number": 1,
Expand Down
Loading