Commit 0b7b3a2b authored by Zhang Xin's avatar Zhang Xin
Browse files

griddata memory issue

parent b2d70812
Loading
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -143,10 +143,21 @@ class FlatLED(MockObject):
        n_x = np.arange(0, self.chip.npix_x, 1)
        n_y = np.arange(0, self.chip.npix_y, 1)
        M, N = np.meshgrid(n_x, n_y)
        U = griddata(X_, Z_, (
            M[0:self.chip.npix_y, 0:self.chip.npix_x],
            N[0:self.chip.npix_y, 0:self.chip.npix_x]),
            method='nearest').astype(np.float32)
        x_seg_len = 4
        y_seg_len = 8
        x_seg = int(self.chip.npix_x/x_seg_len)
        y_seg = int(self.chip.npix_y/y_seg_len)
        U = np.zeros([self.chip.npix_y,self.chip.npix_x],dtype=np.float32)
        for y_seg_i in np.arange(y_seg_len):
            for x_seg_i in np.arange(x_seg_len):
                U[y_seg_i*y_seg:(y_seg_i+1)*y_seg, x_seg_i*x_seg:(x_seg_i+1)*x_seg] = griddata(X_, Z_, (
            M[y_seg_i*y_seg:(y_seg_i+1)*y_seg, x_seg_i*x_seg:(x_seg_i+1)*x_seg],
            N[y_seg_i*y_seg:(y_seg_i+1)*y_seg, x_seg_i*x_seg:(x_seg_i+1)*x_seg]),
            method='linear')
        # U = griddata(X_, Z_, (
        #     M[0:self.chip.npix_y, 0:self.chip.npix_x],
        #     N[0:self.chip.npix_y, 0:self.chip.npix_x]),
        #     method='nearest').astype(np.float32)
        U = U/np.mean(U)
        flatImage = U
        if LED_Img_flag: