continue omny init and started optics alignment

This commit is contained in:
Holler Mirko
2024-11-05 15:06:35 +01:00
committed by wakonig_k
parent d32d7401a3
commit fb6ec1c350
3 changed files with 498 additions and 337 deletions
+197 -335
View File
@@ -12,6 +12,8 @@ from bec_lib.pdf_writer import PDFWriter
from typeguard import typechecked
from csaxs_bec.bec_ipython_client.plugins.cSAXS import cSAXSBeamlineChecks
from csaxs_bec.bec_ipython_client.plugins.omny.omny_optics_mixin import OMNYOpticsMixin
#from csaxs_bec.bec_ipython_client.plugins.flomni.x_ray_eye_align import XrayEyeAlign
logger = bec_logger.logger
@@ -39,6 +41,16 @@ class OMNYInitStagesMixin:
print("starting...")
else:
return
# #maybe replace 2 by something
# axis_id = dev.fheater._config["deviceConfig"].get("axis_Id")
# axis_id_numeric = self.axis_id_to_numeric(axis_id)
if not dev.oshield.controller.axis_is_referenced(2):
user_input = input("The smaract stage of the cryo shield has to be referenced first. Continue? [y/n]")
if user_input == "y":
self.omny_init_smaract()
else:
return
if self.check_all_axes_of_OMNY_referenced():
user_input = input("All axes are referenced already. Continue anyways? [y/n]")
@@ -47,9 +59,7 @@ class OMNYInitStagesMixin:
else:
return
# if(!_smar_rt_axis_is_referenced(0,2)):
# print("The smaract stage of the cryo shield has to be referenced first: _smar_rt_init\n")
# return
if np.fabs(dev.oshield.get().readback) > 0.1:
user_input = input("oshield is not around pos 0. Can the OSA be moved to -z limit then -x limit. Risk of collition! Y/n?")
@@ -214,287 +224,199 @@ class OMNYInitStagesMixin:
print("osamy is in limit")
#check shield is at zero position
#check shield is at zero position
_ostages_init_confirm("perform reference search of oosax?")
_ogalil_find_reference_mark_mne("oosax")
set_lm oosax -1 4
_ostages_init_confirm("perform reference search of oosay?")
_ogalil_find_reference_mark_mne("oosay")
set_lm oosay -.1 .6
_ostages_init_confirm("perform reference search of osamy?")
_ogalil_find_reference_mark_mne("osamy")
set_lm osamy -1 1
_ostages_init_confirm("perform reference search of oosaz?")
_ogalil_find_reference_mark_mne("oosaz")
set_lm oosaz -2 .1
_ostages_init_confirm("find endswitch and reference mark of osamroy?")
global _ogalil_ignore_glitch_rotstage
_ogalil_ignore_glitch_rotstage=1
_ogalil_drive_to_limit_mne("osamroy",0 )
_ogalil_find_reference_mark_mne("osamroy")
global _osamroy_last_rotation_angle
_osamroy_last_rotation_angle=0
set_lm osamroy -27 337
_ogalil_ignore_glitch_rotstage=0
_ostages_init_confirm("find reference marks of transfer Y?")
_ogalil_find_reference_mark_mne("otransy")
set_lm otransx -459 21
set_lm otransy -41 1
set_lm otransz -67.5 11
_ostages_init_confirm("find endswitches and reference marks of tracking stage system?")
_ogalil_drive_to_limit_mne("otracky",1)
_ogalil_find_reference_mark_mne("otracky")
_ogalil_find_reference_mark_mne("otrackz")
_ogalil_folerr_not_ignore( 0)
_ogalil_folerr_not_ignore( 1)
_ogalil_folerr_not_ignore( 2)
_ogalil_put_confirmed(2,"ACE=11264")
_ogalil_put_confirmed(2,"ACB=11264")
_ogalil_put_confirmed(2,"DCE=11264")
_ogalil_put_confirmed(2,"DCB=11264")
ogalil_show_all
_ogalil_init_adjust
}'
def _ogalil_init_adjust '{
if(!yesno("adjust all stages to approximate alignment?",1))
exit
oeye_cam_in
umv oosay 0.5
set_lm oosay .4 .6
set_lm osamy -1 3
umv osamy 2.7 ofzpx -.8 ofzpy 1.6
set_lm osamy 2.5 2.9
set_lm ofzpx -2 0
set_lm ofzpy -0 3
set_lm ofzpz -2.5 60
_oshield_ST_close
set_lm otracky -7 -3
set_lm otrackz -2 1
umv otracky -4.3431 otrackz -0.6948
_ogalil_user_dial_offsets_to_zero()
_ogalil_put_confirmed(1,"SPA=100")
_ogalil_put_confirmed(1,"ACA=1878")
_ogalil_put_confirmed(1,"DCA=1878")
_ogalil_put_confirmed(2,"ACE=11264")
_ogalil_put_confirmed(2,"ACB=11264")
_ogalil_put_confirmed(2,"DCE=11264")
_ogalil_put_confirmed(2,"DCB=11264")
_ogalil_put_confirmed(2,"axspeed[0]=1000")
####flomni stuff
user_input = input(
"Init of foptz. Can the stage move to the upstream limit without collision? [y/n]"
)
user_input = input("perform reference search of oosax?")
if user_input == "y":
print("good then")
dev.oosax.find_reference()
print("oosax is referenced")
dev.oosax.limits = [-1, 4]
user_input = input("find reference mark of oosay?")
if user_input == "y":
dev.oosay.find_reference()
print("oosay is referenced")
dev.oosay.limits = [-0.1, 0.6]
user_input = input("find reference mark of osamy?")
if user_input == "y":
dev.osamy.find_reference()
print("osamy is referenced")
dev.osamy.limits = [-1, 1]
user_input = input("find reference mark of oosaz?")
if user_input == "y":
dev.oosaz.find_reference()
print("oosaz is referenced")
dev.oosaz.limits = [-2, 0.1]
user_input = input("find endswitch and reference mark of osamroy?")
if user_input == "y":
dev.osamroy.drive_axis_to_limit("reverse")
print("osamroy is in limit")
dev.osamroy.find_reference()
print("osamroy is referenced")
dev.osamroy.limits = [-27, 337]
user_input = input("find reference mark of transfer Y?")
if user_input == "y":
dev.otransy.find_reference()
print("otransy is referenced")
dev.otransy.limits = [-41, 1]
dev.otransx.limits = [-459, 21]
dev.otransz.limits = [-67.5, 11]
user_input = input("find endswitches and reference marks of tracking stage system?")
if user_input == "y":
dev.otracky.drive_axis_to_limit("forward")
print("otracky is in limit")
user_input = input("find reference mark of otracky?")
if user_input == "y":
dev.otracky.find_reference()
print("otracky is referenced")
user_input = input("find reference mark of otrackz?")
if user_input == "y":
dev.otrackz.find_reference()
print("otrackz is referenced")
#all three controllers
dev.ofzpx.controller._ogalil_folerr_not_ignore()
dev.osamx.controller._ogalil_folerr_not_ignore()
dev.osamy.controller._ogalil_folerr_not_ignore()
#adjust acceleration of tracking stages
dev.osamy.controller.socket_put_confirmed("ACE=11264")
dev.osamy.controller.socket_put_confirmed("ACB=11264")
dev.osamy.controller.socket_put_confirmed("DCE=11264")
dev.osamy.controller.socket_put_confirmed("DCB=11264")
dev.osamy.controller.galil_show_all()
self._initial_alignment()
self._setalllimitsomny()
def omny_init_smaract():
#_smar_rt_set_max_closed_loop_frequency(0,0,3000)
#_smar_rt_set_max_closed_loop_frequency(0,1,3000)
#_smar_rt_set_max_closed_loop_frequency(0,2,3000)
dev.oshield.controller.find_reference_mark(1, 0, 1000, 1)
time.sleep(1)
dev.oshield.controller.find_reference_mark(0, 0, 1000, 1)
time.sleep(1)
if not dev.otransy.get_motor_limit_switch()[1]:
user_input = input("drive otransy stage to +Y limit?")
if user_input == "y":
dev.otransy.drive_axis_to_limit("forward")
print("otrany reached limit")
else:
print("otransy is in upper limit, i.e. safe condition")
user_input = input("Problematic part: Can the OSA be moved to -z limit then -x limit. Risk of collition! y/n?")
if user_input == "y":
dev.oosaz.drive_axis_to_limit("forward")
dev.oosax.drive_axis_to_limit("forward")
else:
raise OMNYInitError("Automatic init not possible.")
dev.oshield.controller.find_reference_mark(2, 0, 1000, 1)
dev.oshield.limits = [-14.5, 15.8]
dev.ocsx.limits = [-2, 5]
dev.ocsy.limits = [-1, 3]
user_input = input("Move CS out of the beam path?")
if user_input == "y":
umv(dev.ocsx, 5, dev.ocsy, 2)
dev.oshield.controller.show_all()
print("Finished initialization of OMNY smaract system")
def _setalllimitsomny():
dev.rtx.limits = [-250, 250]
dev.rty.limits = [-250, 250]
dev.rtz.limits = [-250, 250]
dev.osamx.limits = [-1, 1]
dev.osamy.limits = [2.3000, 3.0000]
dev.osamroy.limits = [-27.0000, 337.0000]
dev.oeyex.limits = [-48.0000, 10.0000]
dev.oeyez.limits = [-85.0000, 10.0000]
dev.oeyey.limits = [-61.0000, 1.0000]
dev.oosay.limits = [0.0800, 1.0000]
dev.oosax.limits = [-3.0000, 3.7000]
dev.oosaz.limits = [6.4000, 6.6000]
dev.ofzpx.limits = [-2.0000, 2.0000]
dev.ofzpy.limits = [-1.0000, 3.0000]
dev.ofzpz.limits = [-2.5000, 60.0000]
dev.otransx.limits = [-459.0000, 33.0000]
dev.otransy.limits = [-41.0000, 1.0000]
dev.otransz.limits = [-70.5000, 11.0000]
dev.oparkz .limits = [-165.0000, 1.0000]
dev.otracky.limits = [-3.0000, -7.0000]
dev.otrackz.limits = [-2.0000, 1.0000]
dev.ocsy.limits = [-2.0000, 2.0000]
dev.ocsx.limits = [-2.0000, 2.0000]
dev.oshield.limits = [-14.5000, 15.8000]
def _initial_alignment(self):
user_input = input("Start moving stages to default initial positions? [y/n]")
if user_input == "y":
print("Start moving stages...")
else:
print("Stopping.")
return
print("Starting to drive foptz to -z limit")
self.drive_axis_to_limit(dev.foptz, "reverse")
dev.foptz.limits = [0, 27]
print("done")
self.oeye_cam_in()
print("Init of Smaract stages")
## smaract stages
max_repeat = 100
repeat = 0
axis_id_fosaz = dev.fosaz._config["deviceConfig"].get("axis_Id")
axis_id_numeric_fosaz = self.axis_id_to_numeric(axis_id_fosaz)
print("Moving fosaz upstream into the light curtain")
while True:
curtain_is_triggered = dev.foptz.controller.fosaz_light_curtain_is_triggered()
if curtain_is_triggered:
break
if repeat > max_repeat:
raise FlomniInitError("Failed to initialize fosaz within 100 repeats.")
dev.fosaz.controller.move_open_loop_steps(
axis_id_numeric_fosaz, -500, amplitude=4000, frequency=2000
umv(dev.oosay, 0.5)
dev.oosay.limits = [0.4, 0.6]
dev.osamy.limits = [-1, 3]
umv(dev.osamy, 2.7, dev.ofzpx, -0.8, dev.ofzpy, 1.6)
dev.osamy.limits = [2.5, 2.9]
dev.ofzpx.limits = [-2, 0]
dev.ofzpy.limits = [-0, 3]
dev.ofzpz.limits = [-2.5, 60]
if "rtx" in dev and dev.rtx.enabled:
dev.rtx.controller.feedback_disable()
self._oshield_ST_close()
dev.otracky.limits = [-7, -3]
dev.otracky.limits = [-2, 1]
otracky_start_pos = dev.otracky.user_parameter.get("start_pos")
if otracky_start_pos is None:
raise OMNYInitError(
"Could not find otracky start position. Please check your device config."
)
time.sleep(1)
repeat += 1
otrackz_start_pos = dev.otrackz.user_parameter.get("start_pos")
if otrackz_start_pos is None:
raise OMNYInitError(
"Could not find otrackz start position. Please check your device config."
)
print("Finding index of fosax, fosay, fosaz")
for ii in range(3):
dev.fosax.controller.find_reference_mark(ii, 0, 1000, 1)
time.sleep(1)
umv(dev.otracky, otracky_start_pos, dev.otrackz, otrackz_start_pos)
dev.fosax.limits = [10.2, 10.6]
dev.fosay.limits = [-3.1, -2.9]
dev.fosaz.limits = [-6, -4]
# dev.fosax.controller.describe()
#adjust acceleration and speed of osamx
dev.osamx.controller.socket_put_confirmed("SPA=100")
dev.osamx.controller.socket_put_confirmed("ACA=1878")
dev.osamx.controller.socket_put_confirmed("DCA=187")
print("Moving fosa stages to approximate beam positions")
umv(dev.fosaz, -5)
umv(dev.fosax, 10.4, dev.fosay, -3)
print("done")
#adjust acceleration of tracking stages
dev.osamy.controller.socket_put_confirmed("ACE=11264")
dev.osamy.controller.socket_put_confirmed("ACB=11264")
dev.osamy.controller.socket_put_confirmed("DCE=11264")
dev.osamy.controller.socket_put_confirmed("DCB=11264")
print("Moving fheater to +y limit")
self.drive_axis_to_limit(dev.fheater, "reverse")
dev.fheater.limits = [-15, 0]
print("done")
#adjust osamy velocity
dev.osamy.controller.socket_put_confirmed("axspeed[0]=1000")
print("Moving fsamy to -y limit")
self.drive_axis_to_limit(dev.fsamy, "reverse")
dev.fsamy.limits = [2, 3.1]
print("done")
user_input = input(
"Init of tracking stages. Did you remove the outer laser flight tubes? [y/n]"
)
if user_input == "y":
print("good then")
else:
print("Stopping.")
return
print("Moving tracky to -y limit")
self.drive_axis_to_limit(dev.ftracky, "reverse")
dev.ftracky.limits = [2.2, 2.8]
print("done")
print("Moving ftrackz to -z limit")
self.drive_axis_to_limit(dev.ftrackz, "reverse")
dev.ftrackz.limits = [4.5, 5.5]
print("done")
user_input = input("Init of sample stage. Is the piezo at about 0 deg? [y/n]")
if user_input == "y":
print("good then")
else:
print("Stopping.")
return
print("Moving fsamx to +x limit")
self.drive_axis_to_limit(dev.fsamx, "forward")
dev.fsamx.limits = [-162, 0]
print("done")
print("Moving ftray to IN limit")
self.drive_axis_to_limit(dev.ftray, "reverse")
dev.ftray.limits = [-200, 0]
print("done")
print("Initializing UPR stage.")
user_input = input(
"To ensure that the end switches work, please check that they are currently not pushed."
" Is everything okay? [y/n]"
)
if user_input == "y":
print("good then")
else:
print("Stopping.")
return
while True:
low_limit, high_limit = dev.fsamroy.controller.get_motor_limit_switch("A")
if not high_limit:
print("Please push limit switch to the left.")
time.sleep(1)
continue
break
while True:
low_limit, high_limit = dev.fsamroy.controller.get_motor_limit_switch("A")
if not low_limit:
print("Please push limit switch to the right.")
time.sleep(1)
continue
break
user_input = input("Shall I start the index search? [y/n]")
if user_input == "y":
print("good then. Starting index search.")
else:
print("Stopping.")
return
if dev.fsamroy.controller.is_motor_on("A"):
raise FlomniInitError("fsamroy should be off. Something is wrong. Mirko... help!")
dev.fsamroy.controller.socket_put_confirmed("XQ#MOTON")
dev.fsamroy.enabled = False
time.sleep(5)
dev.fsamroy.enabled = True
time.sleep(2)
dev.fsamroy.controller.socket_put_confirmed("XQ#REFAX")
while not dev.fsamroy.controller.all_axes_referenced():
print("Waiting for fsamroy to be referenced.")
time.sleep(1)
dev.fsamroy.limits = [-5, 365]
print("done")
user_input = input(
"Init of foptx. Can the stage move to the positive limit without collision? Attention:"
" tracker flight tube! [y/n]"
)
if user_input == "y":
print("good then")
else:
print("Stopping.")
return
print("Moving foptx to +x limit")
self.drive_axis_to_limit(dev.foptx, "forward")
dev.foptx.limits = [-16, -14]
print("done")
axis_id_fopty = dev.fopty._config["deviceConfig"].get("axis_Id")
while True:
low_limit, high_limit = dev.fopty.controller.get_motor_limit_switch(axis_id_fopty)
if not low_limit:
print(
"To ensure that the fopty end switch works, please push it down and hold it for"
" about 1 second."
)
time.sleep(1)
continue
break
user_input = input("Start limit switch search of fopty? [y/n]")
if user_input == "y":
print("good then")
else:
print("Stopping.")
return
print("Moving fopty to -y limit")
self.drive_axis_to_limit(dev.fopty, "reverse")
dev.fopty.limits = [0, 4]
print("done")
dev.fsamx.controller.galil_show_all()
self.set_limits()
self._align_setup()
def check_all_axes_of_OMNY_referenced(self) -> bool:
if (
@@ -504,66 +426,6 @@ _ogalil_put_confirmed(2,"axspeed[0]=1000")
else:
return False
def set_limits(self):
user_input = input("Set default limits for flOMNI? [y/n]")
if user_input == "y":
print("setting limits...")
else:
print("Stopping.")
return
dev.ftransy.limits = [-100, 0]
dev.ftransz.limits = [0, 145]
dev.ftransx.limits = [0, 50]
dev.ftray.limits = [-200, 0]
dev.fsamy.limits = [2, 3.5]
dev.foptz.limits = [22.5, 28]
dev.foptx.limits = [-17, -12]
dev.fheater.limits = [-15, 0]
dev.feyex.limits = [-18, -1]
dev.feyey.limits = [-12, -1]
dev.fopty.limits = [0, 4]
dev.fosax.limits = [7, 10]
dev.fosay.limits = [-4.2, 7]
dev.fosaz.limits = [-6.5, 7.5]
# dev.rtx.limits = [-220, 220]
# dev.rty.limits = [-180, 180]
# dev.rtz.limits = [-220, 220]
dev.fsamroy.limits = [-5, 365]
dev.ftracky.limits = [2.2, 2.8]
dev.ftrackz.limits = [4.5, 5.5]
def _align_setup(self):
user_input = input("Start moving stages to default initial positions? [y/n]")
if user_input == "y":
print("Start moving stages...")
else:
print("Stopping.")
return
dev.rtx.controller.feedback_disable()
# positions for optics out and 50 mm distance to sample
umv(dev.ftrackz, 4.73, dev.ftracky, 2.5170, dev.foptx, -14.3, dev.fopty, 3.87)
# the fopty 3.87 should put us in place for a lower FZP on the lower FZP chip
umv(dev.foptz, 23)
flomni_samx_in = dev.fsamx.user_parameter.get("in")
if flomni_samx_in is None:
raise FlomniInitError(
"Could not find a fsamx in position. Please check your device config."
)
umv(dev.fsamx, flomni_samx_in)
flomni_samy_in = dev.fsamy.user_parameter.get("in")
if flomni_samy_in is None:
raise FlomniInitError(
"Could not find a fsamy in position. Please check your device config."
)
umv(dev.fsamy, flomni_samy_in)
# after init reduce vertical stage speed
dev.fsamy.controller.socket_put_confirmed("axspeed[5]=20000")
umv(dev.feyey, -8)
class FlomniSampleTransferMixin:
@@ -1330,11 +1192,11 @@ class FlomniAlignmentMixin:
return additional_correction_shift
class Flomni(
FlomniInitStagesMixin,
class OMNY(
OMNYInitStagesMixin,
FlomniSampleTransferMixin,
FlomniAlignmentMixin,
FlomniOpticsMixin,
OMNYOpticsMixin,
cSAXSBeamlineChecks,
):
def __init__(self, client):
@@ -0,0 +1,299 @@
import time
import numpy as np
from rich import box
from rich.console import Console
from rich.table import Table
from csaxs_bec.bec_ipython_client.plugins.cSAXS import epics_put, fshclose
class OMNYError(Exception):
pass
class OMNYOpticsMixin:
@staticmethod
def _get_user_param_safe(device, var):
param = dev[device].user_parameter
if not param or param.get(var) is None:
raise ValueError(f"Device {device} has no user parameter definition for {var}.")
return param.get(var)
def ooptics_in(self):
self.ofzp_in()
#ocs_in
self.oosa_in()
if "rtx" in dev and dev.rtx.enabled:
dev.rtx.controller.feedback_enable()
self.align.update_frame()
user_input = input("Is the direct beam gone on the xray eye? Do you see the cone of the FZP?")
if user_input == "y":
printf("Next oeye_out...\n")
else:
raise OMNYError("Failed to properly move in the Xray optics")
def _oeyey_mv(self, position):
#direction dependent speeds
if dev.oeyez.get().readback < position:
dev.oeyez.controller.socket_put_confirmed("axspeed[7]=15000")
else:
dev.oeyez.controller.socket_put_confirmed("axspeed[7]=10000")
umv(dev.oeyey, position)
dev.oeyez.controller.socket_put_confirmed("axspeed[7]=10000")
def oeye_out(self):
fshclose()
user_input = input("Did you move in the optics?")
if user_input == "y":
umv(dev.oeyez, -2)
self._oeyey_mv(-60.3)
# free camera
epics_put("XOMNYI-XEYE-ACQ:0", 2)
else:
raise OMNYError("The optics were not moved in. Please do so prior to eyey_out")
def oeye_cam_in(self):
if dev.oeyez.get().readback < -80:
umv(dev.oeyez, -50)
if np.fabs(dev.oeyey.get().readback+4.8) > 0.1:
_oeyey_mv -4.8
if np.fabs(dev.oeyez.get().readback+2) > 0.1 or np.fabs(dev.oeyex.get().readback) > 0.1:
umv(dev.oeyez, -2, dev.oeyex, 0)
#if still too close in z -- safety check
if np.fabs(dev.oeyez.get().readback+2) > 0.1:
raise OMNYError("The oeye is too close in z for transfer. ERROR! Aborting.\n")
def _oeye_xray_is_in() '{
if (fabs(A[oeyey]-_omny_oeye_xray_iny)<0.1 && fabs(A[oeyex]-_omny_oeye_xray_inx)<0.1)
{
return 1
}
else
{
return 0
}
}'
def oeye_xray_in '{
_otransfer_gripper_safe_xray_in_operation
if(!_oshield_is_ST_closed())
{
printf("The shield of the sample stage is not closed. Aborting.\n")
exit
}
_oeyey_mv _omny_oeye_xray_iny
if (fabs(A[oeyey]-_omny_oeye_xray_iny)>0.1)
{
printf("The oeye did not move up. Aborting.\n")
exit
}
umv oeyex _omny_oeye_xray_inx oeyez -2
#initial position for the vis light microscope
#do not open the shield when the microscope is at the vis mic position
#found eoeyx -45.13, z -84.9, y 0.64
#for a samy position of 2.8 with delta off
#the osa position should be in z around 7.4. in x it seems better
#around -0.6, where potentially xrays dont pass anymore
#
}'
def _oosa_check_y '{
if(fabs(A[oosay]-0.9)>0.05)
umv oosay 0.9
if(fabs(A[oosay]-0.9)>0.1)
{
printf("oosay is not around 0.9. Aborting.")
exit
}
}'
def _oosa_to_move_corridor '{
_oosa_check_y
set_lm oosax -3 3.7 #risk collision with shield
umv oosax -2
if(fabs(A[oosax]+2)>0.1)
{
printf("oosax did not reach target position. Not moving in z.\n")
exit
}
}'
def oosa_in '{
_omnycam_samplestage
_oosa_check_y
if(A[oshield]<15)
_oshield_ST_close
global near_field
if(near_field==0){
if (A[oosaz]<6.4)
_oosa_to_move_corridor
set_lm oosaz 6.4 6.6
umv oosaz 6.5
umv oosax 3.0270-0.005
umv oosay 0.4122
#### For the 30 nm FZP 220 um we use this part
# umv oosaz 6.5
# umv oosax 3.2453
# umv oosay 0.386015
}
if(near_field==1){
if (A[oosaz]>0)
_oosa_to_move_corridor
set_lm oosaz -0.4 -0.6
umv oosaz -0.4452
umv oosax 3.2124-0.008
if (A[osamy]<3.25)
{
umv oosay 0.5330-0.002
}
else
{
printf("\n\nFailed to move in oosa. osamy is too large.\n\n\n")
exit
}
}
_omny_interferometer_align_tracking
rt_feedback_enable
}'
def oosa_out '{
_omnycam_samplestage
_oosa_check_y
if(A[oshield]<15)
_oshield_ST_close
global near_field
if(near_field==0){
if (A[oosaz]<6.4)
_oosa_to_move_corridor
set_lm oosaz 6.4 6.6
umv oosaz 6.5
umv oosax -2
}
if(near_field==1){
if (A[oosaz]>0)
_oosa_to_move_corridor
set_lm oosaz -0.4 -0.6
umv oosaz -0.45
umv oosax -2
}
_omny_interferometer_align_tracking
}'
def oosa_move_out_of_shield '{
_omnycam_samplestage
_oosa_check_y
#if (A[oosaz]>0.1)
_oosa_to_move_corridor
if (fabs(A[osamx])>0.2)
umv osamx 0
if (A[oosaz] > 0.1)
{
set_lm oosaz -0.1 0.1
umv oosaz 0
}
}'
foptx_in = self._get_user_param_safe("foptx", "in")
fopty_in = self._get_user_param_safe("fopty", "in")
umv(dev.foptx, foptx_in)
def ffzp_info(self, mokev_val=-1):
if mokev_val == -1:
try:
mokev_val = dev.mokev.readback.get()
except:
print(
"Device mokev does not exist. You can specify the energy in keV as an argument instead."
)
return
foptz_val = dev.foptz.readback.get()
distance = -foptz_val + 43.15 + 36.7
print(f"\nThe sample is in a distance of \033[1m{distance:.1f} mm\033[0m from the FZP.\n")
print(f"At the current energy of {mokev_val:.4f} keV we have following options:\n")
diameters = [80e-6, 100e-6, 120e-6, 150e-6, 170e-6, 200e-6, 220e-6, 250e-6]
console = Console()
table = Table(title="Outermost zone width \033[1m60 nm\033[0m", box=box.SQUARE)
table.add_column("Diameter", justify="center")
table.add_column("Focal distance", justify="center")
table.add_column("Current beam size", justify="center")
wavelength = 1.2398e-9 / mokev_val
for diameter in diameters:
outermost_zonewidth = 60e-9
focal_distance = diameter * outermost_zonewidth / wavelength * 1000
beam_size = -diameter / (focal_distance * 1000) * (focal_distance - distance) * 1e9
table.add_row(
f"{diameter*1e6:.2f} microns",
f"{focal_distance:.2f} mm",
f"{beam_size:.2f} microns",
)
console.print(table)
diameters = [150e-6, 250e-6]
console = Console()
table = Table(title="Outermost zone width \033[1m30 nm\033[0m", box=box.SQUARE)
table.add_column("Diameter", justify="center")
table.add_column("Focal distance", justify="center")
table.add_column("Current beam size", justify="center")
wavelength = 1.2398e-9 / mokev_val
for diameter in diameters:
outermost_zonewidth = 30e-9
focal_distance = diameter * outermost_zonewidth / wavelength * 1000
beam_size = -diameter / (focal_distance * 1000) * (focal_distance - distance) * 1e9
table.add_row(
f"{diameter*1e6:.2f} microns",
f"{focal_distance:.2f} mm",
f"{beam_size:.2f} microns",
)
console.print(table)
fosaz_val = dev.fosaz.readback.get()
print("\nOSA Information:")
print(f" Current fosaz {fosaz_val:.1f}")
print(
f" The OSA will collide with a normal OMNY pin at fosaz \033[1m{(33-fosaz_val):.1f}\033[0m"
)
print(f" Remaining space: \033[1m{-fosaz_val+(33-foptz_val):.1f}\033[0m")
+2 -2
View File
@@ -316,7 +316,7 @@ otracky:
readOnly: false
readoutPriority: baseline
userParameter:
in: 0
start_pos: -4.3431
osamroy:
description: Sample rotation
deviceClass: csaxs_bec.devices.omny.galil.ogalil_ophyd.OMNYGalilMotor
@@ -354,7 +354,7 @@ otrackz:
readOnly: false
readoutPriority: baseline
userParameter:
in: 0
start_pos: -0.6948
oeyex:
description: Xray eye X
deviceClass: csaxs_bec.devices.omny.galil.ogalil_ophyd.OMNYGalilMotor