Example #1
0
def test_expand_2d():
    # 2d make wave format
    wave = [0, 100, 2, 1, 0, 0, 0, 4, 2, 2, 1000, 100, 0, 100, 0, 0, 0, 0, 0]
    wave = np.array(wave)

    new = echelle.expand_polynomial(2, wave)

    assert isinstance(new, np.ndarray)
    assert new.ndim == 2
    assert new.shape[0] == 2
    assert new.shape[1] == 100

    cmp = np.linspace(1001, 1011, 100, endpoint=False)
    assert np.allclose(new[0], cmp)

    cmp = np.linspace(501, 506, 100, endpoint=False)
    assert np.allclose(new[1], cmp)

    wave = [
        0, 100, 2, 1, 0, 0, 0, 6, 3, 3, 1000, 100, 0, 0, 100, 0, 0, 0, 0, 0, 0,
        0, 0
    ]
    wave = np.array(wave)
    new = echelle.expand_polynomial(2, wave)

    assert isinstance(new, np.ndarray)
    assert new.ndim == 2
    assert new.shape[0] == 2
    assert new.shape[1] == 100

    cmp = np.linspace(1001, 1011, 100, endpoint=False)
    assert np.allclose(new[0], cmp)

    cmp = np.linspace(501, 506, 100, endpoint=False)
    assert np.allclose(new[1], cmp)
Example #2
0
def test_expand_1d():
    wave = [[0.1, 1001], [0.05, 501]]
    wave = np.array(wave)

    new = echelle.expand_polynomial(100, wave)

    assert isinstance(new, np.ndarray)
    assert new.ndim == 2
    assert new.shape[0] == 2
    assert new.shape[1] == 100

    cmp = np.linspace(1001, 1011, 100, endpoint=False)
    assert np.allclose(new[0], cmp)

    cmp = np.linspace(501, 506, 100, endpoint=False)
    assert np.allclose(new[1], cmp)