Пример #1
0
    def test_inv(self):
        reg = regularization.Tikhonov(self.mesh)
        opt = optimization.InexactGaussNewton(maxIter=10, use_WolfeCurvature=True)
        invProb = inverse_problem.BaseInvProblem(self.dmiscombo, reg, opt)
        directives_list = [
            directives.ScalingMultipleDataMisfits_ByEig(verbose=True),
            directives.AlphasSmoothEstimate_ByEig(verbose=True),
            directives.BetaEstimate_ByEig(beta0_ratio=1e-2),
            directives.MultiTargetMisfits(TriggerSmall=False),
            directives.BetaSchedule(),
        ]
        inv = inversion.BaseInversion(invProb, directiveList=directives_list)
        m0 = self.model.mean() * np.ones_like(self.model)

        mrec = inv.run(m0)
Пример #2
0
    def test_inv_mref_setting(self):
        reg1 = regularization.Tikhonov(self.mesh)
        reg2 = regularization.Tikhonov(self.mesh)
        reg = reg1 + reg2
        opt = optimization.ProjectedGNCG(
            maxIter=30, lower=-10, upper=10, maxIterLS=20, maxIterCG=50, tolCG=1e-4
        )
        invProb = inverse_problem.BaseInvProblem(self.dmiscombo, reg, opt)
        directives_list = [
            directives.ScalingMultipleDataMisfits_ByEig(
                chi0_ratio=[0.01, 1.0], verbose=False
            ),
            directives.AlphasSmoothEstimate_ByEig(verbose=False),
            directives.BetaEstimate_ByEig(beta0_ratio=1e-2),
            directives.MultiTargetMisfits(TriggerSmall=False, verbose=True),
            directives.BetaSchedule(),
        ]
        inv = inversion.BaseInversion(invProb, directiveList=directives_list)
        m0 = self.model.mean() * np.ones_like(self.model)

        mrec = inv.run(m0)

        self.assertTrue(np.all(reg1.mref == m0))
        self.assertTrue(np.all(reg2.mref == m0))
Пример #3
0
alpha0_ratio = np.r_[np.zeros(len(reg.objfcts[0].objfcts)),
                     1e-2 * np.ones(len(reg.objfcts[1].objfcts)),
                     1e-2 * 100.0 * np.ones(len(reg.objfcts[2].objfcts)), ]
Alphas = directives.AlphasSmoothEstimate_ByEig(alpha0_ratio=alpha0_ratio,
                                               verbose=True)
# 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,
# Add directives to the inversion
# ratio to use for each phys prop. smoothness in each direction;
# roughly the ratio of the order of magnitude of each phys. prop.
alpha0_ratio = np.r_[
    np.zeros(len(reg.objfcts[0].objfcts)),
    1e-4 * np.ones(len(reg.objfcts[1].objfcts)),
    100.0 * 1e-4 * np.ones(len(reg.objfcts[2].objfcts)),
]
Alphas = directives.AlphasSmoothEstimate_ByEig(alpha0_ratio=alpha0_ratio, verbose=True)
# initialize beta and beta/alpha_s schedule
beta = directives.BetaEstimate_ByEig(beta0_ratio=1e-2)
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,)
# 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=False  # keep GMM model fixed
)
# pre-conditioner
update_Jacobi = directives.UpdatePreconditioner()
# iteratively balance the scaling of the data misfits
scaling_init = directives.ScalingMultipleDataMisfits_ByEig(chi0_ratio=[1.0, 100.0])
scale_schedule = directives.JointScalingSchedule(verbose=True)

# Create inverse problem
# Optimization
# set lower and upper bounds
Пример #5
0
                                                     verbose=True,
                                                     n_pw_iter=10)
scaling_schedule = directives.JointScalingSchedule(verbose=True)
alpha0_ratio = np.r_[np.zeros(len(reg_simple.objfcts[0].objfcts)),
                     100.0 * np.ones(len(reg_simple.objfcts[1].objfcts)),
                     1.0 * np.ones(len(reg_simple.objfcts[2].objfcts)), ]
alphas = directives.AlphasSmoothEstimate_ByEig(alpha0_ratio=alpha0_ratio,
                                               n_pw_iter=10,
                                               verbose=True)
beta = directives.BetaEstimate_ByEig(beta0_ratio=1e-5, n_pw_iter=10)
betaIt = directives.PGI_BetaAlphaSchedule(
    verbose=True,
    coolingFactor=2.0,
    progress=0.2,
)
targets = directives.MultiTargetMisfits(verbose=True)
petrodir = directives.PGI_UpdateParameters(update_gmm=False)

# Setup Inversion
inv = inversion.BaseInversion(
    invProb,
    directiveList=[
        alphas, scales, beta, petrodir, targets, betaIt, scaling_schedule
    ],
)

mcluster_map = inv.run(minit)

# Inversion with no nonlinear mapping
reg_simple_no_map = utils.make_SimplePGI_regularization(
    mesh=mesh,