In [23]:
%reload_ext autoreload
%autoreload 2

In [24]:
from centerpoints.helpers import sphere_points, random_sphere_points
from centerpoints.iterated_tverberg import IteratedTverberg
import numpy as np
import math
from math import cos, sin, pi

In [25]:
it = IteratedTverberg()

In [26]:
import matplotlib
matplotlib.use('PDF')
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

In [38]:
s = random_sphere_points(500,3)
print(type(s))
p = it.centerpoint(s)

fig = plt.figure()
ax = fig.add_subplot(111, projection="3d")
ax.scatter(s[:,0],s[:,1],s[:,2], c='b', s=15)
ax.scatter(*p, s=20, c='r')
fig.savefig('random_sphere.pdf')


<class 'numpy.ndarray'>

In [28]:
s = sphere_points(500,3)
p = it.centerpoint(s)

fig = plt.figure()
ax = fig.add_subplot(111, projection="3d")
ax.scatter(s[:,0],s[:,1],s[:,2], c='b', s=15)
ax.scatter(*p, s=20, c='r')
fig.savefig('normal_sphere.pdf')



In [29]:
s = sphere_points(500,2)
p = it.centerpoint(s)

fig = plt.figure()
ax = fig.add_subplot(111, projection="3d")
ax.scatter(s[:,0],s[:,1], c='b', s=15)
ax.scatter(*p, s=20, c='r')
fig.savefig('ring.pdf')



In [40]:
import centerpoints.cli as cli
with open('./evaluation/sphere-3d-50-5000.csv') as file:
    s = cli.read_points_csv(file, '\t')
s = np.asarray(s)
print(type(s))
p = it.centerpoint(s)

fig = plt.figure()
ax = fig.add_subplot(111, projection="3d")
ax.scatter(s[:,0],s[:,1],s[:,2], c='b', s=15)
ax.scatter(*p, s=20, c='r')
fig.savefig('normal_sphere.pdf')


<class 'numpy.ndarray'>

In [64]:
import json
with open('./bench_rand_50-5000-itRadon-with_Tree.json') as with_tree:
    points_with_tree = json.load(with_tree)
with open('./bench_rand_50-5000-itRadon-without_Tree.json') as without_tree:
    points_without_tree = json.load(without_tree)
with open('./bench_rand_50-5000-itTverberg.json') as tverberg:
    points_tverberg = json.load(tverberg)
points_tverberg = sorted(points_tverberg[0])[:275]
points_with_tree = sorted(points_with_tree[0])[:275]
points_without_tree = sorted(points_without_tree[0])[:275]
fig = plt.figure()
ax = fig.add_subplot(121)
ax2 = fig.add_subplot(122)
fig.tight_layout()
fig.subplots_adjust(wspace=0.4)
ax.set_xticklabels(['ItRadon without Tree', 'ItTverberg'])
ax2.set_xticklabels(['ItRadon with Tree'])
bp = ax.boxplot([ points_without_tree, points_tverberg])
bp2 = ax2.boxplot(points_with_tree)
fig.savefig('bench.pdf')



In [ ]: