Skip to content

Commit

Permalink
DEBUG:: Drop the imaginary part of the solution to the quadratic eqn
Browse files Browse the repository at this point in the history
  • Loading branch information
Malcolm White committed Aug 21, 2019
1 parent e4549c5 commit 594488c
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions pykonal/pykonal.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1154,14 +1154,10 @@ cdef tuple update(
c = cc[0] + cc[1] + cc[2] - 1/vv[nbr[0], nbr[1], nbr[2]]**2
if b**2 < 4*a*c:
# This is a hack to solve the quadratic equation
# when the determinant is negative. If the
# magnitude of the determinant is very small
# compared to the solution obtained by setting it
# to zero, the approximate solution is accepted.
# when the discrimnant is negative. This hack
# simply sets the discriminant to zero.
new = -b / (2*a)
if (4*a*c - b**2) / new > 1e-4:
count_b += 1
continue
count_b += 1
else:
new = (-b + libc.math.sqrt(b**2 - 4*a*c)) / (2*a)
if new < uu[nbr[0], nbr[1], nbr[2]]:
Expand Down

0 comments on commit 594488c

Please sign in to comment.