示例#1
0
    def test_bounds(self):
        c, a = 3, 2
        t = tadasets.torus(n=3045, c=3, a=2)

        bound = c + a
        rs = np.fromiter((norm(p) for p in t), np.float64)
        assert np.all(rs <= bound)
示例#2
0
def sample_torus(dimension: int, amount: int, radii: list) -> np.ndarray:
    """
        **Sample from a d-torus.**

        The function is named cursed, because the curse of dimensionality leads to an exponential grouth in time.
        The samples are drawn and then rejected if the lie on the algebraic variety of the torus. Unfortunately 
        the curse of dimensionality makes the computation time exponential in the number of dimensions. Therefore
        this is just a prototype for low dimensional sampling

        + param **dimension**: as dimension of the embedding space, type `int`.
        + param **amount**: amount of sample points, type `float`.
        + param **radii**: radii of the torical spheres, type `list`.
        + return **list**: data points, type `list`.
    """
    return tadasets.torus(n=2000, c=2, a=1, ambient=200, noise=0.2)
示例#3
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jan  8 11:17:01 2021

@author: mike
"""

from tadasets import torus
from ripser import ripser
from PersistenceLandscapeGrid import PersLandscapeApprox
from visualization import plot_landscape

t = torus()

tph = ripser(t)['dgms']

tpl = PersLandscapeApprox(dgms=tph, hom_deg=1)
#%%
plot_landscape(tpl)
示例#4
0
 def test_ambient(self):
     s = tadasets.torus(n=200, c=3, ambient=15)
     assert s.shape == (200, 15)
示例#5
0
 def test_plt(self):
     t = tadasets.torus(n=345)
     tadasets.plot3d(t)
示例#6
0
 def test_n(self):
     t = tadasets.torus(n=345)
     assert t.shape[0] == 345
示例#7
0
import collections
import tadasets
import numpy as np
import csv

torus = tadasets.torus(n=2000, c=2, a=1, ambient=200, noise=0.2)
swiss_roll = tadasets.swiss_roll(n=2000, r=4, ambient=10, noise=1.2)
dsphere = tadasets.dsphere(n=1000, d=12, r=3.14, ambient=14, noise=0.14)
inf_sign = tadasets.infty_sign(n=3000, noise=0.1)

np.savetxt('torus.csv', (torus), delimiter=',')
np.savetxt('swiss_roll.csv', (swiss_roll), delimiter=',')
np.savetxt('dsphere.csv', (dsphere), delimiter=',')
np.savetxt('inf_sign.csv', (inf_sign), delimiter=',')