From 4215321d996224b37ad312ffbb07cb49d4665fe8 Mon Sep 17 00:00:00 2001 From: markgarnold <78613198+markgarnold@users.noreply.github.com> Date: Thu, 5 Dec 2024 09:26:09 -0500 Subject: [PATCH] Update interp_cotran_ufunc.py --- src/xlnsconf/interp_cotran_ufunc.py | 265 ++++++++++++++++++++++++++++ 1 file changed, 265 insertions(+) diff --git a/src/xlnsconf/interp_cotran_ufunc.py b/src/xlnsconf/interp_cotran_ufunc.py index 63e49f7..d962d3b 100644 --- a/src/xlnsconf/interp_cotran_ufunc.py +++ b/src/xlnsconf/interp_cotran_ufunc.py @@ -3,6 +3,7 @@ import math def sbdb_ufunc_interpsb(z,s,B=None,F=None): + """interpolate sb with no guards, ideal db""" if B == None: B = xl.xlnsB if F == None: @@ -30,6 +31,7 @@ def sbdb_ufunc_interpsb(z,s,B=None,F=None): return np.where(s,xl.sbdb_ufunc_ideal(z,s,B=B,F=F), 2*res) def sbdb_ufunc_cotrdb(z,s,B=None,F=None): + """ideal sb, flawed implementation of cotran db (doesn't handle special cases)""" if B == None: B = xl.xlnsB if F == None: @@ -76,6 +78,7 @@ def sbdb_ufunc_cotrdb(z,s,B=None,F=None): #(-2.07022694591547e-05, 3.140714511480401e-05, -0.0009458313366082998, 4.1009107609236585e-05) interp sb+cotran db def sbdb_ufunc_interpsbcotrdb(z,s,B=None,F=None): + """interpolate sb with no guards, correct cotran db using same interpolate""" if B == None: B = xl.xlnsB if F == None: @@ -122,3 +125,265 @@ def sbdb_ufunc_interpsbcotrdb(z,s,B=None,F=None): #(-2.07022694591547e-05, 3.140714511480401e-05, -1.0576641000511883e-05, 1.0576475657836816e-05) interp sb only #(-1.0576595498909253e-05, 1.0576516825874298e-05, -0.000967004741118746, 2.112421874103721e-05) cotran db only #(-2.07022694591547e-05, 3.140714511480401e-05, -2.1583566089955605e-05, 4.1009107609236585e-05) interp sb+cotran db + +def sbdb_ufunc_interpsb_g2extra(z,s,B=None,F=None): + """interpolate sb with 2 guards and extra table, ideal db""" + if B == None: + B = xl.xlnsB + if F == None: + F = -math.floor(math.log(math.log(B,2),2)) + B = B**.25 + F += 2 + z = z << 2 + N = (F-5)//2 + J = F - N + #print("guard N="+str(N)) + #print("guard J="+str(J)) + zhmask = -(1<