keithley-tempcontrol 0.17.4__py3-none-any.whl → 0.18.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,12 +3,13 @@ from pathlib import Path
3
3
 
4
4
  from egse.control import ControlServer
5
5
  from egse.device import DeviceTimeoutError
6
+ from egse.hk import convert_hk_names, read_conversion_dict
6
7
  from egse.protocol import CommandProtocol
8
+ from egse.log import logger
7
9
  from egse.settings import Settings
8
10
  from egse.setup import load_setup
9
11
  from egse.system import format_datetime
10
- from egse.tempcontrol.keithley.daq6510 import DAQ6510Controller
11
- from egse.tempcontrol.keithley.daq6510 import DAQ6510Interface
12
+ from egse.tempcontrol.keithley.daq6510 import DAQ6510Controller, DAQ6510Interface
12
13
  from egse.tempcontrol.keithley.daq6510_dev import DAQ6510Command
13
14
  from egse.zmq_ser import bind_address
14
15
 
@@ -16,12 +17,10 @@ HERE = Path(__file__).parent
16
17
 
17
18
  COMMAND_SETTINGS = Settings.load(location=HERE, filename="daq6510.yaml")
18
19
 
19
- MODULE_LOGGER = logging.getLogger(__name__)
20
-
21
20
 
22
21
  class DAQ6510Protocol(CommandProtocol):
23
22
  def __init__(self, control_server: ControlServer):
24
- """Initialisation of a new Protocol for DAQ6510 Management.
23
+ """Initialization of a new Protocol for DAQ6510 Management.
25
24
 
26
25
  Args:
27
26
  control_server: Control Server for which to send out status and monitoring information
@@ -34,13 +33,31 @@ class DAQ6510Protocol(CommandProtocol):
34
33
  try:
35
34
  self.daq.connect()
36
35
  except (ConnectionError, DeviceTimeoutError):
37
- MODULE_LOGGER.warning("Couldn't establish a connection to the DAQ6510, check the log messages.")
36
+ logger.warning("Couldn't establish a connection to the DAQ6510, check the log messages.")
37
+
38
+ try:
39
+ self.hk_conversion_table = read_conversion_dict(
40
+ self.get_control_server().get_storage_mnemonic(), use_site=False
41
+ )
42
+ except Exception as exc:
43
+ logger.warning(f"Failed to read housekeeping conversion dictionary: {exc}")
44
+ self.hk_conversion_table = None
38
45
 
39
46
  self.load_commands(COMMAND_SETTINGS.Commands, DAQ6510Command, DAQ6510Interface)
40
47
  self.build_device_method_lookup_table(self.daq)
41
48
 
42
49
  setup = load_setup()
43
- self.channels = setup.gse.DAQ6510.channels
50
+ self.channels = setup.gse.DAQ6510.channels # type: ignore[attr-defined]
51
+
52
+ def get_device(self) -> DAQ6510Controller:
53
+ """
54
+ Returns the DAQ6510Controller device.
55
+
56
+ Returns:
57
+ The DAQ6510Controller device.
58
+ """
59
+
60
+ return self.daq
44
61
 
45
62
  def get_bind_address(self) -> str:
46
63
  """
@@ -76,6 +93,11 @@ class DAQ6510Protocol(CommandProtocol):
76
93
  hk_dict = dict()
77
94
  hk_dict["timestamp"] = format_datetime()
78
95
 
96
+ # logger.warning("DAQ6510Protocol.get_housekeeping() not implemented yet.")
97
+
98
+ if self.hk_conversion_table:
99
+ return convert_hk_names(hk_dict, self.hk_conversion_table)
100
+
79
101
  return hk_dict
80
102
 
81
103
  def quit(self) -> None:
@@ -96,10 +96,10 @@ COMMAND_PATTERNS_ACTIONS_RESPONSES = {
96
96
 
97
97
 
98
98
  def write(conn, response: str):
99
- response = f"{response}{SEPARATOR_STR}".encode()
99
+ response_b = f"{response}{SEPARATOR_STR}".encode()
100
100
  if VERBOSE_DEBUG:
101
- logger.debug(f"write: {response = }")
102
- conn.sendall(response)
101
+ logger.debug(f"write: {response_b = }")
102
+ conn.sendall(response_b)
103
103
 
104
104
 
105
105
  # Keep a receive buffer per connection
@@ -217,7 +217,7 @@ def run_simulator():
217
217
  return
218
218
  with conn:
219
219
  logger.info(f"Accepted connection from {addr}")
220
- write(conn, "This is PLATO DAQ6510 X.X.sim")
220
+ # write(conn, "This is PLATO DAQ6510 X.X.sim") # The DAQ6510 doesn't send a string after connection
221
221
  conn.settimeout(READ_TIMEOUT)
222
222
  try:
223
223
  while True:
@@ -93,5 +93,37 @@ def stop_daq6510_sim():
93
93
  )
94
94
 
95
95
 
96
+ @daq6510.command(name="start-mon")
97
+ def start_daq6510_mon():
98
+ """Start the daq6510 monitoring service."""
99
+ rich.print("Starting monitoring service daq6510_mon")
100
+
101
+ out = redirect_output_to_log("daq6510_mon.start.log")
102
+
103
+ subprocess.Popen(
104
+ [sys.executable, "-m", "egse.tempcontrol.keithley.daq6510_mon", "start"],
105
+ stdout=out,
106
+ stderr=out,
107
+ stdin=subprocess.DEVNULL,
108
+ close_fds=True,
109
+ )
110
+
111
+
112
+ @daq6510.command(name="stop-mon")
113
+ def stop_daq6510_mon():
114
+ """Stop the daq6510 monitoring service."""
115
+ rich.print("Stopping monitoring service daq6510_mon")
116
+
117
+ out = redirect_output_to_log("daq6510_mon.stop.log")
118
+
119
+ subprocess.Popen(
120
+ [sys.executable, "-m", "egse.tempcontrol.keithley.daq6510_mon", "stop"],
121
+ stdout=out,
122
+ stderr=out,
123
+ stdin=subprocess.DEVNULL,
124
+ close_fds=True,
125
+ )
126
+
127
+
96
128
  if __name__ == "__main__":
97
129
  daq6510()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: keithley-tempcontrol
3
- Version: 0.17.4
3
+ Version: 0.18.1
4
4
  Summary: Keithley Temperature Control for CGSE
5
5
  Author: IvS KU Leuven
6
6
  Maintainer-email: Rik Huygen <rik.huygen@kuleuven.be>, Sara Regibo <sara.regibo@kuleuven.be>
@@ -0,0 +1,18 @@
1
+ egse/tempcontrol/keithley/__init__.py,sha256=IasaUltrExCB6CgWl_ZscX51ssVq3Fn_-9V_P-gtV9I,120
2
+ egse/tempcontrol/keithley/daq6510.py,sha256=2ImQrL185T_hsG4Yvw5bqd5_FJ-gJnfAfgZxH-OG0yc,20629
3
+ egse/tempcontrol/keithley/daq6510.yaml,sha256=dHHVNyUpOQpdrZpnxPbT6slsl-8Gbnhifj4Q8QOfOYg,4400
4
+ egse/tempcontrol/keithley/daq6510_adev.py,sha256=wIE-vyDZK9OrT9fio-FWSKEzmTGNQCFh2meiLBinsmY,2586
5
+ egse/tempcontrol/keithley/daq6510_amon.py,sha256=cUgA_ARcEMHzf-_41-c-13KVReAipFCBa6dwiZn-lYE,21330
6
+ egse/tempcontrol/keithley/daq6510_cs.py,sha256=gfq0pnTlmVSrMPRnbYJLslNquFPpCO80Ynb0ZBC5YuU,8441
7
+ egse/tempcontrol/keithley/daq6510_dev.py,sha256=3LMPxmlcuQ3nFy-XTOUnyDOGhWMHLEJGxj0wxK9OT-Q,5212
8
+ egse/tempcontrol/keithley/daq6510_mon.py,sha256=a5a5ke9j2kjsWWnHhelHkzXP0EaO4MeuRNR7LcsSx6k,11113
9
+ egse/tempcontrol/keithley/daq6510_protocol.py,sha256=xBAo7Rd_C4Ts-Tt21EtweEadXKnOtfs-GgnLtugSTsQ,3428
10
+ egse/tempcontrol/keithley/daq6510_sim.py,sha256=Jstq00LcNzji8fVWMxmLpRExDC-Y8zeCJL1Gl5OcD_I,9979
11
+ keithley_tempcontrol/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ keithley_tempcontrol/cgse_explore.py,sha256=y_FkFxJW0vdqGNp9yTU0ELBKxby74-ev3fTuf99Vl1s,400
13
+ keithley_tempcontrol/cgse_services.py,sha256=LUk_Gk8RCzyRVzvmEkO0Dtz1dwfWpBN0VVCpRY9OFXg,3333
14
+ keithley_tempcontrol/settings.yaml,sha256=wbrgSZQAdqFl6AxiLJIN36UsdiVHQCzdsgi7Hs7dv7o,1467
15
+ keithley_tempcontrol-0.18.1.dist-info/METADATA,sha256=otqtIXT5UpVDLpa-jZ66j-B0TTxXbi2l4_hgoQNeSAc,962
16
+ keithley_tempcontrol-0.18.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
17
+ keithley_tempcontrol-0.18.1.dist-info/entry_points.txt,sha256=eo5NMMjip3sejDbn3uZvm9kgZt_EYcepuhaCu_mixic,547
18
+ keithley_tempcontrol-0.18.1.dist-info/RECORD,,
@@ -1,5 +1,6 @@
1
1
  [console_scripts]
2
2
  daq6510_cs = egse.tempcontrol.keithley.daq6510_cs:app
3
+ daq6510_mon = egse.tempcontrol.keithley.daq6510_mon:app
3
4
  daq6510_sim = egse.tempcontrol.keithley.daq6510_sim:app
4
5
 
5
6
  [gui_scripts]
@@ -1,17 +0,0 @@
1
- egse/tempcontrol/keithley/__init__.py,sha256=QMm0vy6OMqzWmJZ1K6IwKSOpgYeCmUdbcRhv75LH9ZY,130
2
- egse/tempcontrol/keithley/daq6510.py,sha256=pe12HIC2Yav5ZCGYecoQzhypYcCwecEaJpWZn-OHi8A,24867
3
- egse/tempcontrol/keithley/daq6510.yaml,sha256=dHHVNyUpOQpdrZpnxPbT6slsl-8Gbnhifj4Q8QOfOYg,4400
4
- egse/tempcontrol/keithley/daq6510_adev.py,sha256=Pp5U6a0FrUs1TFLqzvGQHhb3vfw6bhtAt4uX0OVRjBI,2263
5
- egse/tempcontrol/keithley/daq6510_cs.py,sha256=Ga7z8S6z0oTxL_qQP8FXPaNKlJ6o9RrsPFOXeIJ2TT4,7700
6
- egse/tempcontrol/keithley/daq6510_dev.py,sha256=EKFFDhP8-FdIPBPosc1DfzE3h4DQmNU1d0Fi7Yhx4I4,12906
7
- egse/tempcontrol/keithley/daq6510_mon.py,sha256=Xbn2U-l9uxPwNN1-aYW72oJodL2sx13suCiPPbDSti0,20932
8
- egse/tempcontrol/keithley/daq6510_protocol.py,sha256=v8FUrxEm7bnRzM_iQzW0mMCHTgAMZw4f2Ronl8fdKIE,2676
9
- egse/tempcontrol/keithley/daq6510_sim.py,sha256=Ys5jroT-2i-V_qCR0L6yOYM9CiktnNbB3LvVLGwaD8A,9917
10
- keithley_tempcontrol/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- keithley_tempcontrol/cgse_explore.py,sha256=y_FkFxJW0vdqGNp9yTU0ELBKxby74-ev3fTuf99Vl1s,400
12
- keithley_tempcontrol/cgse_services.py,sha256=tndviv2rvygkNSsGy1oA43VfFpyVkdB9If-9sVlLbK4,2466
13
- keithley_tempcontrol/settings.yaml,sha256=wbrgSZQAdqFl6AxiLJIN36UsdiVHQCzdsgi7Hs7dv7o,1467
14
- keithley_tempcontrol-0.17.4.dist-info/METADATA,sha256=D8Uz0pSzzRUVMpVz05Uhy-4l_u21GF-eryb17PkqhZs,962
15
- keithley_tempcontrol-0.17.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
16
- keithley_tempcontrol-0.17.4.dist-info/entry_points.txt,sha256=_0j2BwcwPi4LlRrhvEWfp9GO9KT8WhCkJe2gFgMzOPs,491
17
- keithley_tempcontrol-0.17.4.dist-info/RECORD,,