Exemplo n.º 1
0
  print "number of models to filter: ", "{:e}".format(nruns * popsize * niter)
  print''

  threshold = np.max(filt_energy) # np.median(filt_energy)
  m_near, f_near = pp.value_filter(filt_models, filt_energy, threshold)

  # --- > regrid parameter space
  delta_m = 1e-3 
  m_grid, f_grid, rgrid_error = pp.regrid(m_near, f_near, delta_m, center=True)
  del m_near, f_near
  print "number of particles in subgrid", "{:e}".format(m_grid.shape[0])
  print "Error in energy minimum after subgrid :", np.min(f_grid) - f_gbest
  print''

  # ---> Xi2 weighted mean model, in log and physical space
  m_weight = pp.weighted_mean(m_grid, f_grid, ndata, kappa=1, rms=True, log=True)

  # ---> Xi2 weighted STD model, in log and physical space
  std_weight = pp.weighted_std(m_weight, m_grid, f_grid, ndata, kappa=1, rms=True, log=True)

  # ---- marginal laws using RMS
  indx = indx + 1
  pdf_m[indx, :, :], n_bin, x_bin = pp.marginal_law(m_grid, f_grid, logrhosynth, ndata,
                                        n_inter=n_inter,lower=lower, upper=upper,
                                        kappa=kappa, rms=True)

# ----------------------------------------------------------------------------
# Norme L2 Error
# | pdf(nruns, iparam) - pdf(irun, ipara)|_2

pdf_error = np.empty(shape=(len(vec_run), nparam))
Exemplo n.º 2
0
# Error mcm exploration detected
np.max(np.abs(m_near - logrhosynth))

# --- > regrid parameter space
delta_m = 1e-3 
m_grid, f_grid, rgrid_error = pp.regrid(m_near, f_near, delta_m, center=True)
del m_near, f_near
print "number of particles in subgrid", "{:e}".format(m_grid.shape[0])
print "Error in energy minimum after subgrid :", np.min(f_grid) - f_gbest
print''

print "max distance between m_grid and logrhosynth :"
print np.max(np.abs(m_grid - logrhosynth))

# ---> Xi2 weighted mean model, in log and physical space
m_weight = pp.weighted_mean(m_grid, f_grid, ndata, kappa=kappa, rms=rms,
                            log=True)

# ---> Xi2 weighted STD model, in log and physical space
std_weight = pp.weighted_std(m_weight, m_grid, f_grid, ndata, kappa=kappa,
                             rms=rms, log=True)
print''

# ---- marginal laws centered around solution 
pdf_m, n_bin, x_bin = pp.marginal_law(m_grid, f_grid, logrhosynth, ndata,
                       n_inter=n_inter,lower=lower, upper=upper, kappa=kappa,
                       rms=rms)

print "check marginal law intervals and window for each parameter"
print "should be ", m_grid.shape[0]
print np.sum(n_bin, axis=1)
Exemplo n.º 3
0
print "number of models to filter: ", "{:e}".format(nruns * popsize * niter)
print''

threshold =np.max(filt_energy)# np.median(filt_energy)
m_near, f_near = pp.value_filter(filt_models, filt_energy, threshold)

# --- > regrid parameter space
delta_m = 1e-3 
m_grid, f_grid, rgrid_error = pp.regrid(m_near, f_near, delta_m, center=True)
del m_near, f_near
print "number of particles in subgrid", "{:e}".format(m_grid.shape[0])
print "Error in energy minimum after subgrid :", np.min(f_grid) - f_gbest
print''

# ---> Xi2 weighted mean model, in log and physical space
m_weight = pp.weighted_mean(m_grid, f_grid, ndata, kappa=1, rms=True, log=True)
mpow_weight = np.log10(pp.weighted_mean(m_grid, ndata, f_grid, kappa=1, rms=True, log=False))
print "Mean-difference between log and physical space :", np.max(np.abs(mpow_weight - m_weight))
print''

# ---> Xi2 weighted STD model, in log and physical space
std_weight = pp.weighted_std(m_weight, m_grid, f_grid, ndata, kappa=1, rms=True, log=True)
stdpow_weight = pp.weighted_std(10**mpow_weight, m_grid, f_grid, ndata, kappa=1, rms=True, log=False)
print "STD-difference between log and physical space :", np.max(np.abs(stdpow_weight - std_weight))
print''

# ---- marginal laws using kappa damping coefficient
n_inter = 40
lower = -2.  
upper = 2. 
kappa = 1
Exemplo n.º 4
0
threshold = np.max(filt_energy)  # np.median(filt_energy)
m_near, f_near = pp.value_filter(filt_models, filt_energy, threshold)
del filt_models, filt_energy

# --- > regrid parameter space
delta_m = 1e-3
m_grid, f_grid, rgrid_error = pp.regrid(m_near, f_near, delta_m, center=True)
del m_near, f_near
print "number of particles in subgrid", "{:e}".format(m_grid.shape[0])
print "Error in energy minimum after subgrid :", np.min(f_grid) - f_gbest

# ---> Xi2 weighted mean model, in log and physical space
m_weight = pp.weighted_mean(m_grid,
                            f_grid,
                            ndata,
                            kappa=1,
                            rms=False,
                            log=True)
mpow_weight = np.log10(
    pp.weighted_mean(m_grid, ndata, f_grid, kappa=1, rms=False, log=False))
print "Mean-difference between log and physical space :", np.max(
    np.abs(mpow_weight - m_weight))

# ---> Xi2 weighted STD model, in log and physical space
std_weight = pp.weighted_std(m_weight,
                             m_grid,
                             f_grid,
                             ndata,
                             kappa=1,
                             rms=False,
                             log=True)