Beispiel #1
0
def modelrho(r0, logrho, nr0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, nrinf):
    # direct n(r) measures: traf(...)
    vec = np.array([logrho,nr0,v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12,v13,v14,v15,v16,v17,v18,nrinf])
    vec = traf(vec)
    vec = gcc.map_nr_data(vec, 1, gp)
    rh = phys.rho(r0, vec, 0, gp)
    return np.log(rh)
Beispiel #2
0
def modelrho(r0, logrho, nr0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11,
             v12, v13, v14, v15, v16, v17, v18, nrinf):
    # direct n(r) measures: traf(...)
    vec = np.array([
        logrho, nr0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
        v14, v15, v16, v17, v18, nrinf
    ])
    vec = traf(vec)
    vec = gcc.map_nr_data(vec, 1, gp)
    rh = phys.rho(r0, vec, 0, gp)
    return np.log(rh)
Beispiel #3
0
    vec = np.array([
        logrho, nr0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,
        v14, v15, v16, v17, v18, nrinf
    ])
    vec = traf(vec)
    vec = gcc.map_nr_data(vec, 1, gp)
    rh = phys.rho(r0, vec, 0, gp)
    return np.log(rh)


gp.debug = False
x = gp.xfine
y = np.log(analytic_rho(x))
popt3, pcov3 = curve_fit(modelrho, x, y, p0=npr.rand(gp.nrho), maxfev=10000)
nr01opt = traf(popt3[:])
nropt = gcc.map_nr_data(nr01opt, 1, gp)
print('nr01opt = ', nr01opt)
print('nropt = ', nropt)

fig = plt.figure(facecolor='white')
left, width = 0.25, 0.7
rect1 = [left, 0.4, width, 0.55]
rect2 = [left, 0.2, width, 0.2]
ax1 = fig.add_axes(rect1)  #left, bottom, width, height
ax2 = fig.add_axes(rect2, sharex=ax1)
ax1.plot(gp.xipol, np.log(gp.dat.nu[1]), 'k', lw=3, label='data')
ax1.plot(x, y, 'b', lw=2, label='analytic')
ax1.plot(x, modelrho(x, *popt3), 'r--', lw=2, label='fit on data')
ax1.plot(x, np.log(phys.rho(x, nropt, 1, gp)), 'g--', lw=1, label='phys.rho')
ax1.set_xscale('log')
plt.setp(ax1.get_xticklabels(), visible=False)
Beispiel #4
0
    return nn

def modelrho(r0, logrho, nr0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, nrinf):
    # direct n(r) measures: traf(...)
    vec = np.array([logrho,nr0,v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12,v13,v14,v15,v16,v17,v18,nrinf])
    vec = traf(vec)
    vec = gcc.map_nr_data(vec, 1, gp)
    rh = phys.rho(r0, vec, 0, gp)
    return np.log(rh)

gp.debug = False
x = gp.xfine
y = np.log(analytic_rho(x))
popt3, pcov3 = curve_fit(modelrho, x, y, p0=npr.rand(gp.nrho), maxfev=10000)
nr01opt = traf(popt3[:])
nropt = gcc.map_nr_data(nr01opt, 1, gp)
print('nr01opt = ', nr01opt)
print('nropt = ',nropt)

fig = plt.figure(facecolor='white')
left, width = 0.25, 0.7
rect1 = [left, 0.4, width, 0.55]
rect2 = [left, 0.2, width, 0.2]
ax1 = fig.add_axes(rect1)  #left, bottom, width, height
ax2 = fig.add_axes(rect2, sharex=ax1)
ax1.plot(gp.xipol, np.log(gp.dat.nu[1]), 'k', lw=3, label='data')
ax1.plot(x, y, 'b', lw=2, label='analytic')
ax1.plot(x, modelrho(x, *popt3), 'r--', lw=2, label='fit on data')
ax1.plot(x, np.log(phys.rho(x, nropt, 1, gp)), 'g--', lw=1, label='phys.rho')
ax1.set_xscale('log')
plt.setp(ax1.get_xticklabels(), visible=False)