calibrated SS and LU BPMS and modified output of BCU BPM
This commit is contained in:
1 parent
199857fe94
commit
0e8bd2c351
2 files changed
+88
-36
No files matched your search
@@ -6,7 +6,7 @@ import time
|
||||
import numpy as np
|
||||
|
||||
|
||||
def compute_norm(n_readings=5):
|
||||
def compute_norm_bcu(n_readings=5):
|
||||
"""Average normalized BPM X/Y from repeated sets of four channels."""
|
||||
|
||||
xn_values = []
|
||||
@@ -31,20 +31,36 @@ def compute_norm(n_readings=5):
|
||||
|
||||
time.sleep(0.1)
|
||||
|
||||
return float(np.mean(xn_values)), float(np.mean(yn_values))
|
||||
return {
|
||||
"bcu_Xnorm": float(np.mean(xn_values)),
|
||||
"bcu_Ynorm": float(np.mean(yn_values)),
|
||||
}
|
||||
|
||||
|
||||
def get_bcu_beampos():
|
||||
"""Determine beam position"""
|
||||
bpm_xn, bpm_yn = compute_norm()
|
||||
"""Determine beam position from BCU BPM"""
|
||||
# Check that there is a reading first
|
||||
if get_value(dev.bcu_bpmsum) < 1:
|
||||
return {
|
||||
"ok": False,
|
||||
"message": "Reading too low on BCU BPM"
|
||||
}
|
||||
|
||||
result = compute_norm_bcu()
|
||||
bpm_x = dev.bcu_bpm_x.position
|
||||
bpm_y = dev.bcu_bpm_y.position
|
||||
|
||||
beam_x = beam_offset_um(bpm_xn, bpm_x, BPM_X_Calibration)
|
||||
beam_x = beam_offset_um(result["bcu_Xnorm"], bpm_x, BCU_BPM_X_Calibration)
|
||||
|
||||
beam_y = beam_offset_um(bpm_yn, bpm_y, BPM_Y_Calibration)
|
||||
beam_y = beam_offset_um(result["bcu_Ynorm"], bpm_y, BCU_BPM_Y_Calibration)
|
||||
|
||||
return beam_x, beam_y
|
||||
return {
|
||||
"ok": True,
|
||||
"bcu_Xnorm": result["bcu_Xnorm"],
|
||||
"bcu_Ynorm": result["bcu_Ynorm"],
|
||||
"bcu_x_um": beam_x,
|
||||
"bcu_y_um": beam_y,
|
||||
}
|
||||
|
||||
|
||||
def beam_offset_um(bpm_signal, bpm_motor_position, calibration):
|
||||
|
||||
@@ -20,7 +20,7 @@ class EnergyDefaults:
|
||||
mono_fpitch = dev.dcm_fpitch
|
||||
mono_perp = dev.dcm_perp
|
||||
mono_roll = dev.dcm_froll
|
||||
mono_roll_value = 4.75
|
||||
mono_roll_value = 4.36
|
||||
LUT_table = "luts/energy_lut.csv"
|
||||
stripe_thresholds = {"silicon": 9000, "rhodium": 20000, "platinum": 40000}
|
||||
pitch_scan = {"halfwidth": 0.075, "steps": 20}
|
||||
@@ -35,10 +35,6 @@ class Calibration:
|
||||
# roll = np.array([2.28291039e-03, -2.41928101e01])
|
||||
|
||||
|
||||
from dataclasses import dataclass
|
||||
import numpy as np
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Gap:
|
||||
"""Fit parameters to calculate undulator gap from energy."""
|
||||
@@ -47,18 +43,6 @@ class Gap:
|
||||
maximum_gap = 20.0
|
||||
correction_factor = 0.9994
|
||||
|
||||
# harmonics = {
|
||||
# "H3": np.array([9.57400000e-04, 1.62100000e-01]),
|
||||
# "H5": np.array([5.03757576e-04, 8.53992727e-01]),
|
||||
# "H7": np.array([3.57624242e-04, 8.74460000e-01]),
|
||||
# "H9": np.array([2.76218182e-04, 9.00565455e-01]),
|
||||
# "H11": np.array([2.25662626e-04, 9.04630909e-01]),
|
||||
# "H13": np.array([1.89440404e-04, 9.35049697e-01]),
|
||||
# "H15": np.array([1.64179798e-04, 9.35255758e-01]),
|
||||
# "H17": np.array([1.44460317e-04, 9.47441667e-01]),
|
||||
# "H19": np.array([1.26071429e-04, 1.04085357e00]),
|
||||
# }
|
||||
|
||||
harmonics = {
|
||||
"H3": np.array([9.37600000e-04, 2.98800000e-01]),
|
||||
"H5": np.array([5.10102857e-04, 7.99666667e-01]),
|
||||
@@ -169,31 +153,59 @@ class Harmonics:
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class CamConversion:
|
||||
"""Convert pixels to microns for sam cam"""
|
||||
"""Convert pixels to microns for sample camera"""
|
||||
|
||||
a = 0.5208
|
||||
b = 0.002586
|
||||
|
||||
|
||||
# @dataclass(frozen=True)
|
||||
class BPM_X_Calibration:
|
||||
class BCU_BPM_X_Calibration:
|
||||
coeffs = (0.11079256, -0.02493623, -0.00799871, -0.00482772, 0.16569134, 0.44192518)
|
||||
signal_limit = 0.90
|
||||
# centred_position = 0.441
|
||||
centred_position = -0.009 # updated on 31st Aug26
|
||||
crosshair_signal = 0.000731
|
||||
crosshair_bpm_position = 0.444
|
||||
centred_position = -0.009 # where the bpm was during calibration
|
||||
crosshair_signal = -0.00339158
|
||||
crosshair_bpm_position = 0.0532
|
||||
|
||||
|
||||
# @dataclass(frozen=True)
|
||||
class BPM_Y_Calibration:
|
||||
class BCU_BPM_Y_Calibration:
|
||||
coeffs = (-0.14645507, 0.010016, 0.08258468, -0.00547233, -0.02715706, -1.54419084)
|
||||
signal_limit = 0.95
|
||||
centred_position = -1.540
|
||||
crosshair_signal = -0.01383
|
||||
crosshair_bpm_position = -1.540
|
||||
centred_position = -1.540 # where the bpm was during calibration
|
||||
crosshair_signal = -0.00392027
|
||||
crosshair_bpm_position = -1.548
|
||||
|
||||
|
||||
# @dataclass(frozen=True)
|
||||
class SS_BPM_X_Calibration:
|
||||
coeffs = (4.04882, -10.9093)
|
||||
signal_limit = 0.90
|
||||
centred_position = 2.8625 # updated on 26th Sep26
|
||||
|
||||
|
||||
# @dataclass(frozen=True)
|
||||
class SS_BPM_Y_Calibration:
|
||||
coeffs = (-23.8286, -32.7051)
|
||||
signal_limit = 0.90
|
||||
centred_position = -1.3876
|
||||
# @dataclass(frozen=True)
|
||||
|
||||
|
||||
class LU_BPM_X_Calibration:
|
||||
coeffs = (4.42860, -9.63986)
|
||||
signal_limit = 0.90
|
||||
# centred_position = 0.441
|
||||
centred_position = 2.1816 # updated on 26th Sep26
|
||||
|
||||
|
||||
# @dataclass(frozen=True)
|
||||
class LU_BPM_Y_Calibration:
|
||||
coeffs = (-27.6544, 83.2683)
|
||||
signal_limit = 0.8
|
||||
centred_position = 3.0175
|
||||
|
||||
# @dataclass(frozen=True)
|
||||
class Beamstop:
|
||||
x_offset = -0.55
|
||||
@@ -233,21 +245,45 @@ class CameraZoom(Enum):
|
||||
return zoom
|
||||
raise ValueError(f"Unknown camera zoom: {label}")
|
||||
|
||||
|
||||
# @dataclass(frozen=True)
|
||||
class PreChecks:
|
||||
mode_pv = "AGEOP-BL:STATUS-X10SA"
|
||||
fe_shutter_pv = "X10SA-FE-PSH1-EMLS-0010:OPEN"
|
||||
hutch_shutter_pv = "X10SA-OP-PSH1-EMLS:STATE"
|
||||
|
||||
|
||||
# @dataclass(frozen=True)
|
||||
class EHChecks:
|
||||
cryo_pv = "X10SA-ES-CS:TEMP_RBV"
|
||||
ss_xi_pv = "X10SA-ES-SSXI:POS-SET"
|
||||
ss_mot = dev.ss_xi_x
|
||||
|
||||
|
||||
# @dataclass(frozen=True)
|
||||
class BeamMove:
|
||||
"""Values used for moving beam to the crosshair using
|
||||
the VFM DR motor and the HFM XD motors. Slope values apply to 12.5X
|
||||
zoom when the scintillator is used for measurments"""
|
||||
|
||||
# scint_x_coeffs = (-12409,24759)
|
||||
# scint_y_coeffs = (-37600,-18517)
|
||||
# bcu_x_coeffs = (2519.3,-5184.1)
|
||||
# bcu_y_coeffs = (1324.4,1108.7)
|
||||
zoom = CameraZoom.X12_5.position
|
||||
vfm_mot = dev.vfm_ydr
|
||||
hfm_mot = dev.hfm_xd
|
||||
max_move = 0.02
|
||||
scint_target_x = 993
|
||||
scint_target_y = 969
|
||||
scint_x_slope = -19450
|
||||
scint_y_slope = -37800
|
||||
scint_tolerance = 7
|
||||
min_scint_signal = 100
|
||||
scint_target_flux = 8e11
|
||||
|
||||
|
||||
# @dataclass(frozen=True)
|
||||
class BLSetup:
|
||||
"""Values used for the weekly setup script"""
|
||||
energy = 12400
|
||||
fe_xsize = 0.6
|
||||
fe_ysize = 0.6
|
||||
detector_height = 0
|
||||
Reference in new issue
Block a user