added energy_offset as argument; shortened wait time
This commit is contained in:
5
adhoc.py
5
adhoc.py
@ -14,6 +14,7 @@ from slic.devices.xoptics.dcm import CoupledDoubleCrystalMonoEnergyWithTimeCorre
|
||||
|
||||
from undulator import Undulators
|
||||
|
||||
ENERGY_OFFSET = 13 # set the mono-undulators energy offset here!
|
||||
|
||||
|
||||
laser_pitch = SmarActAxis("SARES11-XICM125:ROX1")
|
||||
@ -79,7 +80,7 @@ class UndulatorCoupledDoubleCrystalMonoEnergy(Adjustable):
|
||||
|
||||
def __init__(self, ID, name=None, process_time=1):
|
||||
# self.und = UndulatorEnergy(process_time=process_time)
|
||||
self.und = Undulators()
|
||||
self.und = Undulators(energy_offset=ENERGY_OFFSET)
|
||||
|
||||
pvname_setvalue = "SAROP11-ARAMIS:ENERGY_SP"
|
||||
pvname_readback = "SAROP11-ARAMIS:ENERGY"
|
||||
@ -149,7 +150,7 @@ class UndulatorCoupledDoubleCrystalMonoEnergyWithTimeCorrection(Adjustable):
|
||||
|
||||
def __init__(self, ID="UCDCMEWTC", name="Alvra DCM Undulator-coupled energy with time correction", limit_low=None, limit_high=None, process_time=1):
|
||||
# self.und = UndulatorEnergy(process_time=process_time)
|
||||
self.und = Undulators()
|
||||
self.und = Undulators(energy_offset=ENERGY_OFFSET)
|
||||
|
||||
self.wait_time = 0.1
|
||||
|
||||
|
13
undulator.py
13
undulator.py
@ -14,14 +14,13 @@ N_UND_CHIC = None
|
||||
N_UNDS = list(range(3, 15+1))
|
||||
#N_UNDS.remove(N_UND_CHIC) # does not exist
|
||||
|
||||
energy_offset = 20.37839
|
||||
|
||||
class Undulators(Adjustable):
|
||||
"""
|
||||
for n_und_ref=None (default), the reference undulator currently used by the machine will be used
|
||||
"""
|
||||
|
||||
def __init__(self, n_unds=N_UNDS, n_und_ref=None, scaled=True, ID="ARAMIS_UNDULATORS", name="Aramis Undulators", units="eV"):
|
||||
def __init__(self, n_unds=N_UNDS, n_und_ref=None, scaled=True, energy_offset=0, ID="ARAMIS_UNDULATORS", name="Aramis Undulators", units="eV"):
|
||||
# # don't allow setting these since there's no chic :)
|
||||
# chic_fudge_offset = 0
|
||||
# adjust_chic = False
|
||||
@ -63,6 +62,7 @@ class Undulators(Adjustable):
|
||||
|
||||
# self.adjust_chic = adjust_chic
|
||||
self.scaled = scaled
|
||||
self.energy_offset = energy_offset
|
||||
|
||||
self.convert = ConverterEK()
|
||||
|
||||
@ -72,7 +72,7 @@ class Undulators(Adjustable):
|
||||
|
||||
|
||||
def set_target_value(self, value, hold=False):
|
||||
value = value + energy_offset
|
||||
value = value + self.energy_offset
|
||||
k = self.convert.K(value)
|
||||
if np.isnan(k):
|
||||
print("K is nan for", value)
|
||||
@ -132,7 +132,7 @@ class Undulators(Adjustable):
|
||||
# print("CHIC adjustment skipped")
|
||||
|
||||
# make sure the undulators and phases finished moving TODO: needed?
|
||||
sleep(5)
|
||||
sleep(1)
|
||||
|
||||
return self._as_task(change, hold=hold)
|
||||
|
||||
@ -141,7 +141,7 @@ class Undulators(Adjustable):
|
||||
n = self.und_name_cal
|
||||
a = self.adjs[n]
|
||||
k = a.get_current_value()
|
||||
energy = self.convert.E(k) - energy_offset
|
||||
energy = self.convert.E(k)
|
||||
|
||||
# all_ks = [a.get_current_value() for a in self.adjs.values()]
|
||||
# checks = np.isclose(all_ks, k, rtol=0, atol=0.001)
|
||||
@ -151,7 +151,8 @@ class Undulators(Adjustable):
|
||||
# if not chk:
|
||||
# print(name, k)
|
||||
|
||||
return energy # if we need to fudge the number to match the mono, do it here!
|
||||
energy = energy - self.energy_offset
|
||||
return energy
|
||||
|
||||
|
||||
def is_moving(self):
|
||||
|
Reference in New Issue
Block a user