DAQ/GUI - debugging: added print statments with time.ctime calls to make locating where and when errors occur easier. This is a tempoary measure until we implement logging.

This commit is contained in:
leonarski_f committed 2025-09-11 14:43:49 +02:00
1 parent 7d2cdeca68
commit 3acf26cec7
3 files changed
+32 -7

No files matched your search

+4
View File
@@ -24,6 +24,8 @@ from aaredaqlib.beamline import mx_beamline
from aaredaq.config import BeamlineConfig
from aaredaq.daq import AareDAQ
from aaredaq.camera_stat_thread import start_image_stats_receiver, stop_image_stats_receiver
app = FastAPI()
# OAuth2 setup
@@ -439,4 +441,6 @@ def main():
if __name__ == "__main__":
#start_image_stats_receiver(zmq_url="tcp://129.129.110.12:9089")
main()
#stop_image_stats_receiver()
+26 -5
View File
@@ -53,11 +53,16 @@ def wait_for_se_devices(devs: BeamlineDevices, cfg: BeamlineConfig):
def common_2rse(devs: BeamlineDevices, cfg: BeamlineConfig):
print(time.ctime(), " moving COLLIMATOR to PARK position")
devs.collimator = StagePositionEnum.PARK
print(time.ctime(), " moving SMARGON to HOME position")
devs.smargon.move_home(wait=True)
print(time.ctime(), " moving AEROTECH to MOUNT position")
devs.aerotech.move(ABR_OMEGA_MOUNT, wait=True, direct=True)
devs.abr_pos = ABR_POS_MOUNT
print(time.ctime(), " moving REFLECTOR to DOWN position")
devs.reflector_up = False
print(time.ctime(), " LOCKING AEROTERCH")
devs.aerotech.lock()
@@ -103,18 +108,23 @@ def m2se(devs: BeamlineDevices, cfg: BeamlineConfig):
def sa2se(devs: BeamlineDevices, cfg: BeamlineConfig):
hub = cfg.settings
hub_cryo = cfg.cryojet_settings
print(time.ctime()," moving cryojet to park position")
_cryopark = hub_cryo.cryojet_park_position
_dtzpark = hub.dtz_park
if devs.cryo.position < _cryopark:
devs.cryo.move(_cryopark)
print(time.ctime(), " moving COLLIMATOR to DOWN position")
devs.collimator = StagePositionEnum.DOWN
print(time.ctime(), " moving REFLECTOR to DOWN position")
devs.reflector_up = False
devs.beamstop_stage_up = False
print(time.ctime(), " moving SMARGON to HOME position")
devs.smargon.move_home(wait=True)
print(time.ctime(), " moving DETECTOR COVER to DOWN position")
devs.detector_cover.put(1) # Close detector cover
if devs.dtz.position < _dtzpark:
print(time.ctime(), " moving DETECTOR to PARK position")
devs.dtz.move(_dtzpark)
@@ -127,36 +137,47 @@ def dc2rse(devs: BeamlineDevices, cfg: BeamlineConfig):
def se2sa(devs: BeamlineDevices, cfg: BeamlineConfig):
print(time.ctime(), " moving detector cover to open position")
devs.detector_cover.put(2) # Open detector cover
print(time.ctime(), " mchanging settings")
hub = cfg.settings
hub_cryo = cfg.cryojet_settings
_cryo = hub_cryo.cryojet_in_use
cryo_meas = hub_cryo.cryojet_measurement_position
_dtz_safety = hub.dtz_bsz_safety_margin
print(time.ctime(), " aerotech unlocked")
devs.aerotech.unlock()
devs.aerotech.set_direct_mode()
print(time.ctime(), " moving reflector to up position")
devs.reflector_up = True
print(time.ctime(), " moving beamstop to up position")
devs.beamstop_stage_up = True
print(time.ctime(), " setting lamp to 2.5")
devs.lamp_light = 2.5
print(time.ctime(), " moving aerotech to measure position")
devs.abr_pos = cfg.abr_meas_pos
if _cryo:
print(time.ctime(), " moving cryojet to measure position")
devs.cryo.move(cryo_meas)
print(time.ctime(), " moving detector to measure position")
devs.dtz.move(cfg.dtz, wait=False)
def rse2sa(devs: BeamlineDevices, cfg: BeamlineConfig):
devs.detector_cover.put(2) # Open detector cover
print(time.ctime(), " moving DETECTOR COVER to OPEN position")
if devs.tell.is_in_park():
print(time.ctime(), " moving TELL to COLD")
devs.tell.move_cold(wait=True)
start_time = time.time()
print(time.ctime(), " starting se 2 sa ", start_time)
se2sa(devs, cfg)
elapsed_time = time.time() - start_time
remaining_time = max(0.0, 30 - elapsed_time)
print(remaining_time)
print(time.ctime(), " sleeping for reamining time ", remaining_time)
time.sleep(remaining_time)
print(time.ctime(), " slept for remainign time ", remaining_time)
else:
se2sa(devs, cfg)
+2 -2
View File
@@ -323,12 +323,12 @@ class TellClient:
)
wait_timeout = timeout + self.estimate_mounting_time(segment)
print(f"{time.ctime()} waiting for mount to complete")
if wait:
self.check_command_ok(
timeout=wait_timeout, msg=f"Mount failed for {segment}{puck}-{sample}: "
)
print(f"{time.ctime()} post waiting")
return self._last_cmd_id
def unmount(self, force=False, wait=False, timeout=360.0):