plt.rcParams['legend.numpoints'] = 1
plt.rcParams['legend.fontsize'] = 6
plt.rcParams['legend.borderaxespad'] = 1
plt.rcParams['lines.linewidth'] = 0.5
plt.rcParams['lines.markersize'] = 3

keep_last_percent = 50 # percentage to keep starting from the end
gamma_dot = 1e-4

files = glob.glob('stress.dat.*')
files.sort(lambda u, v: cmp(int(u[u.rindex('.') + 1:]), int(v[v.rindex('.') + 1:])))
print files
pxz = []
for file in files:
  if('norm' in file):
    pxz_ = pypolymer.get_data(file, 5)
  else:
    pxz_ = pypolymer.get_data(file, 2)
  pxz.extend(pxz_)

# ignore early data
start = len(pxz) * (1.0 - float(keep_last_percent) / 100)
pxz = pxz[int(start):]

eta = np.array(pxz) / -gamma_dot
print 'ave=', np.mean(eta), 'std=', np.std(eta)

pxz = np.array(pxz) / -gamma_dot
pxz = pxz.tolist()

block_pre = filter(lambda u: u <= len(pxz), [2**i for i in range(25)])
# g1 or g3
g = 'g1'

# window parameters
windows = 40

# monomers
if('100' in fin): monomers = 100
if('200' in fin): monomers = 200
if('400' in fin): monomers = 400
if('800' in fin): monomers = 800
if('1600' in fin): monomers = 1600

# read data
t =  pypolymer.get_data(fin, 0)
g1 = pypolymer.get_data(fin, 1)
g3 = pypolymer.get_data(fin, 3)
total_points = len(t)

print 'first line = ', t[0], g1[0], g3[0]
print 'last line = ', t[-1], g1[-1], g3[-1]
print 'total points = ', total_points

bounds = np.logspace(2, 8, num=windows)
intervals = bounds.size - 1

x_ = t
y_ = g3 if(g == 'g3') else g1

# get correct starting index and trim list if necessary
Exemplo n.º 3
0
f = open('msid_' + str(M_rings) + '_' + str(M_linear) + '_N' + str(monomers) + '.dat', 'w')
for m in range(1, monomers):
  f.write('%d %10.5f\n' % (m, aveDistsq[m]))
f.close()

if(mpl):

  plt.rcParams['xtick.labelsize'] = 8
  plt.rcParams['ytick.labelsize'] = 8
  plt.rcParams['legend.numpoints'] = 1
  plt.rcParams['text.usetex'] = True
  plt.rcParams['axes.linewidth'] = 0.5

  fin = '/people/thnfs/homes/halvers/research/contaminants/r2ij_limiting_distribution/dist_best_combined.dat'
  x = pypolymer.get_data(fin, 0)
  y = pypolymer.get_data(fin, 1)

  w = 8.0 / 2.54
  h = (3.0 / 4.0) * w

  fig = plt.figure(1, figsize=(w, h))
  plt.semilogx(x, y, 'r-', label='ideal')
  plt.semilogx(range(0, monomers), aveDistsq, 'b-')
  plt.ylim(0, 3.5)
  plt.xlabel(r'$s$', fontsize=10)
  plt.ylabel(r'$[d(s)]^2/s$', fontsize=10)
  plt.title(r'$M_{\mathrm{rings}} = 200$, $M_{\mathrm{linear}} = 6$, $N = 200$, $\phi_{\mathrm{linear}} = 0.03$', ha='center', fontsize=8)
  lg = plt.legend(loc='lower left', prop={'size':8}, borderaxespad=1, handletextpad=0.5)
  lg.get_frame().set_linewidth(0.25)
Exemplo n.º 4
0
    for i in range(0, m_):
        b_ = half(b_)
    return b_


if 1:

    gamma_dot = 1e-6
    files = glob.glob('stress.dat.*')
    files.sort(lambda u, v: cmp(int(u[u.rindex('.') + 1:]),
                                int(v[v.rindex('.') + 1:])))
    print files
    pxz = []
    for file in files:
        if ('norm' in file):
            pxz_ = pypolymer.get_data(file, 5)
        else:
            pxz_ = pypolymer.get_data(file, 2)
        pxz.extend(pxz_)
    eta = np.array(pxz) / -gamma_dot
    print 'ave=', np.mean(eta), 'std=', np.std(eta)

    f = open('blocks.dat', 'w')
    ct = 0
    sg = []
    sg_err = []
    for M in range(50):
        z = block(eta, M)
        Lp = len(z)
        if (Lp < 2): break
        ave = np.mean(z)