Skip to content

Commit 594488c

Browse files
author
Malcolm White
committed
DEBUG:: Drop the imaginary part of the solution to the quadratic eqn
1 parent e4549c5 commit 594488c

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

pykonal/pykonal.pyx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,14 +1154,10 @@ cdef tuple update(
11541154
c = cc[0] + cc[1] + cc[2] - 1/vv[nbr[0], nbr[1], nbr[2]]**2
11551155
if b**2 < 4*a*c:
11561156
# This is a hack to solve the quadratic equation
1157-
# when the determinant is negative. If the
1158-
# magnitude of the determinant is very small
1159-
# compared to the solution obtained by setting it
1160-
# to zero, the approximate solution is accepted.
1157+
# when the discrimnant is negative. This hack
1158+
# simply sets the discriminant to zero.
11611159
new = -b / (2*a)
1162-
if (4*a*c - b**2) / new > 1e-4:
1163-
count_b += 1
1164-
continue
1160+
count_b += 1
11651161
else:
11661162
new = (-b + libc.math.sqrt(b**2 - 4*a*c)) / (2*a)
11671163
if new < uu[nbr[0], nbr[1], nbr[2]]:

0 commit comments

Comments
 (0)