diff --git a/pxii_bec/macros/pxii_parameters.py b/pxii_bec/macros/pxii_parameters.py index 5555b01..e92d01b 100755 --- a/pxii_bec/macros/pxii_parameters.py +++ b/pxii_bec/macros/pxii_parameters.py @@ -4,6 +4,7 @@ from dataclasses import dataclass import numpy as np from enum import Enum + @dataclass(frozen=True) class EnergyDefaults: """Parameters for PXII energy changes""" @@ -28,12 +29,9 @@ class EnergyDefaults: @dataclass(frozen=True) class Calibration: """Calibration parameters for PXII optics""" - pitch_calib = [-7.60082220e-19, - 6.09893342e-14, - -1.81702221e-09, - 2.45457520e-05, - -5.61275367e+00] - + + pitch_calib = [-7.60082220e-19, 6.09893342e-14, -1.81702221e-09, 2.45457520e-05, -5.61275367e00] + # roll = np.array([2.28291039e-03, -2.41928101e01]) @@ -130,9 +128,7 @@ class Gap: harmonic = cls.get_harmonic_by_energy(energy_ev) if harmonic is None: - raise ValueError( - f"{energy_ev:.0f} eV is below the minimum calibrated energy." - ) + raise ValueError(f"{energy_ev:.0f} eV is below the minimum calibrated energy.") slope, intercept = cls.harmonics[harmonic] @@ -147,8 +143,6 @@ class Gap: ) return harmonic, gap - - @dataclass(frozen=True) @@ -180,17 +174,17 @@ class CamConversion: a = 0.5208 b = 0.002586 + # @dataclass(frozen=True) class BPM_X_Calibration: - coeffs = (0.11079256, -0.02493623, -0.00799871, -0.00482772, 0.16569134, 0.44192518) + 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 + centred_position = -0.009 # updated on 31st Aug26 crosshair_signal = 0.000731 crosshair_bpm_position = 0.444 - # @dataclass(frozen=True) class BPM_Y_Calibration: coeffs = (-0.14645507, 0.010016, 0.08258468, -0.00547233, -0.02715706, -1.54419084) @@ -199,10 +193,17 @@ class BPM_Y_Calibration: crosshair_signal = -0.01383 crosshair_bpm_position = -1.540 + # @dataclass(frozen=True) class Beamstop: x_offset = -0.55 + i2_limit = 5e-8 +@dataclass(frozen=True) +class Cameras: + sample = "X10SA-ES-MS" + ss_xray_eye = "X10SA-ES-SSCAM" + det_xray_eye = "X10SA-ES-XEYE" class CameraZoom(Enum): X1 = ("1x", 1) @@ -213,7 +214,7 @@ class CameraZoom(Enum): X12_5 = ("12.5x", 1000) def __init__(self, label, position): - self.label= label + self.label = label self.position = position @classmethod @@ -222,9 +223,7 @@ class CameraZoom(Enum): for zoom in cls: if abs(position - zoom.position) <= tolerance: return zoom - raise ValueError( - f"No camera zoom levle found near motor position {position}" - ) + raise ValueError(f"No camera zoom level found near motor position {position}") @classmethod def from_label(cls, label): @@ -234,10 +233,12 @@ class CameraZoom(Enum): return zoom raise ValueError(f"Unknown camera zoom: {label}") + 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) @@ -246,10 +247,7 @@ class BeamMove: scint_target_y = 969 scint_x_slope = -19450 scint_y_slope = -37800 - scint_tolerance = 15 - - - - + scint_tolerance = 7 + min_scint_signal = 100