added parameter files and fixed a few issues
This commit is contained in:
4514
phases/UE38_all_parallel_parameters.json
Normal file
4514
phases/UE38_all_parallel_parameters.json
Normal file
File diff suppressed because it is too large
Load Diff
BIN
phases/UE38_all_parallel_parameters.xlsx
Normal file
BIN
phases/UE38_all_parallel_parameters.xlsx
Normal file
Binary file not shown.
BIN
phases/UE38_meas_and_fit_data.pickle
Normal file
BIN
phases/UE38_meas_and_fit_data.pickle
Normal file
Binary file not shown.
@ -1,7 +1,9 @@
|
|||||||
from epics import PV
|
from epics import PV
|
||||||
from slic.core.adjustable import Adjustable, PVAdjustable
|
from slic.core.adjustable import Adjustable, PVAdjustable
|
||||||
from slic.utils import json_load
|
from slic.utils import json_load
|
||||||
from model import parallel2gap
|
from slic.utils import unpickle
|
||||||
|
from models.parallel_model import parallel2gap
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
|
|
||||||
UND_PERIOD = 38.0
|
UND_PERIOD = 38.0
|
||||||
@ -37,12 +39,21 @@ class UndPhases(Adjustable):
|
|||||||
self.phases = [UndPhase(i + SUFFIX, params[i]) for i in und_names]
|
self.phases = [UndPhase(i + SUFFIX, params[i]) for i in und_names]
|
||||||
|
|
||||||
|
|
||||||
|
def get_current_value(self):
|
||||||
|
#raise NotImplementedError #TODO: how to do that?
|
||||||
|
return 123
|
||||||
|
|
||||||
|
|
||||||
def set_target_value(self, value):
|
def set_target_value(self, value):
|
||||||
tasks = [p.set_target_value(value) for p in self.phases]
|
tasks = [p.set_target_value(value) for p in self.phases]
|
||||||
for t in tasks:
|
for t in tasks:
|
||||||
t.wait()
|
t.wait()
|
||||||
|
|
||||||
|
|
||||||
|
def is_moving(self):
|
||||||
|
return any(p.is_moving() for p in self.phases)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class UndPhase(Adjustable):
|
class UndPhase(Adjustable):
|
||||||
"""
|
"""
|
||||||
@ -59,7 +70,8 @@ class UndPhase(Adjustable):
|
|||||||
|
|
||||||
|
|
||||||
def get_current_value(self):
|
def get_current_value(self):
|
||||||
raise NotImplementedError #TODO: how to do that?
|
#raise NotImplementedError #TODO: how to do that?
|
||||||
|
return 123
|
||||||
|
|
||||||
|
|
||||||
def set_target_value(self, value):
|
def set_target_value(self, value):
|
||||||
@ -86,14 +98,17 @@ class UndShiftRadialBase(PVAdjustable): #TODO: better name?
|
|||||||
|
|
||||||
def __init__(self, ID, accuracy=0.001):
|
def __init__(self, ID, accuracy=0.001):
|
||||||
super().__init__(ID + "-SET", ID + "-TL", accuracy=accuracy)
|
super().__init__(ID + "-SET", ID + "-TL", accuracy=accuracy)
|
||||||
self.pv_on = PV(ID + "-ON")
|
self.pv_on = PV(ID + "-ONOFF")
|
||||||
self.pv_go = PV(ID + "-GO")
|
self.pv_go = PV(ID + "-GO")
|
||||||
|
|
||||||
def set_target_value(self, value):
|
def set_target_value(self, value):
|
||||||
t = super().set_target_value(value)
|
t = super().set_target_value(value)
|
||||||
sleep(0.3)
|
print('wait1')
|
||||||
|
sleep(0.9)
|
||||||
|
print('wait2')
|
||||||
self.pv_on.put(1)
|
self.pv_on.put(1)
|
||||||
sleep(0.3)
|
print('wait3')
|
||||||
|
sleep(0.9)
|
||||||
self.pv_go.put(1)
|
self.pv_go.put(1)
|
||||||
t.wait()
|
t.wait()
|
||||||
|
|
||||||
@ -136,13 +151,26 @@ class UndTotalK:
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
#phase = 123
|
#phase = 123
|
||||||
phase = 90
|
phase = 95
|
||||||
check_phase(phase)
|
check_phase(phase)
|
||||||
|
|
||||||
|
alldata = unpickle('./UE38_meas_and_fit_data.pickle')
|
||||||
|
params = alldata['fitdata']
|
||||||
|
measdata = alldata['measdata']
|
||||||
|
print('\n')
|
||||||
|
print(type(params))
|
||||||
|
print(params.keys())
|
||||||
|
|
||||||
params = json_load("UE38_all_parallel_parameters.json")
|
params = json_load("UE38_all_parallel_parameters.json")
|
||||||
|
print('\n')
|
||||||
|
print(type(params))
|
||||||
|
print(params.keys())
|
||||||
|
|
||||||
ups = UndPhases("SATUN-PHASES", params)
|
ups = UndPhases("SATUN-PHASES", params)
|
||||||
ups.set_target_value(phase).wait()
|
sleep(1)
|
||||||
|
print(ups.phases[0], ups.phases[0].shift)
|
||||||
|
ups.phases[0].set_target_value(phase).wait()
|
||||||
|
print(ups.phases[0], ups.phases[0].shift)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import numpy as np
|
|||||||
from scipy.optimize import fsolve
|
from scipy.optimize import fsolve
|
||||||
|
|
||||||
|
|
||||||
def parallel2gap(K, phi, undudict):
|
def antiparallel2gap(K, phi, undudict):
|
||||||
gLH = K2gap(K, undudict['K-value_LH'])
|
gLH = K2gap(K, undudict['K-value_LH'])
|
||||||
if phi >= 0.0:
|
if phi >= 0.0:
|
||||||
gLV = K2gap(K, undudict['K-value_LV+'])
|
gLV = K2gap(K, undudict['K-value_LV+'])
|
||||||
@ -25,3 +25,22 @@ def K2gap(Kval, fitparam):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## TODO: implement them properly:
|
||||||
|
def __antiparallel2gap(K, phi, undudict):
|
||||||
|
gLH = K2gap(K, undudict['K-value_LH'])
|
||||||
|
if phi >= 0.0:
|
||||||
|
fullpol2Kfit_app()
|
||||||
|
else:
|
||||||
|
gLV = K2gap(K, undudict['K-value_LV-'])
|
||||||
|
gC = K2gap(K, undudict['K-value_C-'])
|
||||||
|
dgLV = gLV - gLH
|
||||||
|
dgC = gC - gLH - dgLV/2
|
||||||
|
return gLH + dgLV * np.sin(0.5 * phi)**2 + dgC * np.sin(phi)**2
|
||||||
|
|
||||||
|
def fullpol2Kfit_apm(shiftlist, amp1, amp2, amp3, KLH, dKLV, dK45):
|
||||||
|
return KLH + dKLV * np.sin((0.5 * shiftlist)*ratio)**2 + dK45 * np.sin(shiftlist*ratio)**2 + amp1 * np.sin(2*shiftlist*ratio) + amp2 * np.sin((2.0 * shiftlist)*ratio)**2 + amp3 * np.cos(6*shiftlist*ratio)
|
||||||
|
|
||||||
|
def fullpol2Kfit_app(shiftlist, amp1, amp2, amp3, KLH, dKLV, dK45):
|
||||||
|
return KLH + dKLV * np.sin((0.5 * shiftlist)*ratio)**2 + dK45 * np.sin(shiftlist*ratio)**2 + amp1 * np.sin(2*shiftlist*ratio) + amp2 * np.sin((2.0 * shiftlist)*ratio)**2 + amp3 * np.cos(8*shiftlist*ratio)
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user