index 0 is out of bounds for axis 0 with size 0
My guess is that the array field_in_k_space_REAL
is actually of length 0, most likely because you set n = 0
further up in your code (do you use n
in a loop maybe?). I can reproduce the error when I directly initialize an array of length 0.