예제 #1
0
def single_layer_dpp():
    """Create objects for a single-layer D'' model.

    Returns:
        SeismicModel: reference model
        ModelParameters: model parameters
        dict: range dict

    """
    # model parameters
    model_ref = ak135_lin_dpp()
    types = [ParameterType.VSH, ParameterType.RADIUS]
    radii = np.array([3479.5, 3679.5])
    model_params = ModelParameters(types, radii, mesh_type='lininterp')

    # Defines constraints to model parameters
    mask_dict = dict()
    mask_dict[ParameterType.VSH] = np.ones(model_params._n_grd_params,
                                           dtype='bool')
    mask_dict[ParameterType.RADIUS] = np.ones(model_params._n_grd_params,
                                              dtype='bool')
    mask_dict[ParameterType.RADIUS][[0, 1]] = False

    equal_dict = dict()
    equal_dict[ParameterType.VSH] = np.arange(model_params._n_grd_params,
                                              dtype='int')
    equal_dict[ParameterType.VSH][2] = 0
    equal_dict[ParameterType.VSH][3] = 1

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

    model_params.set_constraints(mask_dict=mask_dict,
                                 equal_dict=equal_dict,
                                 discon_arr=discon_arr)

    # Defines value range for model parameters
    delta_dict = {ParameterType.VSH: 0.5, ParameterType.RADIUS: 190.}
    range_dict = get_range_dict(model_params, delta_dict)

    return model_ref, model_params, range_dict
예제 #2
0
        model_params.get_n_grd_params(), dtype='bool')
# fix VSH and VSV for the shallowest node (grd_param index -2 and -1)
for p_type in [ParameterType.VSH, ParameterType.VSV]:
    mask_dict[p_type][[-2, -1]] = False
# fix the radius of the deepest node (grd_param index 0 and 1)
# (the CMB radius)
mask_dict[ParameterType.RADIUS][[0, 1]] = False

discon_arr = np.zeros(
    model_params.get_n_nodes(), dtype='bool')
# allows discontinuity at the middle node (node index 1)
# this represent the D" discontinuity
discon_arr[1] = True

model_params.set_constraints(
    mask_dict=mask_dict,
    discon_arr=discon_arr)

# parameter ranges
range_dict = dict()
for p_type in model_params.get_types():
    range_arr = np.empty((model_params.get_n_grd_params(), 2), dtype='float')
    if p_type != ParameterType.RADIUS:
        range_arr[:, 0] = -0.5
        range_arr[:, 1] = 0.5
    else:
        range_arr[:, 0] = -100
        range_arr[:, 1] = 100
    range_dict[p_type] = range_arr

# dataset