Ly_contours=L) if __name__ == "__main__": # Solvers α = .9 # α = .000000001 α = .8 dt = -np.log(α) solver_cbs = solvers.CbsSolver( dt=dt, # dt=.2, # frac_min=45/100, # frac_max=50/100, # dt=.02, parallel=True, beta=beta, dirname=m.__name__ + f"/test-simulation", # adaptive=False, adaptive=True, # dirname=m.__name__ + f"/simulation-{isimul}", opti=True) solver, plot_step = solver_cbs, 1 vec = L * np.ones(m.n) # ensembles = -vec + 2*vec*np.random.rand(J, m.n) ensembles = 3 * np.random.randn(J, m.n) niters = 80 # # plt.savefig(f"figures/{m.__name__}.png")
matplotlib.rc('font', size=20) matplotlib.rc('font', family='serif') matplotlib.rc('text', usetex=True) matplotlib.rc('figure', figsize=(14, 8)) matplotlib.rc('savefig', bbox='tight') matplotlib.rc('figure.subplot', hspace=.0) matplotlib.rc('figure.subplot', wspace=.03) # Solvers α = .8 solver_cbs = solvers.CbsSolver( dt=-np.log(α), # frac_min=50/100, # frac_max=55/100, parallel=True, beta=.5, adaptive=False, dirname=m.__name__, opti=False) if __name__ == "__main__": # Plots plotter = m.Plotter(m.ip, show_weights=True, adapt_size=True, contours=True, Lx=1, Ly=1, Lx_contours=5, Ly_contours=40) # Number of particles J = 1000 # ensembles_x = np.random.randn(J)
import matplotlib.pyplot as plt # Forward model and solver import solvers import model_elliptic_2d_constrained as m # Set seed to zero np.random.seed(0) # plotter = m.AllCoeffsPlotter(m.ip, show_weights=True) # plotter = m.MainModesPlotter(m.ip, show_weights=True) plotter = m.AllCoeffsPlotter(m.ip) solver_cbs = solvers.CbsSolver(dt=np.inf, parallel=True, adaptive=True, opti=True, dirname=m.__name__) solver_cbo = solvers.CboSolver(dt=.1, parallel=True, beta=100, lamda=1, sigma=.3, dirname=m.__name__ + "_small_epsilon", epsilon=.5) solver_eks = solvers.EksSolver(dt=10, reg=True, noise=True, parallel=True,
import numpy as np import matplotlib.pyplot as plt import scipy.linalg as la # Forward model and solver import model_elliptic_1d as m import solvers # Solvers solver_cbs = solvers.CbsSolver(dt=1, frac_min=50 / 100, frac_max=55 / 100, parallel=True, adaptive=True, dirname=m.__name__, opti=False) solver_cbo = solvers.CboSolver(dt=.1, parallel=True, adaptive=True, beta=1, lamda=1, sigma=.1, dirname=m.__name__) solver_eks = solvers.EksSolver(dt=1, reg=True, noise=True, parallel=True, adaptive=True, dirname=m.__name__)
import numpy as np import matplotlib.pyplot as plt # Forward model and solver import model_ackley as m import solvers # Set seed to zero np.random.seed(0) # Solvers solver_cbs = solvers.CbsSolver(dt=np.inf, parallel=True, beta=1, adaptive=False, dirname=m.__name__, opti=True) solver_cbo = solvers.CboSolver(dt=.005, parallel=True, adaptive=False, beta=1000, lamda=1, sigma=.1, dirname=m.__name__, epsilon=1) solver_eks = solvers.EksSolver(dt=.01, dt_max=10, reg=True, noise=False,
Ly=.01, Lx_contours=3, Ly_contours=3) nsimul = 10 if __name__ == "__main__": for isimul in range(nsimul): # Solvers solver_cbs = solvers.CbsSolver( dt=np.inf, # dt=.02, parallel=True, beta=beta, adaptive=True, dirname=m.__name__ + f"/adaptive-simulation-{isimul}", # adaptive=False, # dirname=m.__name__ + f"/simulation-{isimul}", opti=True) spread = 4 ensembles_x = spread * (np.random.randn() + np.random.randn(J)) ensembles_y = spread * (np.random.randn() + np.random.randn(J)) ensembles = np.vstack((ensembles_x, ensembles_y)).T solver, plot_step = solver_cbs, 1 for i in range(n_iter): print("Iteration {:04d}".format(i)) data = solver.step(m.op, ensembles,