Пример #1
0
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import numpy as np
from mpi4py import MPI
import os
import sys

comm = MPI.COMM_WORLD
n_core = comm.Get_size()
rank = comm.Get_rank()

result = InversionResult.load(sys.argv[1])
loaded = True

free_indices = [0, 3]
model_ref, _ = work_parameters.get_model_lininterp(0, 0, 0, 2)
types = [ParameterType.VSH, ParameterType.RADIUS]

figscale = 0.8

# compute best models
if rank == 0:
    indices_better = [0]
    for imod in range(1, result.meta['n_mod']):
        i_best = result.get_indices_best_models(n_best=1, n_mod=imod+1)
        if i_best != indices_better[-1]:
            indices_better.append(imod)
    models = [result.models[i] for i in indices_better]
else:
    models = None
outputs = result.compute_models(models)
Пример #2
0
comm = MPI.COMM_WORLD
n_core = comm.Get_size()
rank = comm.Get_rank()

input_file = sys.argv[1]

# model parameters
types = [ParameterType.VSH, ParameterType.VSV]
n_upper_mantle = 0
n_mtz = 0
n_lower_mantle = 0
n_dpp = 2
model_ref, model_params = work_parameters.get_model_lininterp(
    n_upper_mantle,
    n_mtz,
    n_lower_mantle,
    n_dpp,
    types,
    verbose=0,
    discontinuous=True)

# constraints to parameters
mask_dict = dict()
mask_dict[ParameterType.VSH] = np.ones(model_params.get_n_grd_params(),
                                       dtype='bool')
mask_dict[ParameterType.VSV] = np.ones(model_params.get_n_grd_params(),
                                       dtype='bool')

equal_dict = dict()
for param_type in types:
    equal_dict[param_type] = np.arange(model_params.get_n_grd_params(),
                                       dtype='int')
Пример #3
0
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import numpy as np
from mpi4py import MPI
import os
import sys

comm = MPI.COMM_WORLD
n_core = comm.Get_size()
rank = comm.Get_rank()

input_file = sys.argv[1]

# model parameters
types = [ParameterType.VSH, ParameterType.RADIUS]
model_ref, model_params = work_parameters.get_model_lininterp(
    types=types, verbose=0, discontinuous=True)

# constraints to parameters
mask_dict = dict()
mask_dict[ParameterType.VSH] = np.ones(
    model_params.get_n_grd_params(), dtype='bool')
mask_dict[ParameterType.RADIUS] = np.zeros(
    model_params.get_n_grd_params(), dtype='bool')
mask_dict[ParameterType.VSH][[0, 1]] = False
mask_dict[ParameterType.VSH][[-1, -2]] = False
mask_dict[ParameterType.RADIUS][[i for i in range(4, 10)]] = True

discon_arr = np.zeros(
    model_params._n_nodes, dtype='bool')
discon_arr[2] = True
discon_arr[4] = True