var_, corr_, ratio_ = misfits(data, syn) return (np.isfinite(var_) and np.isfinite(corr_) and np.isfinite(ratio_) and var_ <= var and corr_ >= corr and 1 / ratio <= ratio_ <= ratio) if __name__ == '__main__': types = [ParameterType.VSH] radii = [3480. + 20 * i for i in range(41)] model_params = ModelParameters(types=types, radii=radii, mesh_type='boxcar') model = SeismicModel.prem().boxcar_mesh(model_params) n_param = model_params.get_n_params() its, itypes, igrds = model_params.get_free_all_indices() order_types = [model_params.get_types()[itypes[i]] for i in its] order_radii = [model_params.get_grd_params()[igrds[i]] for i in its] # sac_files = glob.glob(os.path.join(root_sac, '*[RZT]')) # dataset = Dataset.dataset_from_sac( # sac_files, headonly=False) t_before = 20. t_after = 40. sampling_hz = 20 window_npts = int((t_before + t_after) * 20) tlen = 1638.4 nspc = 256 mode = 2 freq = 0.01 freq2 = 0.08
# (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 input = InputFile(input_file) input_params = input.read() dataset, _ = work_parameters.get_dataset_syntest_vshvsv_4( tlen=input_params['tlen'], nspc=input_params['nspc'],