Commit d0440a4a authored by Zhang Xin's avatar Zhang Xin
Browse files

griddata memery issue, use nearest replace linear

parent 31aa8b60
Loading
Loading
Loading
Loading
Loading
+3 −10
Original line number Diff line number Diff line
@@ -129,31 +129,24 @@ class FlatLED(MockObject):
                         cwaves_name[led_type] + 'nm.fits'))
        xlen = flat[0].header['NAXIS1']
        ylen = 601

        i = self.chip.rowID - 1
        j = self.chip.colID - 1

        x = np.linspace(0, self.chip.npix_x, int(xlen/6.))
        y = np.linspace(0, self.chip.npix_y, int(ylen/5.))
        xx, yy = np.meshgrid(x, y)

        a1 = flat[0].data[int(ylen*i/5.):int(ylen*i/5.)+int(ylen/5.),
                          int(xlen*j/6.):int(xlen*j/6.)+int(xlen/6.)]
        # z = np.sin((xx+yy+xx**2+yy**2))
        # fInterp = interp2d(xx, yy, z, kind='linear')        

        X_ = np.hstack((xx.flatten()[:, None], yy.flatten()[:, None]))
        Z_ = a1.flatten()

        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='linear')
            method='nearest').astype(np.float32)        
        U = U/np.mean(U)
        flatImage = U
        if LED_Img_flag: