Skip to content

Commit

Permalink
Fix gaussian normalisation issues
Browse files Browse the repository at this point in the history
  • Loading branch information
HKaras committed Nov 27, 2024
1 parent d70b721 commit 744baf8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions deerlab/dd_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def docstr_example(fcnstr):
# =================================================================
def _normalize(r,P):
if not all(P==0):
P = P/np.trapz(P,r)
P = P/np.trapezoid(P,r)
return P
# =================================================================

Expand All @@ -110,7 +110,7 @@ def _multigaussfun(r,r0,sig):
P = np.sqrt(1/(2*np.pi))*1/sig*np.exp(-0.5*((r.T-r0)/sig)**2)
if not np.all(P==0):
# Normalization
P = np.squeeze(P)/np.sum([np.trapezoid(c,r) for c in P.T])
P = np.squeeze(P)/np.array([np.trapezoid(c,r) for c in P.T]).reshape(1, -1)
else:
P = np.squeeze(P)
return P
Expand Down

0 comments on commit 744baf8

Please sign in to comment.