Example #1
0
 def remove_nyquist(self, a, aft):
     ny, nx = a.shape
     if mm.iseven(ny):
         aft[ny/2,:] = 0
     if mm.iseven(nx):
         aft[:,nx/2] = 0
     a = real(ifft2(aft))
     return a, aft
Example #2
0
 def remove_nyquist(self, a, aft):
     ny, nx = a.shape
     if mm.iseven(ny):
         aft[ny / 2, :] = 0
     if mm.iseven(nx):
         aft[:, nx / 2] = 0
     a = real(ifft2(aft))
     return a, aft
Example #3
0
    def setUp(self):

        ## pick random odd upsampling
        upsample = randint(1, 16)
        if mm.iseven(upsample):
            half = int((upsample - 1)/2.0)
        else:
            half = int(upsample/2.0) - 1

        # setup random area to calculate idft on
        nx = randint(10, 100)
        ny = randint(10, 100)
        height = randint(4, ny*upsample)
        width = randint(4, nx*upsample)
        try:
            top = randint(0, ny*upsample - height)
        except:
            top = 0
        try:
            left = randint(0, nx*upsample - width)
        except:
            left = 0

        # generate a random image
        aa = rand(ny, nx)
        aa[:-5, :-5] += 1
        aa[:-2, :] += 2
        a = fft2(aa)

        aa, a = self.remove_nyquist(aa, a)

        ## attach data to test case
        self.aa = aa
        self.a = a
        self.nx = nx
        self.ny = ny
        self.height = height
        self.width = width
        self.top = top
        self.left = left
        self.upsample = upsample
Example #4
0
    def setUp(self):

        ## pick random odd upsampling
        upsample = randint(1, 16)
        if mm.iseven(upsample):
            half = int((upsample - 1) / 2.0)
        else:
            half = int(upsample / 2.0) - 1

        # setup random area to calculate idft on
        nx = randint(10, 100)
        ny = randint(10, 100)
        height = randint(4, ny * upsample)
        width = randint(4, nx * upsample)
        try:
            top = randint(0, ny * upsample - height)
        except:
            top = 0
        try:
            left = randint(0, nx * upsample - width)
        except:
            left = 0

        # generate a random image
        aa = rand(ny, nx)
        aa[:-5, :-5] += 1
        aa[:-2, :] += 2
        a = fft2(aa)

        aa, a = self.remove_nyquist(aa, a)

        ## attach data to test case
        self.aa = aa
        self.a = a
        self.nx = nx
        self.ny = ny
        self.height = height
        self.width = width
        self.top = top
        self.left = left
        self.upsample = upsample