Files
x11ma/script/beamline_alignment/BML_save_parameters.py
gac-x11ma 8ecd1f36c6 Startup
2025-11-19 10:59:01 +01:00

220 lines
7.4 KiB
Python
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# VERSION = "1.0"
# AUTHOR = "A. Kleibert"
# LAST_MODIFIED = "2025-11-08"
# Read ring current:
SR_current = caget("AGEBD-PARAMS:CURRENT")
SR_life_time = caget("AGEBD-PARAMS:LIFETIME")
SR_orbit-X-RMS = caget("ARSGE-CECL-FOFB1:B-ERR-X-RMS-UM")
SR_orbit-Y-RMS = caget("ARSGE-CECL-FOFB1:B-ERR-Y-RMS-UM")
# Read bumps:
BML_bump_X = caget("X11MA-ORBITBUMP:OFFSET-X")
BML_bump_XP = caget("X11MA-ORBITBUMP:OFFSET-XP")
BML_bump_Y = caget("X11MA-ORBITBUMP:OFFSET-Y")
BML_bump_YP = caget("X11MA-ORBITBUMP:OFFSET-YP")
MAS_bump_X = caget("AGEBD-ORBITBUMP:X11MA-OFFSET-X")
MAS_bump_XP = caget("AGEBD-ORBITBUMP:X11MA-OFFSET-XP")
MAS_bump_Y = caget("AGEBD-ORBITBUMP:X11MA-OFFSET-Y")
MAS_bump_YP = caget("AGEBD-ORBITBUMP:X11MA-OFFSET-YP")
TOT_bump_X = caget("AGEBD-ORBITBUMP:X11MA-OFFSET-X-TOTAL")
TOT_bump_XP = caget("AGEBD-ORBITBUMP:X11MA-OFFSET-XP-TOTAL")
TOT_bump_Y = caget("AGEBD-ORBITBUMP:X11MA-OFFSET-Y-TOTAL")
TOT_bump_YP = caget("AGEBD-ORBITBUMP:X11MA-OFFSET-YP-TOTAL")
# Read ID gap and mode:
ID2_energy= caget("X11MA-UIND2:ENERGY-RBV")
ID2_mode = caget("X11MA-UIND2:MODE")
ID2_gap = caget("X11MA-UIND2:GAP-RBV")
ID2_offset = caget("X11MA-UIND2:ENERGY-OFFS")
# 0 Off
# 1 Linear H
# 2 Linear V+
# 3 Linear V-
# 4 Circular+
# 5 Circular-
# 6 +45 deg
# 7 -45 deg
# Read XBPM1 parameters:
XBPM1_X_motor = caget("X11MA-FE-XBPM1:TRX.RBV")
XBPM1_Y_motor = caget("X11MA-FE-XBPM1:TRY.RBV")
# Read FE slit size and position:
# Virtual axes:
FE_centerX = caget("X11MA-FE-SL1:CENTERX.RBV")
FE_centerY = caget("X11MA-FE-SL1:CENTERY.RBV")
FE_sizeX = caget("X11MA-FE-SL1:SIZEX.RBV")
FE_sizeY = caget("X11MA-FE-SL1:SIZEY.RBV")
# Physical motors:
FE_TRXR = caget("X11MA-FE-SL1:TRXR.RBV")
FE_TRXW = caget("X11MA-FE-SL1:TRXW.RBV")
FE_TRYB = caget("X11MA-FE-SL1:TRYB.RBV")
FE_TRYT = caget("X11MA-FE-SL1:TRYT.RBV")
# Read CMU parameters:
CMU_X = caget("X11MA-OP-CM:ox")
CMU_Y = caget("X11MA-OP-CM:oy")
CMU_Z = caget("X11MA-OP-CM:oz")
CMU_Rx = caget("X11MA-OP-CM:oRx")
CMU_Ry = caget("X11MA-OP-CM:oRy")
CMU_Rz = caget("X11MA-OP-CM:oRz")
CMU_baffle = caget("X11MA-OP2-CM:TRB.RBV")
# Read XBPM2 parameters:
XBPM2_X_motor = caget("X11MA-OP2-BP1:TRX.RBV")
XBPM2_Y_motor = caget("X11MA-OP2-BP1:TRY.RBV")
# Read AU slit parameters:
# Virtual axes:
AU_centerV = caget("X11MA-OP2-AVcenter")
AU_centerH = caget("X11MA-OP2-AHcenter")
AU_sizeV = caget("X11MA-OP2-AVsize")
AU_sizeH = caget("X11MA-OP2-AHsize")
# Physical motors:
AU_TRZ1 = caget("X11MA-OP2-AU:TRZ1.RBV")
AU_TRZ4 = caget("X11MA-OP2-AU:TRZ4.RBV")
AU_TRY1 = caget("X11MA-OP2-AU:TRY1.RBV")
AU_TRY4 = caget("X11MA-OP2-AU:TRY4.RBV")
# Read mono parameters:
# Grating and diffration order:
Mono_grating_select = caget("X11MA-PGM:grating")
Mono_grating_change = caget("X11MA-PGM-GRCH:GRATING")
# 0 G1 300
# 1 G2 1200
# 2 G3 600
Mono_diff_order = caget("X11MA-PGM:difforder0")
# 0 1
# 1 2
# 2 3
# Energy, cff, phi:
Mono_energy = caget("X11MA-PGM:rbkenergy")
Mono_cff = caget("X11MA-PGM:rbkcff")
Mono_phi = caget("X11MA-PGM:rbkenergy")
# Angles and offsets:
Mono_theta = caget("X11MA-PGM:rbktheta")
Mono_theta_off1A = caget("X11MA-PGM:THETAOFF1.A")
Mono_theta_off1B = caget("X11MA-PGM:THETAOFF1.B")
Mono_theta_off1C = caget("X11MA-PGM:THETAOFF1.C")
Mono_theta_off2A = caget("X11MA-PGM:THETAOFF2.A")
Mono_theta_off2B = caget("X11MA-PGM:THETAOFF2.B")
Mono_theta_off2C = caget("X11MA-PGM:THETAOFF2.C")
Mono_beta = caget("X11MA-PGM:rbkbeta")
Mono_beta_off1A = caget("X11MA-PGM:BETAOFF1.A")
Mono_beta_off1B = caget("X11MA-PGM:BETAOFF1.B")
Mono_beta_off1C = caget("X11MA-PGM:BETAOFF1.C")
Mono_beta_off2A = caget("X11MA-PGM:BETAOFF2.A")
Mono_beta_off2B = caget("X11MA-PGM:BETAOFF2.B")
Mono_beta_off2C = caget("X11MA-PGM:BETAOFF2.C")
# Mirror and grating position:
Mono_mirror_origin = caget("X11MA:m3.RBV")
Mono_grating_origin = caget("X11MA:m4.RBV")
# Read FMU aperture jaw:
FMU_TRYT = caget("X11MA-OP-FM:TRYT.RBV")
FMU_TRYB = caget("X11MA-OP-FM:TRYB.RBV")
# Read FMU position and motors:
# Virtual axes:
FMU_X = caget("X11MA-OP-FM:X.RBV")
FMU_Y = caget("X11MA-OP-FM:Y.RBV")
FMU_PITCH = caget("X11MA-OP-FM:PITCH.RBV")
FMU_ROLL = caget("X11MA-OP-FM:ROLL.RBV")
FMU_YAW = caget("X11MA-OP-FM:YAW.RBV")
# Physical motors:
FMU_TRYD = caget("X11MA-OP-FM:TRYD.RBV")
FMU_TRYUR = caget("X11MA-OP-FM:TRYUR.RBV")
FMU_TRYUW = caget("X11MA-OP-FM:TRYUW.RBV")
FMU_TRX = caget("X11MA-OP-FM:TRX.RBV")
FMU_ROTY = caget("X11MA-OP-FM:ROTY.RBV")
# Fast shutter positions:
#FMU_TRYD = caget("X11MA-OP-FM:TRYD.RBV")
#FMU_TRYUR = caget("X11MA-OP-FM:TRYUR.RBV")
# Exit slit
# Monitor and membrane positions:
#FMU_TRYD = caget("X11MA-OP-FM:TRYD.RBV")
#FMU_TRYUR = caget("X11MA-OP-FM:TRYUR.RBV")
ESLIT_width = caget("X11MA-OP2-SL:TRY.RBV")
ESLIT_position = caget("X11MA-OP2-SL:TRX.RBV")
# Diagnostics unit
DIAG_position = caget("X11MA-OP-DI:HO3.RBV")
DIAG_select = caget("X11MA:DIAG-SET")
# 0 Diag. Out
# 1 YAG
# 2 Photodiode
# Refocussing mirror unit 1
# Virtual axes:
RMU1_X = caget("X11MA-OP-RM1:X.RBV")
RMU1_Y = caget("X11MA-OP-RM1:Y.RBV")
RMU1_PITCH = caget("X11MA-OP-RM1:PITCH.RBV")
RMU1_ROLL = caget("X11MA-OP-RM1:ROLL.RBV")
RMU1_YAW = caget("X11MA-OP-RM1:YAW.RBV")
# Physical motors:
RMU1_TRYD = caget("X11MA-OP-RM1:TRYD.RBV")
RMU1_TRYUR = caget("X11MA-OP-RM1:TRYUR.RBV")
RMU1_TRYUW = caget("X11MA-OP-RM1:TRYUW.RBV")
RMU1_TRX = caget("X11MA-OP-RM1:TRX.RBV")
RMU1_ROTY = caget("X11MA-OP-RM1:ROTY.RBV")
# PEEM Girder
# Virtual axes:
PEEM_girder_X = caget("X11MA-HG:X1")
PEEM_girder_Y = caget("X11MA-HG:Y1")
PEEM_girder_Z = caget("X11MA-HG:Z1")
PEEM_girder_PITCH = caget("X11MA-HG:PITCH1")
PEEM_girder_ROLL = caget("X11MA-HG:YAW1")
PEEM_girder_YAW = caget("X11MA-HG:ROLL1")
# Physical motors:
PEEM_girder_M1 = caget("X11MA-HG:M1.RBV")
PEEM_girder_M2 = caget("X11MA-HG:M2.RBV")
PEEM_girder_M3 = caget("X11MA-HG:M3.RBV")
PEEM_girder_M4 = caget("X11MA-HG:M4.RBV")
PEEM_girder_M5 = caget("X11MA-HG:M5.RBV")
PEEM_girder_M6 = caget("X11MA-HG:M6.RBV")
# Ptycho double slit
# Virtual axes:
PDS_centerX = caget("X11MA-OP-SL:CENTERX.RBV")
PDS_centerY = caget("X11MA-OP-SL:CENTERY.RBV")
PDS_sizeX = caget("X11MA-OP-SL:SIZEX.RBV")
PDS_sizeY = caget("X11MA-OP-SL:SIZEY.RBV")
# Physical motors:
PDS_TRXR = caget("X11MA-OP-SL:TRXR.RBV")
PDS_TRXW = caget("X11MA-OP-SL:TRXW.RBV")
PDS_TRYB = caget("X11MA-OP-SL:TRYB.RBV")
PDS_TRYT = caget("X11MA-OP-SL:TRYT.RBV")
# Refocussing mirror unit 2
RMU2_X = caget("X11MA-OP-RM2:ox")
RMU2_Y = caget("X11MA-OP-RM2:oy")
RMU2_Z = caget("X11MA-OP-RM2:oz")
RMU2_Rx = caget("X11MA-OP-RM2:oRx")
RMU2_Ry = caget("X11MA-OP-RM2:oRy")
RMU2_Rz = caget("X11MA-OP-RM2:oRz")
##get_string
# get_string(msg, default = None, alternatives = None, password = False)
# Reads a string from UI Args: msg(str): display message.
# default(str, optional): value displayed when window is shown.
# alternatives(list of str, optional): if provided presents a combo
# box instead of an editing field.
# password(boolean, optional): if True hides entered characters.
# Returns: String entered of null if canceled
# save_dataset(path, data, type = d, unsigned = False, features = None)
# Save data into a dataset within the current persistence context.
# Args: path(str): Path to dataset relative to the current persistence context root.
# type(str, optional): array type - 'd'=double (default), 'b'=byte, 'h'=short, 'i'=int,
# 'l'=long, 'f'=float, 'c'=char, 's'=String, 'z'=bool, 'o'=Object
# data (array or list): data to be saved
# unsigned(boolean, optional): create a dataset of unsigned type.
# features(dictionary, optional): See create_dataset.
# Returns: Dictionary