In [5]:
%reload_ext autoreload
%autoreload 2

In [6]:
from centerpoints.iterated_tverberg import IteratedTverberg
from centerpoints.iterated_radon import IteratedRadon
import centerpoints.cli as cli
import numpy as np
import math
from math import cos, sin, pi

In [7]:
it = IteratedTverberg()
cl = IteratedRadon()
cl2 = IteratedRadon(True)

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


/home/jo/.miniconda3/envs/cpts/lib/python3.4/site-packages/matplotlib/__init__.py:1157: UserWarning:  This call to matplotlib.use() has no effect
because the backend has already been chosen;
matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

  warnings.warn(_use_error_msg)

In [9]:
with open('./evaluation/sphere-3d-random-50-500.csv') as file:
    s = cli.read_points_csv(file, '\t')
    
p = it.centerpoint(s)
p1 = cl.centerpoint(s)
p2 = cl2.centerpoint(s)

s = np.asarray(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=25, c='red')
ax.scatter(*p1, s=25, c='yellow')
ax.scatter(*p2, s=25, c='orange')
fig.savefig('random_sphere.pdf')


---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-9-433915db0965> in <module>()
----> 1 with open('./evaluation/sphere-3d-random-50-500.csv') as file:
      2     s = cli.read_points_csv(file, '\t')
      3 
      4 p = it.centerpoint(s)
      5 p1 = cl.centerpoint(s)

FileNotFoundError: [Errno 2] No such file or directory: './evaluation/sphere-3d-random-50-500.csv'

In [ ]:
with open('./evaluation/sphere-3d-50-500.csv') as file:
    s = cli.read_points_csv(file, '\t')
    
p = it.centerpoint(s)
p1 = cl.centerpoint(s)
p2 = cl2.centerpoint(s)

s = np.asarray(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=25, c='red')
ax.scatter(*p1, s=25, c='yellow')
ax.scatter(*p2, s=25, c='orange')
fig.savefig('normal_sphere.pdf')

In [ ]:
with open('./evaluation/sphere-2d-50-500.csv') as file:
    s = cli.read_points_csv(file, '\t')
    
p = it.centerpoint(s)
p1 = cl.centerpoint(s)
p2 = cl2.centerpoint(s)

s = np.asarray(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=25, c='red')
ax.scatter(*p1, s=25, c='yellow')
ax.scatter(*p2, s=25, c='orange')
fig.savefig('ring.pdf')