Example #1
0
def test_gsh_basis_normalization():
    from pymks.bases import GSHBasis
    from pymks.stats import _normalize
    gsh_basis = GSHBasis()
    Nx = Ny = 5
    X_ = np.zeros((1, Nx, Ny, 1))
    gsh_basis._axes = np.arange(X_.ndim - 2) + 1
    gsh_basis._axes_shape = (2 * Nx, 2 * Ny)
    norm = _normalize(X_.shape, gsh_basis, None)
    assert norm.shape == (1, Nx, Ny, 1)
    assert np.allclose(norm[0, Nx / 2, Ny / 2, 0], 25)
Example #2
0
def test_gsh_basis_normalization():
    from pymks.bases import GSHBasis
    from pymks.stats import _normalize
    gsh_basis = GSHBasis()
    Nx = Ny = 5
    X_ = np.zeros((1, Nx, Ny, 1))
    gsh_basis._axes = np.arange(X_.ndim - 2) + 1
    gsh_basis._axes_shape = (2 * Nx, 2 * Ny)
    norm = _normalize(X_.shape, gsh_basis, None)
    assert norm.shape == (1, Nx, Ny, 1)
    assert np.allclose(norm[0, Nx // 2, Ny // 2, 0], 25)
Example #3
0
def test_normalization_fftn():
    """Test normalization with fftn
    """
    from pymks.bases import FourierBasis
    from pymks.stats import _normalize
    f_basis = FourierBasis()
    Nx = Ny = 5
    X_ = np.zeros((1, Nx, Ny, 1))
    f_basis._axes = np.arange(X_.ndim - 2) + 1
    f_basis._axes_shape = (2 * Nx, 2 * Ny)
    norm = _normalize(X_.shape, f_basis, None)
    assert norm.shape == (1, Nx, Ny, 1)
    assert np.allclose(norm[0, Nx / 2, Ny / 2, 0], 25)
Example #4
0
def test_normalization_rfftn():
    """Test normalization with rfftn
    """
    from pymks import PrimitiveBasis
    from pymks.stats import _normalize
    prim_basis = PrimitiveBasis()
    Nx = Ny = 5
    X_ = np.zeros((1, Nx, Ny, 1))
    prim_basis._axes = np.arange(X_.ndim - 2) + 1
    prim_basis._axes_shape = (2 * Nx, 2 * Ny)
    norm = _normalize(X_.shape, prim_basis, None)
    assert norm.shape == (1, Nx, Ny, 1)
    assert np.allclose(norm[0, Nx / 2, Ny / 2, 0], 25)
Example #5
0
def test_normalization_fftn():
    """Test normalization with fftn
    """
    from pymks.bases import FourierBasis
    from pymks.stats import _normalize
    f_basis = FourierBasis()
    Nx = Ny = 5
    X_ = np.zeros((1, Nx, Ny, 1))
    f_basis._axes = np.arange(X_.ndim - 2) + 1
    f_basis._axes_shape = (2 * Nx, 2 * Ny)
    norm = _normalize(X_.shape, f_basis, None)
    assert norm.shape == (1, Nx, Ny, 1)
    assert np.allclose(norm[0, Nx // 2, Ny // 2, 0], 25)
Example #6
0
def test_normalization_rfftn():
    """Test normalization with rfftn
    """
    from pymks import PrimitiveBasis
    from pymks.stats import _normalize
    prim_basis = PrimitiveBasis()
    Nx = Ny = 5
    X_ = np.zeros((1, Nx, Ny, 1))
    prim_basis._axes = np.arange(X_.ndim - 2) + 1
    prim_basis._axes_shape = (2 * Nx, 2 * Ny)
    norm = _normalize(X_.shape, prim_basis, None)
    assert norm.shape == (1, Nx, Ny, 1)
    assert np.allclose(norm[0, Nx // 2, Ny // 2, 0], 25)