keithley-tempcontrol 0.17.0__tar.gz → 0.17.1__tar.gz

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.
Files changed (21) hide show
  1. {keithley_tempcontrol-0.17.0 → keithley_tempcontrol-0.17.1}/PKG-INFO +1 -1
  2. {keithley_tempcontrol-0.17.0 → keithley_tempcontrol-0.17.1}/pyproject.toml +1 -1
  3. {keithley_tempcontrol-0.17.0 → keithley_tempcontrol-0.17.1}/src/egse/tempcontrol/keithley/daq6510_cs.py +3 -0
  4. {keithley_tempcontrol-0.17.0 → keithley_tempcontrol-0.17.1}/src/egse/tempcontrol/keithley/daq6510_dev.py +10 -8
  5. {keithley_tempcontrol-0.17.0 → keithley_tempcontrol-0.17.1}/src/egse/tempcontrol/keithley/daq6510_sim.py +17 -16
  6. {keithley_tempcontrol-0.17.0 → keithley_tempcontrol-0.17.1}/.gitignore +0 -0
  7. {keithley_tempcontrol-0.17.0 → keithley_tempcontrol-0.17.1}/README.md +0 -0
  8. {keithley_tempcontrol-0.17.0 → keithley_tempcontrol-0.17.1}/justfile +0 -0
  9. {keithley_tempcontrol-0.17.0 → keithley_tempcontrol-0.17.1}/noxfile.py +0 -0
  10. {keithley_tempcontrol-0.17.0 → keithley_tempcontrol-0.17.1}/service_registry.db +0 -0
  11. {keithley_tempcontrol-0.17.0 → keithley_tempcontrol-0.17.1}/src/egse/tempcontrol/keithley/__init__.py +0 -0
  12. {keithley_tempcontrol-0.17.0 → keithley_tempcontrol-0.17.1}/src/egse/tempcontrol/keithley/daq6510.py +0 -0
  13. {keithley_tempcontrol-0.17.0 → keithley_tempcontrol-0.17.1}/src/egse/tempcontrol/keithley/daq6510.yaml +0 -0
  14. {keithley_tempcontrol-0.17.0 → keithley_tempcontrol-0.17.1}/src/egse/tempcontrol/keithley/daq6510_acs.py +0 -0
  15. {keithley_tempcontrol-0.17.0 → keithley_tempcontrol-0.17.1}/src/egse/tempcontrol/keithley/daq6510_adev.py +0 -0
  16. {keithley_tempcontrol-0.17.0 → keithley_tempcontrol-0.17.1}/src/egse/tempcontrol/keithley/daq6510_mon.py +0 -0
  17. {keithley_tempcontrol-0.17.0 → keithley_tempcontrol-0.17.1}/src/egse/tempcontrol/keithley/daq6510_protocol.py +0 -0
  18. {keithley_tempcontrol-0.17.0 → keithley_tempcontrol-0.17.1}/src/keithley_tempcontrol/__init__.py +0 -0
  19. {keithley_tempcontrol-0.17.0 → keithley_tempcontrol-0.17.1}/src/keithley_tempcontrol/cgse_explore.py +0 -0
  20. {keithley_tempcontrol-0.17.0 → keithley_tempcontrol-0.17.1}/src/keithley_tempcontrol/cgse_services.py +0 -0
  21. {keithley_tempcontrol-0.17.0 → keithley_tempcontrol-0.17.1}/src/keithley_tempcontrol/settings.yaml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: keithley-tempcontrol
3
- Version: 0.17.0
3
+ Version: 0.17.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>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "keithley-tempcontrol"
3
- version = "0.17.0"
3
+ version = "0.17.1"
4
4
  description = "Keithley Temperature Control for CGSE"
5
5
  authors = [
6
6
  {name = "IvS KU Leuven"}
@@ -166,6 +166,7 @@ def start():
166
166
 
167
167
  with remote_logging():
168
168
  from egse.env import setup_env
169
+
169
170
  setup_env()
170
171
 
171
172
  try:
@@ -198,6 +199,7 @@ def stop():
198
199
  multiprocessing.current_process().name = "daq6510_cs (stop)"
199
200
 
200
201
  from egse.env import setup_env
202
+
201
203
  setup_env()
202
204
 
203
205
  try:
@@ -217,6 +219,7 @@ def status():
217
219
  multiprocessing.current_process().name = "daq6510_cs (status)"
218
220
 
219
221
  from egse.env import setup_env
222
+
220
223
  setup_env()
221
224
 
222
225
  endpoint = get_endpoint(SERVICE_TYPE, PROTOCOL, HOSTNAME, COMMANDING_PORT)
@@ -23,6 +23,9 @@ DEV_HOST = dev_settings.get("HOSTNAME")
23
23
  DEV_PORT = dev_settings.get("PORT")
24
24
  READ_TIMEOUT = dev_settings.get("TIMEOUT") # [s], can be smaller than timeout (for DAQ6510Proxy) (e.g. 1s)
25
25
 
26
+ SEPARATOR = b"\n"
27
+ SEPARATOR_STR = SEPARATOR.decode()
28
+
26
29
 
27
30
  class DAQ6510Command(ClientServerCommand):
28
31
  def get_cmd_string(self, *args, **kwargs) -> str:
@@ -36,7 +39,7 @@ class DAQ6510Command(ClientServerCommand):
36
39
  """
37
40
 
38
41
  out = super().get_cmd_string(*args, **kwargs)
39
- return out + "\n"
42
+ return out + SEPARATOR_STR
40
43
 
41
44
 
42
45
  class DAQ6510(DeviceInterface, DeviceTransport):
@@ -107,6 +110,8 @@ class DAQ6510(DeviceInterface, DeviceTransport):
107
110
  logger.debug(f"Sending {cmd}...")
108
111
  self.write(cmd)
109
112
 
113
+ return responses
114
+
110
115
  def is_simulator(self) -> bool:
111
116
  return False
112
117
 
@@ -243,7 +248,7 @@ class DAQ6510(DeviceInterface, DeviceTransport):
243
248
  """
244
249
 
245
250
  try:
246
- command += "\n" if not command.endswith("\n") else ""
251
+ command += SEPARATOR_STR if not command.endswith(SEPARATOR_STR) else ""
247
252
 
248
253
  self._sock.sendall(command.encode())
249
254
 
@@ -258,7 +263,7 @@ class DAQ6510(DeviceInterface, DeviceTransport):
258
263
  raise DeviceConnectionError(DEVICE_NAME, msg)
259
264
  raise
260
265
 
261
- def trans(self, command: str) -> str:
266
+ def trans(self, command: str) -> bytes:
262
267
  """Sends a single command to the device controller and block until a response from the controller.
263
268
 
264
269
  This is seen as a transaction.
@@ -277,7 +282,7 @@ class DAQ6510(DeviceInterface, DeviceTransport):
277
282
  try:
278
283
  # Attempt to send the complete command
279
284
 
280
- command += "\n" if not command.endswith("\n") else ""
285
+ command += SEPARATOR_STR if not command.endswith(SEPARATOR_STR) else ""
281
286
 
282
287
  self._sock.sendall(command.encode())
283
288
 
@@ -323,10 +328,7 @@ class DAQ6510(DeviceInterface, DeviceTransport):
323
328
  break
324
329
  except socket.timeout:
325
330
  logger.warning(f"Socket timeout error for {self.hostname}:{self.port}")
326
- return b"\r\n"
327
- except TimeoutError as exc:
328
- logger.warning(f"Socket timeout error: {exc}")
329
- return b"\r\n"
331
+ return SEPARATOR
330
332
  finally:
331
333
  self._sock.settimeout(saved_timeout)
332
334
 
@@ -1,21 +1,23 @@
1
- from __future__ import annotations
2
-
3
1
  import contextlib
4
2
  import datetime
5
- import logging
6
3
  import re
7
4
  import socket
8
5
  import time
6
+ from typing import Annotated
9
7
 
10
8
  import typer
9
+
10
+ from egse.log import logging
11
11
  from egse.settings import Settings
12
12
  from egse.system import SignalCatcher
13
13
 
14
- logger = logging.getLogger("daq6510-sim")
14
+ logger = logging.getLogger("egse.daq6510-sim")
15
15
 
16
16
  HOST = "localhost"
17
17
  DAQ_SETTINGS = Settings.load("Keithley DAQ6510")
18
18
 
19
+ SEPARATOR = b"\n"
20
+ SEPARATOR_STR = SEPARATOR.decode()
19
21
 
20
22
  device_time = datetime.datetime.now(datetime.timezone.utc)
21
23
  reference_time = device_time
@@ -79,7 +81,7 @@ COMMAND_PATTERNS_ACTIONS_RESPONSES = {
79
81
 
80
82
 
81
83
  def write(conn, response: str):
82
- response = f"{response}\n".encode()
84
+ response = f"{response}{SEPARATOR_STR}".encode()
83
85
  logger.debug(f"write: {response = }")
84
86
  conn.sendall(response)
85
87
 
@@ -196,7 +198,7 @@ def run_simulator():
196
198
  logger.info(f"{exc.__class__.__name__} caught: {exc.args}")
197
199
 
198
200
 
199
- def send_request(cmd: str, type_: str = "query"):
201
+ def send_request(cmd: str, cmd_type: str = "query") -> str | None:
200
202
  from egse.tempcontrol.keithley.daq6510_dev import DAQ6510
201
203
 
202
204
  response = None
@@ -204,12 +206,12 @@ def send_request(cmd: str, type_: str = "query"):
204
206
  daq_dev = DAQ6510(hostname="localhost", port=5025)
205
207
  daq_dev.connect()
206
208
 
207
- if type_.lower().strip() == "query":
209
+ if cmd_type.lower().strip() == "query":
208
210
  response = daq_dev.query(cmd)
209
- elif type_.lower().strip() == "write":
211
+ elif cmd_type.lower().strip() == "write":
210
212
  daq_dev.write(cmd)
211
213
  else:
212
- logger.info(f"Unknown type {type_} for send_request.")
214
+ logger.info(f"Unknown command type {cmd_type} for send_request.")
213
215
 
214
216
  daq_dev.disconnect()
215
217
 
@@ -234,15 +236,14 @@ def stop():
234
236
 
235
237
 
236
238
  @app.command()
237
- def command(type_: str, cmd: str):
238
- response = send_request(cmd, type_)
239
+ def command(
240
+ cmd: str,
241
+ cmd_type: Annotated[str, typer.Argument(help="either 'write', 'query'")] = "query",
242
+ ):
243
+ """Send an SCPI command directly to the simulator. The response will be in the log info."""
244
+ response = send_request(cmd, cmd_type)
239
245
  logger.info(f"{response}")
240
246
 
241
247
 
242
248
  if __name__ == "__main__":
243
- logging.basicConfig(
244
- level=logging.DEBUG,
245
- format="%(asctime)s %(threadName)-12s %(levelname)-8s %(name)-12s %(module)-20s %(message)s",
246
- )
247
-
248
249
  app()