Commit 247457d7 authored by Pieter van Velde's avatar Pieter van Velde

Added Gyroton radius fitting function in processfunctions.py

parent 05a21f6e
......@@ -3,9 +3,9 @@ from simfunctions import calc_pol, allocate, init, perm, add_bead, limits, prune
from processfunctions import exp_calc, bootstrap
# Simulation parameters
n_beads = 100 # number of beads
n_beads = 250 # number of beads
n = 6 # number of angles
n_pol = 50 # number of polymers
n_pol = 10000 # number of polymers
alfa_up = 2 # alfa to compute upper limit
alfa_low = 0.7 # alfa to compute lower limit
......
......@@ -31,7 +31,7 @@ def exp_calc(polweight_array, end_end_array, n_beads, pos_array):
a = np.arange(0, n_beads - 1, 1)
b = np.arange(0, n_beads, 1)
exp_value[0:2] = [0, 1]
exp_value_mean[0:2] = [0, 1]
rad_gyr_mean[0] = 0
font = {'family' : 'DejaVu Sans',
......@@ -53,14 +53,41 @@ def exp_calc(polweight_array, end_end_array, n_beads, pos_array):
plt.xscale("log")
plt.yscale("log")
plt.errorbar(a, exp_value_mean[0:n_beads - 1] ** 2, fmt='x', xerr=None, yerr=exp_value_std[:]**2, label='Data',color="k", capsize=3, capthick=1, markersize=3)
plt.errorbar(a, exp_value_mean[0:n_beads - 1] ** 2, fmt='x', xerr=None, yerr=2*exp_value_std*exp_value_mean, label='Data',color="k", capsize=3, capthick=1, markersize=3)
plt.grid(True, which="both", ls=":")
plt.legend(loc='best')
plt.xlim(1, 250)
plt.ylim(bottom=1)
plt.ylim(top=10000)
plt.savefig('joe', bbox_inches='tight', dpi=300)
plt.savefig('endend', bbox_inches='tight', dpi=300)
###########################################################################
q1 = np.polyfit(np.log(a[1::]), np.log(rad_gyr_mean[1::]), 1)
print(q1)
xx1 = np.linspace(0, 250 , 1000)
yy1 = np.exp(q1[1])*xx**q1[0]
plt.figure(2)
plt.xscale("log")
plt.yscale("log")
plt.plot( xx1, yy1, 'r--', label="Fit", linewidth =3)
plt.xlabel(r'$N_{beads}$')
plt.ylabel(r'$R_g^2$ $[\sigma^2]$')
plt.xscale("log")
plt.yscale("log")
plt.errorbar(a, rad_gyr_mean, fmt='x', xerr=None, yerr=rad_gyr_std, label='Data',color="k", capsize=3, capthick=1, markersize=3)
plt.grid(True, which="both", ls=":")
plt.legend(loc='best')
plt.xlim(1, 250)
plt.ylim(bottom=0.1)
plt.ylim(top=1000)
plt.savefig('gyros', bbox_inches='tight', dpi=300)
plt.figure(3)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment