From 656a8cceea7e69756b1d3c9d367fec824ad8d305 Mon Sep 17 00:00:00 2001 From: Furkan Date: Sat, 12 Oct 2024 18:59:37 +0300 Subject: [PATCH] feat: store timestamps in `DAQJobN1081B` --- src/daq/caen/n1081b.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/daq/caen/n1081b.py b/src/daq/caen/n1081b.py index bd25e91..1e7d37d 100644 --- a/src/daq/caen/n1081b.py +++ b/src/daq/caen/n1081b.py @@ -1,5 +1,6 @@ import time from dataclasses import dataclass +from datetime import datetime from N1081B import N1081B from websocket import WebSocket @@ -79,12 +80,14 @@ def _poll_sections(self): self._send_store_message(data, section.name) def _send_store_message(self, data: dict, section): + keys = ["timestamp", *[f"lemo_{x['lemo']}" for x in data["counters"]]] + values = [datetime.now().timestamp(), *[x["value"] for x in data["counters"]]] self.message_out.put( DAQJobMessageStore( store_config=self.config.store_config, daq_job=self, prefix=section, - keys=[f"lemo_{x['lemo']}" for x in data["counters"]], - data=[[x["value"] for x in data["counters"]]], + keys=keys, + data=values, ) )