In [29]:
# TEST IF THE CHOICE OF FACE TO FIX WILL CHANGE THE RESULTING DISTRIBUTION
In [30]:
%matplotlib inline
In [31]:
import datetime
dts = str(datetime.datetime.now())
date_time_str = dts[:10] + "-" + dts[11:13] + "-" + dts[14:16]
print date_time_str
In [32]:
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 [33]:
save_images = False
In [34]:
manifold_name = 'building_game'
poly_name = 'octahedron'
int_num = 3
stat_name = 'test_2'
In [35]:
manifold_kwargs_n = {'poly_name': poly_name, 'int_num': int_num, 'fixed_face': None}
manifold_kwargs_0 = {'poly_name': poly_name, 'int_num': int_num, 'fixed_face': 0}
manifold_kwargs_1 = {'poly_name': poly_name, 'int_num': int_num, 'fixed_face': 1}
manifold_kwargs_2 = {'poly_name': poly_name, 'int_num': int_num, 'fixed_face': 2}
In [36]:
err_tol = 10**-12
h = 0.05
N = 10**7
hist_min = 0.0
hist_max = 2.0*np.pi
hist_bins = 1000
In [37]:
kwargs_n = {'manifold_name': manifold_name,
'stat_name': stat_name,
'manifold_kwargs': manifold_kwargs_n,
'record_hist': True,
'hist_min': hist_min,
'hist_max': hist_max,
'hist_bins': hist_bins,
'err_tol': err_tol}
kwargs_0 = {'manifold_name': manifold_name,
'stat_name': stat_name,
'manifold_kwargs': manifold_kwargs_0,
'record_hist': True,
'hist_min': hist_min,
'hist_max': hist_max,
'hist_bins': hist_bins,
'err_tol': err_tol}
kwargs_1 = {'manifold_name': manifold_name,
'stat_name': stat_name,
'manifold_kwargs': manifold_kwargs_1,
'record_hist': True,
'hist_min': hist_min,
'hist_max': hist_max,
'hist_bins': hist_bins,
'err_tol': err_tol}
kwargs_2 = {'manifold_name': manifold_name,
'stat_name': stat_name,
'manifold_kwargs': manifold_kwargs_2,
'record_hist': True,
'hist_min': hist_min,
'hist_max': hist_max,
'hist_bins': hist_bins,
'err_tol': err_tol}
In [38]:
x0, links, lengths, faces = bga.load_bg_int(poly_name, int_num)
In [39]:
z_n = mrbm.MRBM(x0, h, **kwargs_n)
z_0 = mrbm.MRBM(x0, h, **kwargs_0)
z_1 = mrbm.MRBM(x0, h, **kwargs_1)
z_2 = mrbm.MRBM(x0, h, **kwargs_2)
In [40]:
a = 0.5/np.pi
b = -a*0.1
c = -a*0.1
x_range = np.linspace(0.0, 2.0*np.pi)
ys = a + b*np.cos(x_range) + c*np.cos(2*x_range)
In [41]:
s_n = z_n.sample(N=N, record_trace=False, record_stats=True)
print 'done'
In [42]:
hist_n = plt.hist2d(z_n.stat_log[:,0], z_n.stat_log[:,1], bins=100, normed=True)
plt.colorbar()
if save_images == True:
plt.savefig('test_3_n_h2_'+date_time_str+'.png')
In [43]:
hh1nx = plt.hist(z_n.hist.midpoints, weights=z_n.hist.hist[0,:], normed=True, bins=40)
xyn = plt.plot(x_range, ys, 'r')
if save_images == True:
plt.savefig('test_3_n_h1x_'+date_time_str+'.png')
In [44]:
hh1ny = plt.hist(z_n.hist.midpoints, weights=z_n.hist.hist[1,:], normed=True, bins=40)
xyn = plt.plot(x_range, ys, 'r')
if save_images == True:
plt.savefig('test_3_n_h1y_'+date_time_str+'.png')
In [45]:
s_0 = z_0.sample(N=N, record_trace=False, record_stats=True)
print 'done'
In [46]:
hist_0 = plt.hist2d(z_0.stat_log[:,0], z_0.stat_log[:,1], bins=100, normed=True)
plt.colorbar()
if save_images == True:
plt.savefig('test_3_0_h2_'+date_time_str+'.png')
In [47]:
hh10x = plt.hist(z_0.hist.midpoints, weights=z_0.hist.hist[0,:], normed=True, bins=40)
xy0 = plt.plot(x_range, ys, 'r')
if save_images == True:
plt.savefig('test_3_0_h1x_'+date_time_str+'.png')
In [48]:
hh10y = plt.hist(z_0.hist.midpoints, weights=z_0.hist.hist[1,:], normed=True, bins=40)
xy0 = plt.plot(x_range, ys, 'r')
if save_images == True:
plt.savefig('test_3_0_h1y_'+date_time_str+'.png')
In [49]:
s_1 = z_1.sample(N=N, record_trace=False, record_stats=True)
print 'done'
In [50]:
hist_1 = plt.hist2d(z_1.stat_log[:,0], z_1.stat_log[:,1], bins=100, normed=True)
plt.colorbar()
if save_images == True:
plt.savefig('test_3_1_h2_'+date_time_str+'.png')
In [51]:
hh11x = plt.hist(z_1.hist.midpoints, weights=z_1.hist.hist[0,:], normed=True, bins=40)
xy1 = plt.plot(x_range, ys, 'r')
if save_images == True:
plt.savefig('test_3_1_h1x_'+date_time_str+'.png')
In [52]:
hh11y = plt.hist(z_1.hist.midpoints, weights=z_1.hist.hist[1,:], normed=True, bins=40)
xy1 = plt.plot(x_range, ys, 'r')
if save_images == True:
plt.savefig('test_3_1_h1y_'+date_time_str+'.png')
In [53]:
s_2 = z_2.sample(N=N, record_trace=False, record_stats=True)
print 'done'
In [54]:
hist_2 = plt.hist2d(z_2.stat_log[:,0], z_2.stat_log[:,1], bins=100, normed=True)
plt.colorbar()
if save_images == True:
plt.savefig('test_3_2_h2_'+date_time_str+'.png')
In [55]:
hh12x = plt.hist(z_2.hist.midpoints, weights=z_2.hist.hist[0,:], normed=True, bins=40)
xy2 = plt.plot(x_range, ys, 'r')
if save_images == True:
plt.savefig('test_3_2_h1x_'+date_time_str+'.png')
In [56]:
hh12y = plt.hist(z_2.hist.midpoints, weights=z_2.hist.hist[1,:], normed=True, bins=40)
xy2 = plt.plot(x_range, ys, 'r')
if save_images == True:
plt.savefig('test_3_2_h1y_'+date_time_str+'.png')