Files
sfop/phases/models/antiparallel_model.py

56 lines
2.2 KiB
Python

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)