From 3af4c9d51771ef4b430e9b1455161249743eb9d1 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 84fe7cbfd..5c3520fd9 100644 --- a/artiq/coredevice/comm_analyzer.py +++ b/artiq/coredevice/comm_analyzer.py @@ -300,6 +300,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 @@ -628,6 +645,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)