In [41]:
# GET DISTRIBUTION OF DIHEDRAL ANGLES IN LINKAGE OF THREE TRIANGLES
In [42]:
%matplotlib inline
In [43]:
import datetime
dts = str(datetime.datetime.now())
date_time_str = dts[:10] + "-" + dts[11:13] + "-" + dts[14:16]
print date_time_str
In [44]:
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 [45]:
save_images = False
In [46]:
manifold_name = 'building_game'
poly_name = 'octahedron'
int_num = 3
unary_boundary_name = 'self_intersection'
binary_boundary_name = 'dihedrals'
stat_name = 'test_2'
In [47]:
manifold_kwargs = {'poly_name': poly_name, 'int_num': int_num}
unary_boundary_kwargs = {'poly_name': poly_name, 'int_num': int_num}
binary_boundary_kwargs = {'poly_name': poly_name, 'int_num': int_num}
stat_kwargs = {}
In [48]:
err_tol = 10**-12
h = 0.05
N = 10**2
hist_min = 0.0
hist_max = 2.0*np.pi
hist_bins = 1000
In [49]:
kwargs_nb = {'manifold_name': manifold_name,
'stat_name': stat_name,
'manifold_kwargs': manifold_kwargs,
'stat_kwargs': stat_kwargs,
'record_hist': True,
'hist_min': hist_min,
'hist_max': hist_max,
'hist_bins': hist_bins,
'err_tol': err_tol}
kwargs_b = {'manifold_name': manifold_name,
'unary_boundary_name': unary_boundary_name,
'binary_boundary_name': binary_boundary_name,
'stat_name': stat_name,
'manifold_kwargs': manifold_kwargs,
'unary_boundary_kwargs': unary_boundary_kwargs,
'binary_boundary_kwargs': binary_boundary_kwargs,
'stat_kwargs': stat_kwargs,
'record_hist': True,
'hist_min': hist_min,
'hist_max': hist_max,
'hist_bins': hist_bins,
'err_tol': err_tol}
In [50]:
x0, links, lengths, faces = bga.load_bg_int(poly_name, int_num)
In [51]:
z_nb = mrbm.MRBM(x0, h, **kwargs_nb)
z_b = mrbm.MRBM(x0, h, **kwargs_b)
In [52]:
s_nb = z_nb.sample(N=N, record_trace=False, record_stats=True)
print 'done'
In [53]:
s_b = z_b.sample(N=N, record_trace=False, record_stats=True)
print 'done'
In [54]:
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 [55]:
hh2n = plt.hist2d(z_nb.stat_log[:,0],
z_nb.stat_log[:,1],
bins=100,
normed=True)
plt.colorbar()
if save_images == True:
plt.savefig('test_2_n_h2_'+date_time_str+'.png')
In [56]:
hh1nx = plt.hist(z_nb.hist.midpoints, weights=z_nb.hist.hist[0,:], normed=True, bins=40)
xyn = plt.plot(x_range, ys, 'r')
if save_images == True:
plt.savefig('test_2_n_h1x_'+date_time_str+'.png')
In [57]:
hh1ny = plt.hist(z_nb.hist.midpoints, weights=z_nb.hist.hist[1,:], normed=True, bins=40)
xyn = plt.plot(x_range, ys, 'r')
if save_images == True:
plt.savefig('test_2_n_h1y_'+date_time_str+'.png')
In [58]:
hh2b = plt.hist2d(z_b.stat_log[:,0],
z_b.stat_log[:,1],
bins=100,
normed=True)
plt.colorbar()
if save_images == True:
plt.savefig('test_2_b_h2_'+date_time_str+'.png')
In [59]:
hh1bx = plt.hist(z_b.hist.midpoints, weights=z_b.hist.hist[0,:], normed=True, bins=40)
xyb = plt.plot(x_range, ys, 'r')
if save_images == True:
plt.savefig('test_2_b_h1x_'+date_time_str+'.png')
In [60]:
hh1by = plt.hist(z_b.hist.midpoints, weights=z_b.hist.hist[1,:], normed=True, bins=40)
xyb = plt.plot(x_range, ys, 'r')
if save_images == True:
plt.savefig('test_2_b_h1y_'+date_time_str+'.png')