Exemplo n.º 1
0
def test_chunk_sizes(faces, Nx, Ny, rot, exp_tNX, exp_tNY):
    if _is_connect(faces, rotated=rot):
        tNy, tNx = chunk_sizes(faces, [Nx], [Ny], rotated=rot)
        assert tNy == exp_tNY
        assert tNx == exp_tNX
    else:
        with pytest.raises(ValueError):
            tNy, tNx = chunk_sizes(faces, [Nx], [Ny], rotated=rot)
            assert tNy == exp_tNY
            assert tNx == exp_tNX
Exemplo n.º 2
0
def test_make_chunks(faces, rot, NX, NY, expCX, expCY, epx, epy, epax, epay):
    if rot:
        fs = [k for k in faces if k in _np.arange(7, 13)]
    else:
        fs = [k for k in faces if k in _np.arange(6)]
    tNy, tNx = chunk_sizes(faces, [Nx], [Ny], rotated=rot)
    delNX = 0
    delNY = 0
    afs = []
    if 6 in faces:
        acnrot_fs = [k for k in faces if k in _np.array([2, 5])]
        acrot_fs = [k for k in faces if k in _np.array([7, 10])]
        if rot:
            delNX = int(Nx / 2)
            afs = acrot_fs
        else:
            delNY = int(Ny / 2)
            afs = acnrot_fs
    tNy = tNy + delNY
    tNx = tNx + delNX
    Nxc = _np.arange(0, tNx + 1, Nx)
    Nyc = _np.arange(0, tNy + 1, Ny)
    xChunk, yChunk = make_chunks(Nxc, Nyc)
    assert xChunk == expCX
    assert yChunk == expCY
    py, px, pyarc, pxarc = pos_chunks(fs, afs, yChunk, xChunk)
    assert epy == py
    assert epx == px
    assert epay == pyarc
    assert epax == pxarc