Skip to content

Commit

Permalink
feat: Adding datetime.datetime in the dictionary output
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielePalazzo committed Mar 22, 2024
1 parent 9616dd1 commit d79a180
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/qibolab/instruments/bluefors.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import json
import re
import socket
from datetime import datetime

from qibo.config import log

from qibolab.instruments.abstract import Instrument

# from datetime import datetime


class TemperatureController(Instrument):
"""Bluefors temperature controller."""
Expand Down Expand Up @@ -61,6 +60,8 @@ def convert_to_json(message: str) -> dict[str, dict[str, float]]:
message = re.sub("'", '"', message)
message = ",".join(message.split("\n"))
dictionary_message = json.loads("{" + message + "}")
for flange_values in dictionary_message.values():
flange_values["time"] = datetime.fromtimestamp(flange_values["timestamp"])
return dictionary_message

def get_data(self) -> dict[str, dict[str, float]]:
Expand Down

0 comments on commit d79a180

Please sign in to comment.