In [167]:
%matplotlib inline

In [168]:
import numpy as np

import matplotlib.pyplot as plt

import bga_4_0 as bga
import manifold_reflected_brownian_motion as mrbm

bga = reload(bga)
mrbm = reload(mrbm)

In [169]:
poly_name = 'octahedron'
int_num = 2

manifold_name = poly_name
manifold_kwargs = {'int_num': int_num}

boundary_name = poly_name
boundary_kwargs = {'int_num': int_num}

stat_name = 'test_1'
stat_kwargs = {}

In [170]:
err_tol = 10**-12
#h0 = 0.05
h = 0.01
N = 5*10**6
run_kwargs = {'N': N, 'bg': True}

kwargs_nb = {'stat_name': stat_name,
            'run_kwargs': run_kwargs, 
            'err_tol': err_tol,
            'manifold_kwargs': manifold_kwargs,
            'boundary_kwargs': {},
            'stat_kwargs': stat_kwargs}

kwargs_b = {'stat_name': stat_name,
            'run_kwargs': run_kwargs, 
            'err_tol': err_tol,
            'manifold_kwargs': manifold_kwargs,
            'boundary_kwargs': boundary_kwargs,
            'stat_kwargs': stat_kwargs}

In [171]:
x0, links, lengths, faces = bga.load_bg_int(poly_name, int_num)

In [172]:
z_no_boundary = mrbm.MRBM(manifold_name, 
                          'none', 
                          x0, 
                          h, 
                          **kwargs_nb)
z_boundary = mrbm.MRBM(manifold_name, 
                       boundary_name, 
                       x0, 
                       h, 
                       **kwargs_b)

In [173]:
s_nb = z_no_boundary.sample(N=N, record_trace=False, record_stats=True)

In [174]:
#s_b = z_boundary.sample(N=N, record_trace=False, record_stats=True)

In [175]:
import datetime
dts = str(datetime.datetime.now())
date_time_str = dts[:10] + "-" + dts[11:13] + "-" + dts[14:16]
print date_time_str


2015-01-25-18-44

In [176]:
hist_nb = plt.hist(z_no_boundary.stat_log[~np.isnan(z_no_boundary.stat_log)], bins=80, normed=True)
xs = np.linspace(0.0, 2.0*np.pi)

#a = 0.158
#b = -0.0145
#c = -0.017

a = 0.5/np.pi
b = -a*0.1
c = -a*0.1

ys = a + b*np.cos(xs) + c*np.cos(2*xs)
plt.plot(xs, ys, 'r')

plt.savefig('two_triangles_no_boundaries_'+date_time_str+'.png')



In [177]:
hist_b = plt.hist(z_boundary.stat_log, bins=80, normed=True)
plt.plot(xs, ys, 'r')
plt.savefig('two_triangles_boundaries_'+date_time_str+'.png')
#plt.savefig('two_triangles_boundaries_err_13.png')


/home/daniel/anaconda/lib/python2.7/site-packages/matplotlib/axes.py:8261: UserWarning: 2D hist input should be nsamples x nvariables;
 this looks transposed (shape is 1 x 6)
  'this looks transposed (shape is %d x %d)' % x.shape[::-1])

In [178]:
plot_nb = plt.plot(z_no_boundary.stat_log[:10000])



In [179]:
plot_b = plt.plot(z_boundary.stat_log[:10000])



In [180]:
print z_boundary.faces
print z_boundary.dihedral_inds
print z_boundary.links
print z_boundary.lengths


[[0, 2, 3], [1, 3, 2]]
[[0, 2, 3, 1]]
[[1, 3], [1, 2], [2, 3], [0, 2], [0, 3]]
[ 1.  1.  1.  1.  1.]

In [181]:
#hist_nb = plt.hist(z_no_boundary.stat_log[~np.isnan(z_no_boundary.stat_log)].reshape((6,-1)), bins=80, normed=True)
print z_boundary.faces


[[0, 2, 3], [1, 3, 2]]

In [182]:
xx = plt.hist(z_no_boundary.stat_log[:,0], normed=True, bins=40)



In [183]:
xx = plt.hist(z_no_boundary.stat_log[:,1], normed=True, bins=40)



In [184]:
xx = plt.hist(z_no_boundary.stat_log[:,2], normed=True, bins=40)



In [185]:
xx = plt.hist(z_no_boundary.stat_log[:,3], normed=True, bins=40)



In [186]:
xx = plt.hist(z_no_boundary.stat_log[:,4], normed=True, bins=40)



In [187]:
xx = plt.hist(z_boundary.stat_log[:,5], normed=True, bins=40)