Skip to content

Commit

Permalink
Update xlns.py
Browse files Browse the repository at this point in the history
  • Loading branch information
markgarnold committed Dec 18, 2024
1 parent 70e0e38 commit 70aeb5d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/xlns.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 70aeb5d

Please sign in to comment.