Working config again
This commit is contained in:
@@ -88,12 +88,12 @@ class GigaFrostCameraMixin(CustomDetectorMixin):
|
||||
|
||||
return udp_header_table
|
||||
|
||||
# def on_init(self) -> None:
|
||||
# """ Initialize the camera, set channel values"""
|
||||
# # ToDo: Not sure if it's a good idea to change camera settings upon
|
||||
# # ophyd device startup, i.e. each deviceserver restart.
|
||||
# self._init_gigafrost()
|
||||
# self.parent._initialized = True
|
||||
def on_init(self) -> None:
|
||||
""" Initialize the camera, set channel values"""
|
||||
# ToDo: Not sure if it's a good idea to change camera settings upon
|
||||
# ophyd device startup, i.e. each deviceserver restart.
|
||||
self._init_gigafrost()
|
||||
self.parent._initialized = True
|
||||
|
||||
def _init_gigafrost(self) -> None:
|
||||
""" Initialize the camera, set channel values"""
|
||||
@@ -385,7 +385,7 @@ class GigaFrostCamera(PSIDetectorBase):
|
||||
cfgInputPolarity2 = Component(EpicsSignalRO, "BNC5_RBV", auto_monitor=True, kind=Kind.config)
|
||||
infoBoardTemp = Component(EpicsSignalRO, "T_BOARD", auto_monitor=True)
|
||||
|
||||
USER_ACCESS = ["exposure_mode", "fix_nframes_mode", "trigger_mode", "enable_mode"]
|
||||
USER_ACCESS = ["exposure_mode", "fix_nframes_mode", "trigger_mode", "enable_mode", "initialize"]
|
||||
|
||||
autoSoftEnable = Component(Signal, kind=Kind.config)
|
||||
backendUrl = Component(Signal, kind=Kind.config)
|
||||
@@ -433,7 +433,7 @@ class GigaFrostCamera(PSIDetectorBase):
|
||||
status = DeviceStatus(self)
|
||||
sleep_time = self.cfgExposure.value*self.cfgCntNum.value*0.001+0.050
|
||||
sleep(sleep_time)
|
||||
logger.info("[%s] Slept for %f seconds", self.name, sleep_time)
|
||||
logger.debug(f"[{self.name}] Slept for {sleep_time} seconds")
|
||||
status.set_finished()
|
||||
return status
|
||||
|
||||
|
||||
@@ -151,16 +151,26 @@ class StdDaqClient(Device):
|
||||
n_total = self.n_total.get()
|
||||
|
||||
message = {"command": "start", "path": file_path, "n_image": n_total}
|
||||
reply = self.message(message)
|
||||
|
||||
if reply is not None:
|
||||
reply = json.loads(reply)
|
||||
if reply["status"] in ("creating_file"):
|
||||
ii = 0
|
||||
while True:
|
||||
reply = self.message(message)
|
||||
|
||||
if reply is not None:
|
||||
reply = json.loads(reply)
|
||||
self.status.put(reply["status"], force=True)
|
||||
elif reply["status"] in ("rejected"):
|
||||
raise RuntimeError(
|
||||
f"Start StdDAQ command rejected (might be already running): {reply['reason']}"
|
||||
)
|
||||
# Give it more time to reconfigure
|
||||
if reply["status"] in ("rejected"):
|
||||
sleep(2)
|
||||
else:
|
||||
break
|
||||
ii+=1
|
||||
if ii==5:
|
||||
break
|
||||
if reply is not None and reply["status"] in ("rejected"):
|
||||
raise RuntimeError(
|
||||
f"Start StdDAQ command rejected (might be already running): {reply['reason']}"
|
||||
)
|
||||
|
||||
self._mon = Thread(target=self.poll, daemon=True)
|
||||
self._mon.start()
|
||||
|
||||
@@ -75,12 +75,14 @@ class StdDaqPreviewMixin(CustomDetectorMixin):
|
||||
|
||||
# pylint: disable=no-member
|
||||
r = self.parent._socket.recv_multipart(flags=zmq.NOBLOCK)
|
||||
|
||||
|
||||
# Length and throtling checks
|
||||
if len(r)!=2:
|
||||
continue
|
||||
logger.warning(f"[{self.parent.name}] Received malformed array of length {len(r)}")
|
||||
t_curr = time()
|
||||
t_elapsed = t_curr - t_last
|
||||
if t_elapsed > self.parent.throttle.get():
|
||||
if t_elapsed < self.parent.throttle.get():
|
||||
sleep(0.1)
|
||||
continue
|
||||
|
||||
@@ -139,7 +141,7 @@ class StdDaqPreviewDetector(PSIDetectorBase):
|
||||
|
||||
# Status attributes
|
||||
url = Component(Signal, kind=Kind.config)
|
||||
throttle = Component(Signal, value=0.1, kind=Kind.config)
|
||||
throttle = Component(Signal, value=0.25, kind=Kind.config)
|
||||
status = Component(Signal, value=StdDaqPreviewState.UNKNOWN, kind=Kind.omitted)
|
||||
image = Component(Signal, kind=Kind.normal)
|
||||
frame = Component(Signal, kind=Kind.hinted)
|
||||
@@ -180,5 +182,5 @@ class StdDaqPreviewDetector(PSIDetectorBase):
|
||||
|
||||
# Automatically connect to MicroSAXS testbench if directly invoked
|
||||
if __name__ == "__main__":
|
||||
daq = StdDaqPreviewDetector(url="tcp://129.129.95.38:20000", name="preview")
|
||||
daq = StdDaqPreviewDetector(url="tcp://129.129.95.111:20000", name="preview")
|
||||
daq.wait_for_connection()
|
||||
|
||||
@@ -71,7 +71,7 @@ class TemplatedScanBase(AsyncFlyScanBase):
|
||||
self.taskindex = self.caller_kwargs.get("taskindex", 4)
|
||||
self.camera = self.caller_kwargs.get("camera", 'gfclient')
|
||||
self.camcfg = self.caller_kwargs.get("camcfg", {})
|
||||
self.preview = self.caller_kwargs.get("preview", 'daq_stream0')
|
||||
self.preview = self.caller_kwargs.get("preview", 'daq_stream1')
|
||||
self.daqname = self.caller_kwargs.get("daqname", None)
|
||||
self.daqcfg = self.caller_kwargs.get("daqcfg", {})
|
||||
self.daqmode = self.caller_kwargs.get("daqmode", 'collect')
|
||||
|
||||
Reference in New Issue
Block a user