From 70aeb5d47abbf33380f2c02e8cb95ac63c8ae75d Mon Sep 17 00:00:00 2001 From: markgarnold <78613198+markgarnold@users.noreply.github.com> Date: Wed, 18 Dec 2024 10:26:48 -0500 Subject: [PATCH] Update xlns.py --- src/xlns.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/xlns.py b/src/xlns.py index f8465b4..733868e 100644 --- a/src/xlns.py +++ b/src/xlns.py @@ -52,6 +52,15 @@ def sbdb_ufunc_ideal(z,s,B=None,F=None): else: return 2*np.int64(np.round(np.log(np.abs(1.0 - 2.0*s + B**np.minimum(-s,z)))/math.log(B))) +def sbdb_ufunc_trunc(z,s,B=None,F=None): + """ufunc for truncated Gaussian log""" + global xlnsB + #need to deal with z=0 s=1 + if B==None: + return 2*np.int64(np.floor(np.log(np.abs(1.0 - 2.0*s + xlnsB**np.minimum(-s,z)))/math.log(xlnsB))) + else: + return 2*np.int64(np.floor(np.log(np.abs(1.0 - 2.0*s + B**np.minimum(-s,z)))/math.log(B))) + sbdb_ufunc = sbdb_ufunc_ideal def xlnsapplyfunc(x,func):