Ejemplo n.º 1
0
fc = np.zeros(rms.size)
fc[cc] = (rms - rms_o)[cc]
b = B

#++++++++++++++++++++++++++++++++++++++++++++++++ figura
fig = figure(1, figsize=(6, 3.))
ax = fig.add_subplot(111)
#ax1     = ax.twinx()
#--- plot der
#ax1.plot(t[1:-1], fc[1:-1], c='gray')      # rmsB
#ax1.plot(t[1:-1], b[1:-1], c='gray')       # B field

tau, bp = 2.36, 0.0
q, off, bo = -9.373, 0.89, 16.15

ncr = ff.nCR2([t, fc, b], tau, q, off, bp, bo)
sqr = np.nanmean(np.power(crs - ncr, 2.0))

#--- plot izq
ax.plot(org_t, org_crs, '-o', c='gray', ms=3)
ax.plot(t, ncr, '-', c='red', lw=5, alpha=0.8, label='$\\tau=%3.3g$' % tau)

#++++ region sheath (naranja)
trans = transforms.blended_transform_factory(ax.transData, ax.transAxes)
rect1 = patches.Rectangle((0., 0.),
                          width=1,
                          height=1,
                          transform=trans,
                          color='orange',
                          alpha=0.3)
ax.add_patch(rect1)
Ejemplo n.º 2
0
fc = np.zeros(rms.size)
fc[cc] = (rms - rms_o)[cc]

#tau = 3.0
#ncr = nCR2([t, fc], tau, q)

#++++++++++++++++++++++++++++++++++++++++++++++++ figura
fig = figure(1, figsize=(6, 4))
ax0 = fig.add_subplot(111)
ax1 = ax0.twinx()
#--- plot der
#ax1.plot(t[1:-1], fc[1:-1], c='gray')

for tau in (4.0, 14.2, 7.14):  #, 4.0):
    #ncr     = ff.func_nCR([t, fc], 0.0, tau, q)
    ncr = ff.nCR2([t, fc], tau, q)
    sqr = np.nanmean(np.power(crs - ncr, 2.0))
    print sqr
    #--- plot izq
    ax0.plot(t, ncr, lw=3, label='$\\tau=%3.3g$' % tau)

ax0.plot(t, crs, '-o', c='k', ms=3)
ax0.axhline(y=0.0, c='g')
ax0.axvline(x=0, ls='--', c='gray', lw=3)
ax0.axvline(x=1, ls='--', c='gray', lw=3)
ax0.axvline(x=4, ls='--', c='gray', lw=3)
ax0.legend()
ax0.grid()
ax0.set_ylabel('n_CR  [%]')
ax0.set_xlim(-2, +7)
ax0.set_ylim(-4, +2.)
Ejemplo n.º 3
0
fo = h5(fname_out, 'w')
for pname in fit.par.keys():
    fo[pname] = fit.par[pname]
#--- guardamos la grilla de exploracion
fo['grids/tau'] = [tau.min, tau.max, tau.delta(), tau.n]
fo['grids/q'] = [q.min, q.max, q.delta(), q.n]
fo['grids/off'] = [off.min, off.max, off.delta(), off.n]
fo['grids/bp'] = [bp.min, bp.max, bp.delta(), bp.n]
fo['grids/bo'] = [bo.min, bo.max, bo.delta(), bo.n]
#------------------

#++++++++++++++++++++++++++++++++++++++++++++++++ figura
fig = figure(1, figsize=(6, 3.))
ax = fig.add_subplot(111)

ncr = ff.nCR2([t, fc, b], **fit.par)
sqr = np.nanmean(np.square(crs - ncr))

#--- plot izq
ax.plot(org_t, org_crs, '-o', c='gray', ms=3)
ax.plot(t,
        ncr,
        '-',
        c='red',
        lw=5,
        alpha=0.8,
        label='$\\{tau:3.3g}$'.format(**fit.par))

#++++ region sheath (naranja)
trans = transforms.blended_transform_factory(ax.transData, ax.transAxes)
rect1 = patches.Rectangle((0., 0.),
Ejemplo n.º 4
0
    slice(off.min, off.max, off.delta()),
    slice(bp.min, bp.max, bp.delta()),
    slice(bo.min, bo.max, bo.delta()),
)
#--- start && run the fitter
data = np.array([t, fc, crs, b], dtype=np.float32)
sems = np.array([tau_, q_, off_, bp_, bo_], dtype=np.int)
fit = cf.fit_forbush(data, sems)
par = fit.make_fit_brute(rranges)
print par  # resultado

#++++++++++++++++++++++++++++++++++++++++++++++++ figura
fig = figure(1, figsize=(6, 3.))
ax = fig.add_subplot(111)

ncr = ff.nCR2([t, fc, b], **par)
sqr = np.nanmean(np.square(crs - ncr))

#--- plot izq
ax.plot(org_t, org_crs, '-o', c='gray', ms=3)
ax.plot(t,
        ncr,
        '-',
        c='red',
        lw=5,
        alpha=0.8,
        label='$\\{tau:3.3g}$'.format(**par))

#++++ region sheath (naranja)
trans = transforms.blended_transform_factory(ax.transData, ax.transAxes)
rect1 = patches.Rectangle((0., 0.),