Beispiel #1
0
  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))
for irun in range(len(vec_run)):
    pdf_error[irun, :] = np.linalg.norm(pdf_m[irun, :] - pdf_m[-1, :], 2)
Beispiel #2
0
 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 = 21