Skip to content

Commit

Permalink
fix: fix data format in DAQJobN1081B and fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
furkan-bilgin committed Oct 12, 2024
1 parent 656a8cc commit 995b825
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/daq/caen/n1081b.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,16 @@ def _poll_sections(self):

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"]]]
values = [
int(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=keys,
data=values,
data=[values],
)
)
2 changes: 1 addition & 1 deletion src/tests/test_n1081b.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def test_send_store_message(self, mock_get_function_results):
self.assertEqual(message.prefix, "SEC_A")
self.assertIn("timestamp", message.keys)
self.assertIn("lemo_1", message.keys)
self.assertIn(100, message.data)
self.assertIn(100, message.data[0])

def test_invalid_section_in_config(self):
invalid_config = DAQJobN1081BConfig(
Expand Down

0 comments on commit 995b825

Please sign in to comment.