Visualizing depth image after accessing render results
the line

depth[i,k] = pixels[i+k] 


seems off to me, it seems as if you need to transform your indices between the 2d depth array and the flat 1d pixels array like:

depth[i,k] = pixels[i*int(round(ix/2))+k] 


where the index i offsets multiples of the length a whole row into the array, and k additionally offsets into each element of it.