def test_phat_diagrams():

    t = np.linspace(0, 2 * np.pi, 40)
    X = np.zeros((len(t), 2))
    X[:, 0] = np.cos(t)
    X[:, 1] = np.sin(t)
    np.random.seed(10)
    X += 0.2 * np.random.randn(len(t), 2)
    rips = Rips(1).build(X)

    dgms = phat_diagrams(rips)
Beispiel #2
0
def test_1d_solver():

    filt = [
        ([0], 0.0),
        ([1], 0.0),
        ([2], 0.0),
        ([3], 0.0),
        ([0, 1], 0.5),
        ([1, 2], 0.6),
    ]

    dgms = phat_diagrams(filt)

    assert len(dgms[0]) == 2
    assert [0, 0.5] in dgms[0].tolist()
    assert [0.0, 0.6] in dgms[0].tolist()
Beispiel #3
0
def test_infs():
    filt = [
        ([0], 0.0),
        ([1], 0.0),
        ([2], 0.0),
        ([3], 0.0),
        ([0, 1], 0.5),
        ([1, 2], 0.6),
        ([0, 2], 0.7),
    ]

    dgms = phat_diagrams(filt, show_inf=True)

    assert len(dgms) == 2

    assert [0.7, np.inf] in dgms[1].tolist()