fxes. working Zeiss-1000+EMCCD sequence

This commit is contained in:
2025-08-24 19:39:54 +03:00
parent cd49a9044f
commit 66c10e2f31
3 changed files with 26 additions and 6 deletions

View File

@@ -18,6 +18,7 @@ import subprocess as sp
import numpy as np
import socket
import pathlib as pl
import time
def init_seq(seq_kwds):
@@ -45,13 +46,28 @@ def set_focus(foc_val):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("ztcs.sao.ru", 4444))
sock.send("goto={:g}".format(foc_val))
resp = sock.recv(20)
bt = bytearray("goto={:g}".format(foc_val), 'utf8')
sock.send(bt)
resp = sock.recv(20).decode('utf8')
if resp != "OK":
sock.close()
return 1
tp_start = time.monotonic()
while True:
time.sleep(0.5)
sock.send(b'status')
resp = sock.recv(20).decode('utf8')
if resp == 'OK':
break;
if (time.monotonic()-tp_start) > 30.0:
sock.close() # timeout!
return 2
sock.close()
return 0
@@ -61,7 +77,7 @@ def set_focus(foc_val):
# Assumes Andor IXon EMCCD server is listenning UNIX socket on localhost
#
def get_image(filename, exp_time):
cmd = ["ixonultra_cmdclient", "-A", "CCD", "-T", "{:g}".format(exp_time), filename]
cmd = ["ixonultra_cmdclient", "-A", "CCD", "-p", "1", "--hs", "0", "-T", "{:g}".format(exp_time), filename]
ret = sp.run(cmd, stdout=sp.PIPE, stderr=sp.PIPE)
return ret.returncode