PyLops / pylops

PyLops – A Linear-Operator Library for Python
https://pylops.readthedocs.io
GNU Lesser General Public License v3.0
431 stars 102 forks source link

ZeroDivisionError when using forward Kirchoff operator with dynamic = True and engine="numba" #527

Closed arietu closed 1 year ago

arietu commented 1 year ago

When I apply forward Kirchoff operator with dynamic =True and engine = "numba" an error appears at the "_matvec" method. image

arietu commented 1 year ago

I forgot to mention that this happens when mode='byot' where I add my own trav and amp arrays.

arietu commented 1 year ago

and everything works fine when engine='numpy'

mrava87 commented 1 year ago

Hello @arietu, this is likely due to the fact that you provide some of the amplitudes with zero.

Without a full error report I cannot tell exactly but this is what I suspect. It may work fine with engine=numpy as numpy let’s you do a division by zero and returns inf (or nan) while numba raises an error

arietu commented 1 year ago

the problem was due to the following line of code: aperture = abs(sixisrcrec - rixisrcrec) / iz

where 'iz' can be zero sometimes.

mrava87 commented 1 year ago

Right I see. This issue was recently fixed as part of a larger PR (it is currently until review and will be merged soon :) )