a few bug fixes with tasks, switching to anti-parallel model
This commit is contained in:
9890
phases/UE38_all_parameters.json
Normal file
9890
phases/UE38_all_parameters.json
Normal file
File diff suppressed because it is too large
Load Diff
BIN
phases/UE38_all_parameters.xlsx
Normal file
BIN
phases/UE38_all_parameters.xlsx
Normal file
Binary file not shown.
Binary file not shown.
@ -5,6 +5,7 @@ from slic.core.task import Task
|
||||
from slic.utils import json_load
|
||||
from slic.utils import unpickle
|
||||
from models.parallel_model import parallel2gap
|
||||
from models.antiparallel_model import antiparallel2gap
|
||||
from time import sleep
|
||||
|
||||
|
||||
@ -81,7 +82,8 @@ class UndPhase(Adjustable):
|
||||
shift = convert_phase_to_shift(phase)
|
||||
|
||||
k = self.totalk.get()
|
||||
radial = parallel2gap(k, phase, self.params)
|
||||
#radial = parallel2gap(k, phase, self.params)
|
||||
radial = antiparallel2gap(k, phase, self.params)
|
||||
radial = round(radial, 4) #TODO: why?
|
||||
|
||||
self.shift.set_target_value(shift).wait()
|
||||
@ -214,6 +216,28 @@ if __name__ == "__main__":
|
||||
phase = 95
|
||||
check_phase(phase)
|
||||
|
||||
und_first = 10
|
||||
und_last = 22
|
||||
und_range = [*range(und_first, und_last+1, 1)]
|
||||
if 14 in und_range:
|
||||
und_range.remove(14)
|
||||
basename1 = 'SATUN'
|
||||
undus = [basename1 + str(i).zfill(2) for i in und_range]
|
||||
print(undus)
|
||||
|
||||
# old Excel parameter file with only legacy fixed polarization parameters
|
||||
params1 = json_load("UE38_all_parallel_parameters.json")
|
||||
print('\n')
|
||||
print(type(params1))
|
||||
print(params1.keys())
|
||||
|
||||
# Excel parameter file with only fixed polarization parameters
|
||||
params2 = json_load("UE38_all_parameters.json")
|
||||
print('\n')
|
||||
print(type(params2))
|
||||
print(params2.keys())
|
||||
|
||||
# Pickle parameter file with fixed and full polarization parameters
|
||||
alldata = unpickle('./UE38_meas_and_fit_data.pickle')
|
||||
params = alldata['fitdata']
|
||||
measdata = alldata['measdata']
|
||||
@ -221,16 +245,11 @@ if __name__ == "__main__":
|
||||
print(type(params))
|
||||
print(params.keys())
|
||||
|
||||
params = json_load("UE38_all_parallel_parameters.json")
|
||||
print('\n')
|
||||
print(type(params))
|
||||
print(params.keys())
|
||||
|
||||
ups = UndPhases("SATUN-PHASES", params)
|
||||
sleep(1)
|
||||
sleep(0.3)
|
||||
print(ups.phases[0], ups.phases[0].shift)
|
||||
# ups.phases[0].set_target_value(phase).wait()
|
||||
# print(ups.phases[0], ups.phases[0].shift)
|
||||
#ups.phases[0].set_target_value(phase).wait()
|
||||
#print(ups.phases[0], ups.phases[0].shift)
|
||||
|
||||
|
||||
|
||||
|
@ -1,46 +0,0 @@
|
||||
import numpy as np
|
||||
from scipy.optimize import fsolve
|
||||
|
||||
|
||||
def antiparallel2gap(K, phi, undudict):
|
||||
gLH = K2gap(K, undudict['K-value_LH'])
|
||||
if phi >= 0.0:
|
||||
gLV = K2gap(K, undudict['K-value_LV+'])
|
||||
gC = K2gap(K, undudict['K-value_C+'])
|
||||
dgLV = gLV - gLH
|
||||
dgC = gC - gLH - dgLV/2
|
||||
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 K2gap(Kval, fitparam):
|
||||
g2K_func = np.poly1d(fitparam[::-1])
|
||||
tau_init = 1.0
|
||||
k_log = float(np.log(Kval))
|
||||
return float(fsolve(k_log - g2K_func, tau_init))
|
||||
|
||||
|
||||
|
||||
## 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)
|
||||
|
||||
|
55
phases/models/antiparallel_model.py
Normal file
55
phases/models/antiparallel_model.py
Normal file
@ -0,0 +1,55 @@
|
||||
import numpy as np
|
||||
from scipy.optimize import fsolve
|
||||
|
||||
|
||||
def antiparallel2gap(K, phi, undudict):
|
||||
gLH = K2gap(K, undudict['K-value_LH'])
|
||||
if phi >= 0.0:
|
||||
gLV = K2gap(K, undudict['K-value_apLV+'])
|
||||
gC = K2gap(K, undudict['K-value_45+'])
|
||||
dgLV = gLV - gLH
|
||||
dgC = gC - gLH - dgLV/2
|
||||
else:
|
||||
gLV = K2gap(K, undudict['K-value_apLV-'])
|
||||
gC = K2gap(K, undudict['K-value_45-'])
|
||||
dgLV = gLV - gLH
|
||||
dgC = gC - gLH - dgLV/2
|
||||
return gLH + dgLV * np.sin(0.5 * phi)**2 + dgC * np.sin(phi)**2
|
||||
|
||||
|
||||
def K2gap(Kval, fitparam):
|
||||
g2K_func = np.poly1d(fitparam[::-1])
|
||||
tau_init = 1.0
|
||||
k_log = float(np.log(Kval))
|
||||
return float(fsolve(k_log - g2K_func, tau_init))
|
||||
|
||||
|
||||
|
||||
## TODO: implement the proper model:
|
||||
#def __antiparallel2gap(K, phi, undudict):
|
||||
# if phi >= 0.0:
|
||||
# fullpol2Kfit_app()
|
||||
# else:
|
||||
# return gLH + dgLV * np.sin(0.5 * phi)**2 + dgC * np.sin(phi)**2
|
||||
#
|
||||
#def fullpol2Kfit_apm(shiftlist, amp1, amp2, amp3, KLH, dKLV, dK45):
|
||||
# gLH = K2gap(K, undudict['K-value_LH'])
|
||||
# gLV = K2gap(K, undudict['K-value_LV-'])
|
||||
# gC = K2gap(K, undudict['K-value_C-'])
|
||||
# dgLV = gLV - gLH
|
||||
# dgC = gC - gLH - dgLV/2
|
||||
# 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):
|
||||
# gLH = K2gap(K, undudict['K-value_LH'])
|
||||
# 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
|
||||
#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