@@ -2025,6 +2025,7 @@ def tenpar_adjust_weights_test():
20252025 obs .loc [:,"standard_deviation" ] = 0.1
20262026 obs .loc [pst .obs_names [12 :],"standard_deviation" ] = 1e-11
20272027 obs .loc [pst .obs_names [12 :],"obsval" ] = 1e-9
2028+ #these values are hard coded later...
20282029 with open (os .path .join (template_d ,"phi.csv" ),'w' ) as f :
20292030 f .write ("og1,0.333333\n " )
20302031 f .write ("og3,0.333333\n " )
@@ -2044,6 +2045,29 @@ def tenpar_adjust_weights_test():
20442045 pst .pestpp_options ['ies_verbose_level' ] = 4
20452046 pst .pestpp_options ["ies_bad_phi_sigma" ] = - 1.5
20462047
2048+ pst .control_data .noptmax = 0
2049+ pst .pestpp_options ["ies_drop_conflicts" ] = False
2050+ pst .pestpp_options ["ies_phi_factor_file" ] = "phi.csv"
2051+ pst_name = "pest_adj.pst"
2052+ pst .write (os .path .join (template_d ,pst_name ),version = 2 )
2053+ if os .path .exists (test_d ):
2054+ shutil .rmtree (test_d )
2055+ shutil .copytree (template_d , test_d )
2056+ pyemu .os_utils .run ("{0} {1}" .format (exe_path , pst_name ), cwd = test_d )
2057+ pst .set_res (os .path .join (test_d ,pst_name .replace (".pst" ,".base.rei" )))
2058+ print (pst .phi_components )
2059+ obs = pst .observation_data
2060+ aobs = pd .read_csv (os .path .join (test_d ,pst_name .replace (".pst" ,".0.adjusted.obs_data.csv" )),index_col = 0 )
2061+ obs .loc [aobs .index ,"weight" ] = aobs .weight .values
2062+ print (pst .phi_components )
2063+ print (pst .phi_components_normalized )
2064+ pcn = pst .phi_components_normalized
2065+ assert np .isclose (pcn ["og3blahblah" ],0.33333 ,1e-3 )
2066+ assert np .isclose (pcn ["og4yadayada" ],0.33333 ,1e-3 )
2067+
2068+
2069+ pst .pestpp_options .pop ("ies_phi_factor_file" )
2070+
20472071
20482072 pst .control_data .noptmax = 2
20492073 pst .pestpp_options ["ies_drop_conflicts" ] = False
@@ -5007,10 +5031,48 @@ def large_invest():
50075031 pyemu .os_utils .run ("{0} pest.pst /e" .format (exe_path ),cwd = t_d )
50085032
50095033
5034+ def tenpar_xsec_combined_autoadaloc_mm_stress_test ():
5035+ """testing combined matrix + autoadaloc"""
5036+ model_d = "ies_10par_xsec"
5037+ test_d = os .path .join (model_d , "master_comb_aal_test1" )
5038+ template_d = os .path .join (model_d , "test_template" )
5039+
5040+ if not os .path .exists (template_d ):
5041+ raise Exception ("template_d {0} not found" .format (template_d ))
5042+ pst_name = os .path .join (template_d , "pest.pst" )
5043+ pst = pyemu .Pst (pst_name )
5044+
5045+ if os .path .exists (test_d ):
5046+ shutil .rmtree (test_d )
5047+ shutil .copytree (template_d , test_d )
5048+ pst .pestpp_options = {}
5049+ pst .pestpp_options ["ies_num_reals" ] = 30
5050+
5051+ mat = pyemu .Matrix .from_names (pst .nnz_obs_names , pst .adj_par_names ).to_dataframe ()
5052+ mat .loc [:, :] = 1
5053+ mat .loc [:, pst .adj_par_names [::2 ]] = 0
5054+ pyemu .Matrix .from_dataframe (mat ).to_ascii (os .path .join (template_d , "loc.mat" ))
50105055
5056+ pst .pestpp_options ["ies_localizer" ] = "loc.mat"
5057+ pst .pestpp_options ["ies_autoadaloc" ] = True
5058+ pst .pestpp_options ["ies_verbose_level" ] = 3
5059+ pst .pestpp_options ["ies_debug_fail_remainder" ] = True
5060+ pst .pestpp_options ["ies_debug_fail_subset" ] = True
5061+ pst .pestpp_options ["ies_debug_bad_phi" ] = True
5062+ pst .pestpp_options ["ies_multimodal_alpha" ] = 0.99
5063+
5064+ pst .control_data .noptmax = 3
50115065
5066+ pst .write (os .path .join (template_d , "pest_aal_restart.pst" ))
5067+ pyemu .os_utils .start_workers (template_d , exe_path , "pest_aal_restart.pst" , num_workers = 10 ,
5068+ master_dir = test_d , verbose = True , worker_root = model_d ,
5069+ port = port )
5070+
50125071
50135072if __name__ == "__main__" :
5073+ tenpar_xsec_combined_autoadaloc_mm_stress_test ()
5074+
5075+ #tenpar_adjust_weights_test()
50145076 #large_invest()
50155077 #tenpar_fixed_transform_test()
50165078 #tenpar_reg_factor_test()
@@ -5031,7 +5093,7 @@ def large_invest():
50315093 #tenpar_reg_factor_test()
50325094 #tenpar_high_phi_test()
50335095 #tenpar_iqr_bad_phi_sigma_test()
5034- multimodal_test ()
5096+ # multimodal_test()
50355097 #plot_mm1_sweep_results()
50365098 #plot_mm1_results()
50375099 #plot_mm1_results_seq()
0 commit comments