[fixed] Two arrays getting conflated but only sometimes?

Got a strange bug in my code, I’m doing some numerical calculations in Numba jit’ed code that fills 3 arrays with data and then using non-jitted python code to graph the result using matplotlib. To be exact I graph the array 1 vs array 2, and array 1 vs array 3, when the JIT is disabled this gives the result I expect, however when I enable the JIT the first graph is correct but the second graph ends up being the same as the first graph/

I tried dumping the contents of array 3 using both print and np.savetxt and the contents matches the expected value (and not the graph that is actually produced !).

Any ideas what could be causing this? I might be missing some subtilty of how Numba handles Numpy arrays but I tried rewriting the array handling part of the code in a few different ways and I seem to get the same issue each time. Could some sort of bug in either my code or Numba put the array in some sort of invalid state that behave like this

Only noticed it the next morning but matplotlib was rescaling the axis for the second graph, which ended up resulting in a very similar graph to the first one (scaling aside), but of course when the data was printed out it looked correct. Ended up switching a few single precision floats over to be doubles and now get the same result with JIT enabled and JIT disabled.

Do you have a minimal working example of your problem?

1 Like