Testing, fixing and blacking
This commit is contained in:
parent
6b2011318d
commit
0bffecc201
@ -179,10 +179,15 @@ class MonoTheta2(VirtualEpicsSignalRO):
|
||||
)
|
||||
return theta2
|
||||
|
||||
MONO_THETA2_OFFSETS_FILENAME = "/import/work/sls/spec/local/X12SA/macros/spec_data/mono_th2_offsets.txt"
|
||||
|
||||
MONO_THETA2_OFFSETS_FILENAME = (
|
||||
"/import/work/sls/spec/local/X12SA/macros/spec_data/mono_th2_offsets.txt"
|
||||
)
|
||||
|
||||
|
||||
class EnergyKev(VirtualEpicsSignalRO):
|
||||
"""Converts the pusher motor position to energy in keV"""
|
||||
|
||||
_mono_add_offs = True
|
||||
_mono_a3_enc_offs2 = -19.7072
|
||||
_mono_a2_pusher_offs2 = 5.93905
|
||||
@ -199,15 +204,17 @@ class EnergyKev(VirtualEpicsSignalRO):
|
||||
if self._th2_offsets is None:
|
||||
return 0.0
|
||||
|
||||
max_offs = 0.2
|
||||
if np.max(self._th2_offsets) > max_offs:
|
||||
raise ValueError(f"\nThe empirical moth2 corrections are as high as {max_offs} deg\nThis is unreasonable and the corrections will not be used.\n\n***PLEASE INFORM BEAMLINE SCIENTISTS***\n")
|
||||
max_offs = np.max(self._th2_offsets[:, 1])
|
||||
|
||||
if max_offs > 0.2:
|
||||
raise ValueError(
|
||||
f"\nThe empirical moth2 corrections are as high as {max_offs} deg\nThis is unreasonable and the corrections will not be used.\n\n***PLEASE INFORM BEAMLINE SCIENTISTS***\n"
|
||||
)
|
||||
|
||||
offs = np.interp(energy_keV, self._th2_offsets[:, 0], self._th2_offsets[:, 1])
|
||||
print(offs)
|
||||
return offs
|
||||
|
||||
|
||||
def calc(self, val):
|
||||
_mono_sintheta2_to_Ekev = -self._mono_hce / self._mono_2d2
|
||||
asin_arg = (val - self._mono_a2_pusher_offs2) / self._mono_a1_lever_length2
|
||||
@ -217,7 +224,7 @@ class EnergyKev(VirtualEpicsSignalRO):
|
||||
E_keV = _mono_sintheta2_to_Ekev / sin(theta2_deg / 180.0 * 3.141592)
|
||||
|
||||
if self._mono_add_offs:
|
||||
theta2_deg -= _mono_get_th2_offs(E_keV)
|
||||
theta2_deg -= self._mono_get_th2_offs(E_keV)
|
||||
E_keV = _mono_sintheta2_to_Ekev / sin(theta2_deg / 180.0 * 3.141592)
|
||||
return E_keV
|
||||
|
||||
@ -270,7 +277,7 @@ class Bpm4i(Device):
|
||||
read_attrs=None,
|
||||
configuration_attrs=None,
|
||||
parent=None,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
):
|
||||
super().__init__(
|
||||
prefix,
|
||||
@ -279,7 +286,7 @@ class Bpm4i(Device):
|
||||
read_attrs=read_attrs,
|
||||
configuration_attrs=configuration_attrs,
|
||||
parent=parent,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
)
|
||||
self.sum.name = self.name
|
||||
# Ensure the scaler counts automatically
|
||||
|
Loading…
x
Reference in New Issue
Block a user