From ecba1cd5f66125514399f993fbd31cd7231af80f Mon Sep 17 00:00:00 2001 From: Simon Renblad Date: Mon, 8 Jan 2024 16:21:12 +0800 Subject: [PATCH] comm_analyzer: add get_channel_list --- artiq/coredevice/comm_analyzer.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/artiq/coredevice/comm_analyzer.py b/artiq/coredevice/comm_analyzer.py index 3e3fcafba..5e8afd2b9 100644 --- a/artiq/coredevice/comm_analyzer.py +++ b/artiq/coredevice/comm_analyzer.py @@ -246,6 +246,23 @@ class WaveformChannel: self.data.append((self.current_time, log_message)) +class ChannelSignatureManager: + def __init__(self): + self.current_scope = "" + self.channels = dict() + + def get_channel(self, name, width, ty): + self.channels[self.current_scope + name] = (width, ty) + return None + + @contextmanager + def scope(self, scope, name): + old_scope = self.current_scope + self.current_scope = scope + "/" + yield + self.current_scope = old_scope + + class TTLHandler: def __init__(self, manager, name): self.name = name @@ -574,6 +591,15 @@ def create_channel_handlers(manager, devices, ref_period, return channel_handlers +def get_channel_list(devices): + manager = ChannelSignatureManager() + create_channel_handlers(manager, devices, 1e-9, 3e9, False) + manager.get_channel("timestamp", 64, ty=WaveformType.VECTOR) + manager.get_channel("interval", 64, ty=WaveformType.ANALOG) + manager.get_channel("rtio_slack", 64, ty=WaveformType.ANALOG) + return manager.channels + + def get_message_time(message): return getattr(message, "timestamp", message.rtio_counter)