Пример #1
0
def idst_2d_ref(x, **kwargs):
    """ used as a reference in testing idst2. """
    x = np.array(x, copy=True)
    for row in range(x.shape[0]):
        x[row, :] = idst(x[row, :], **kwargs)
    for col in range(x.shape[1]):
        x[:, col] = idst(x[:, col], **kwargs)
    return x
def idst_2d_ref(x, **kwargs):
    """Calculate reference values for testing idst2."""
    x = np.array(x, copy=True)
    for row in range(x.shape[0]):
        x[row, :] = idst(x[row, :], **kwargs)
    for col in range(x.shape[1]):
        x[:, col] = idst(x[:, col], **kwargs)
    return x
Пример #3
0
def idst_2d_ref(x, **kwargs):
    """Calculate reference values for testing idst2."""
    x = np.array(x, copy=True)
    for row in range(x.shape[0]):
        x[row, :] = idst(x[row, :], **kwargs)
    for col in range(x.shape[1]):
        x[:, col] = idst(x[:, col], **kwargs)
    return x
Пример #4
0
def idst_2d_ref(x, **kwargs):
    """ used as a reference in testing idst2. """
    x = np.array(x, copy=True)
    for row in range(x.shape[0]):
        x[row, :] = idst(x[row, :], **kwargs)
    for col in range(x.shape[1]):
        x[:, col] = idst(x[:, col], **kwargs)
    return x
Пример #5
0
 def test_definition(self):
     for i in FFTWDATA_SIZES:
         xr, yr, dt = fftw_dst_ref(self.type, i, self.rdt)
         x = idst(yr, type=self.type)
         if self.type == 1:
             x /= 2 * (i + 1)
         else:
             x /= 2 * i
         assert_equal(x.dtype, dt)
         # XXX: we divide by np.max(x) because the tests fail otherwise. We
         # should really use something like assert_array_approx_equal. The
         # difference is due to fftw using a better algorithm w.r.t error
         # propagation compared to the ones from fftpack.
         assert_array_almost_equal(x / np.max(x), xr / np.max(x), decimal=self.dec, err_msg="Size %d failed" % i)
Пример #6
0
 def test_definition(self):
     for i in FFTWDATA_SIZES:
         xr, yr, dt = fftw_dst_ref(self.type, i, self.rdt)
         x = idst(yr, type=self.type)
         if self.type == 1:
             x /= 2 * (i+1)
         else:
             x /= 2 * i
         assert_equal(x.dtype, dt)
         # XXX: we divide by np.max(x) because the tests fail otherwise. We
         # should really use something like assert_array_approx_equal. The
         # difference is due to fftw using a better algorithm w.r.t error
         # propagation compared to the ones from fftpack.
         assert_array_almost_equal(x / np.max(x), xr / np.max(x), decimal=self.dec,
                 err_msg="Size %d failed" % i)
Пример #7
0
 def test_idst_complex(self):
     y = idst(np.arange(5) * 1j)
     x = 1j * idst(np.arange(5))
     assert_array_almost_equal(x, y)
Пример #8
0
 def test_idst_complex(self):
     y = idst(np.arange(5) * 1j)
     x = 1j * idst(np.arange(5))
     assert_array_almost_equal(x, y)