def res_test(): import os import numpy as np from pyemu import Pst,pst_utils # residual functionality testing pst_dir = os.path.join("pst") p = Pst(os.path.join(pst_dir,"pest.pst")) phi_comp = p.phi_components assert "regul_p" in phi_comp assert "regul_m" in phi_comp p.adjust_weights_resfile() d = np.abs(p.phi - p.nnz_obs) assert d < 1.0E-5 p.adjust_weights(obsgrp_dict={"head": 50}) assert np.abs(p.phi_components["head"] - 50) < 1.0e-6 # get() new_p = p.get() new_p.prior_information = p.prior_information new_file = os.path.join("temp", "new.pst") new_p.write(new_file) p_load = Pst(new_file,resfile=p.resfile) for gname in p.phi_components: d = np.abs(p.phi_components[gname] - p_load.phi_components[gname]) assert d < 1.0e-5
def res_test(): import os import numpy as np from pyemu import Pst, pst_utils # residual functionality testing pst_dir = os.path.join('..', 'tests', "pst") p = Pst(os.path.join(pst_dir, "pest.pst")) phi_comp = p.phi_components assert "regul_p" in phi_comp assert "regul_m" in phi_comp p.adjust_weights_resfile() d = np.abs(p.phi - p.nnz_obs) assert d < 1.0E-5 p.adjust_weights(obsgrp_dict={"head": 50}) assert np.abs(p.phi_components["head"] - 50) < 1.0e-6 # get() new_p = p.get() new_p.prior_information = p.prior_information new_file = os.path.join(pst_dir, "new.pst") new_p.write(new_file) p_load = Pst(new_file, resfile=p.resfile) for gname in p.phi_components: d = np.abs(p.phi_components[gname] - p_load.phi_components[gname]) assert d < 1.0e-5
def reweight_test(): import os import numpy as np from pyemu import Pst, pst_utils pst_dir = os.path.join('..', 'tests', "pst") p = Pst(os.path.join(pst_dir, "pest.pst")) obsgrp_dict = {"pred": 1.0, "head": 1.0, "conc": 1.0} p.adjust_weights(obsgrp_dict=obsgrp_dict) assert np.abs(p.phi - 3.0) < 1.0e-5, p.phi obs = p.observation_data obs.loc[obs.obgnme == "pred", "weight"] = 0.0 assert np.abs(p.phi - 2.0) < 1.0e-5, p.phi obs_dict = {"pd_one": 1.0, "pd_ten": 1.0} p.adjust_weights(obs_dict=obs_dict) assert np.abs(p.phi - 4.0) < 1.0e-5, p.phi
def reweight_test(): import os import numpy as np from pyemu import Pst,pst_utils pst_dir = os.path.join("pst") p = Pst(os.path.join(pst_dir,"pest.pst")) obsgrp_dict = {"pred":1.0,"head":1.0,"conc":1.0} p.adjust_weights(obsgrp_dict=obsgrp_dict) assert np.abs(p.phi - 3.0) < 1.0e-5,p.phi obs = p.observation_data obs.loc[obs.obgnme=="pred","weight"] = 0.0 assert np.abs(p.phi - 2.0) < 1.0e-5,p.phi obs_dict = {"pd_one":1.0,"pd_ten":1.0} p.adjust_weights(obs_dict=obs_dict) assert np.abs(p.phi - 4.0) < 1.0e-5,p.phi