Having a problem with takibg a difference of two large arrays

I am having a problem with subtracting two large 2Darrays. Most of the time it gives the right answer but its adding a juck values in between. here is my code

/

import numpy as np
import yuvio
import csv
yuv_frames = yuvio.mimread(“test.yuv”, 3840, 2160, ‘yuv420p16le’,1,1)
yuv_frame_temp =yuvio.mimread(“test.yuv”, 3840, 2160, ‘yuv420p16le’,1+30,1)
x=np.array(yuv_frames[0].y)
y=np.array(yuv_frame_temp[0].y)
s=(2160, 3840)
z=np.zeros(s)
z=np.subtract(x,y)
/

I need to take the mean of z and its giving a very large number and i tried to log the array to CSV and found out its adding some juck values like 6500 , 8000 in some cells where is supposed to be much smaller values like 8 ,10. This problem is only in few cells and rest of them got right difference. I would be thankfull if someone couls help me this.

If you replace the / in your post with ```, Discourse will better format your code, making it easier to read.

You’re discarding the first assignment to z, letting you know.

Try also logging the values of x and y to CSV to see what’s going on. NumPy won’t ever introduce new values (although you may be subtracting unsigned integers)

How do you know that the values “are supposed to be much smaller”? What are the values being subtracted?

Can you show us a small example of subtraction that introduces these junk values?