-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Catch numba errors about mixing int and float in forward modelling #112
Comments
I want to pick this issue up, but I'm not sure what error are we talking about? From what I see no prisms or tesseroids comprised of integers raise any errors, as that would cause some of the tests to fail. Sorry for the ignorance, but could you please elaborate? |
This is one of those things that seem to happen when the planets align :) But try changing one of the tesseroid tests to use integers. The reason why they are all |
Description of the desired feature
Our forward modelling code (
harmonica/forward/
) uses numba to speed up computations. It can be a bit picky about input data types and doesn't like it when we mix integers and floats. So specifying a tesseroid with[10, 20, 0, 15, 1000, 1200]
will cause an error from numba about mixingint64
andfloat64
. The actual error message is ugly, intimidating, and hard to read for non-experts. It would be better if we caught the exception in atry:... except:...
block and added some more user friendly messages to it, explaining that this is probably due to mixing ints and floats in inputs and providing possible solutions (casting input arrays to float, for example).For testing, it would help to first make a test that passes ints to the functions and verifies that they actually fail (so if numba ever stops raising these errors we can remove the code that catches them).
The text was updated successfully, but these errors were encountered: