# initialize beta and beta/alpha_s schedule beta = directives.BetaEstimate_ByEig(beta0_ratio=1e-4) betaIt = directives.PGI_BetaAlphaSchedule( verbose=True, coolingFactor=2.0, tolerance=0.2, progress=0.2, ) # geophy. and petro. target misfits targets = directives.MultiTargetMisfits( verbose=True, chiSmall=0.5, # ask for twice as much clustering (target value is /2) ) # add learned mref in smooth once stable MrefInSmooth = directives.PGI_AddMrefInSmooth( wait_till_stable=True, verbose=True, ) # update the parameters in smallness (L2-approx of PGI) update_smallness = directives.PGI_UpdateParameters( update_gmm=True, # update the GMM each iteration kappa=np.c_[ # confidences in each mean phys. prop. of each cluster 1e10 * np.ones( 2 ), # fixed background at 0 density, 0 mag. susc. (high confidences of 1e10) [ 0, 1e10, ], # density-contrasting cluster: updatable density mean, fixed mag. susc. [ 1e10, 0,
invProb = inverse_problem.BaseInvProblem(dmis, reg, opt) # directives Alphas = directives.AlphasSmoothEstimate_ByEig(alpha0_ratio=10.0, verbose=True) beta = directives.BetaEstimate_ByEig(beta0_ratio=1e-6) betaIt = directives.PGI_BetaAlphaSchedule( verbose=True, coolingFactor=2.0, warmingFactor=1.0, tolerance=0.1, update_rate=1, progress=0.2, ) targets = directives.MultiTargetMisfits(verbose=True) petrodir = directives.PGI_UpdateParameters() addmref = directives.PGI_AddMrefInSmooth(verbose=True) # Setup Inversion inv = inversion.BaseInversion( invProb, directiveList=[Alphas, beta, petrodir, targets, addmref, betaIt]) # Initial model same as for Tikhonov mcluster = inv.run(m0) # Final Plot fig, axes = plt.subplots(1, 3, figsize=(12 * 1.2, 4 * 1.2)) for i in range(prob.G.shape[0]): axes[0].plot(prob.G[i, :]) axes[0].set_title("Columns of matrix G") axes[1].hist(mtrue, bins=20, linewidth=3.0, density=True, color="k")