Skip to content

Commit

Permalink
update travis yml
Browse files Browse the repository at this point in the history
  • Loading branch information
jtwhite79 committed Jul 29, 2019
1 parent c796193 commit c65b645
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 15 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ matrix:
env: TEST_SCRIPT="smoother_tests.py"
- name: "full meal deal tests"
env: TEST_SCRIPT="full_meal_deal_tests.py"
- name: "plot tests"
env: TEST_SCRIPT="plot_tests.py"



Expand Down Expand Up @@ -63,7 +65,7 @@ before_install:
- ln -fs /usr/bin/g++-6 "$HOME/.local/bin/g++" && g++ --version
- ls -l /usr/bin/g++-6
- export CXX="g++"
- git clone -b develop --depth 1 https://github.com/jtwhite79/pestpp
- git clone -b develop --depth 1 https://github.com/usgs/pestpp
- cd pestpp/src
- bindir=../../../../bin/linux COMPILER=gcc CXX=g++ FC=gfortran STATIC=no make -j 20 install
- cd ../../
Expand Down
42 changes: 28 additions & 14 deletions autotest/full_meal_deal_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


mf_exe_name = os.path.join(bin_path,"mfnwt")
pp_exe_name = os.path.join(bin_path, "pestpp-inv")
pp_exe_name = os.path.join(bin_path, "pestpp-glm")
ies_exe_name = os.path.join(bin_path, "pestpp-ies")
swp_exe_name = os.path.join(bin_path, "pestpp-swp")

Expand All @@ -28,7 +28,7 @@ def freyberg_test():
import pandas as pd
try:
import flopy
except:
except Exception as e:
return
import pyemu

Expand Down Expand Up @@ -105,9 +105,13 @@ def freyberg_test():
ph.pst.control_data.noptmax = 1
ph.pst.write(os.path.join(new_model_ws, "test.pst"))
master_dir = "test_master"
pyemu.os_utils.start_slaves(new_model_ws,ies_exe_name,"test.pst",
num_slaves=10,slave_root='.',
master_dir=master_dir,silent_master=True)
pyemu.os_utils.start_workers(new_model_ws,ies_exe_name,"test.pst",
num_workers=10,worker_root='.',
master_dir=master_dir,silent_master=False)
pyemu.os_utils.start_slaves(new_model_ws, ies_exe_name, "test.pst",
num_slaves=10,slave_root='.',
master_dir=master_dir, silent_master=False)

df = pd.read_csv(os.path.join(master_dir,"test.phi.meas.csv"),index_col=0)
init_phi = df.loc[0,"mean"]
final_phi = df.loc[1,"mean"]
Expand All @@ -116,11 +120,12 @@ def freyberg_test():

def fake_run_test():
import os
import numpy as np
import pyemu
new_model_ws = "template1"
if not os.path.exists(new_model_ws):
freyberg_test()
pst = pyemu.Pst(os.path.join(new_model_ws,"test.pst"))
pst = pyemu.Pst(os.path.join(new_model_ws,"freyberg.pst"))
pst.pestpp_options["ies_num_reals"] = 10
pst.pestpp_options["ies_par_en"] = "par_en.csv"
pst.control_data.noptmax = 0
Expand All @@ -130,7 +135,16 @@ def fake_run_test():

new_cwd = "fake_test"
pst = pyemu.helpers.setup_fake_forward_run(pst, "fake.pst", org_cwd=new_model_ws,new_cwd=new_cwd)
pyemu.os_utils.run("{0} {1}".format(pp_exe_name, "fake.pst"), cwd=new_cwd)
s = pst.process_output_files(new_cwd)
if s is not None:
assert s.dropna().shape[0] == pst.nobs
obs = pst.observation_data

diff = (100 * (obs.obsval - s.obsval) / obs.obsval).apply(np.abs)

print(diff)
print(obs.loc[diff>0.0,"obsval"],s.loc[diff>0.0,"obsval"])
assert diff.sum() < 1.0e-3,diff.sum()
pyemu.os_utils.run("{0} {1}".format(ies_exe_name, "fake.pst"), cwd=new_cwd)


Expand All @@ -142,7 +156,7 @@ def freyberg_kl_pp_compare():
import pandas as pd
try:
import flopy
except:
except Exception as e:
return
import pyemu

Expand Down Expand Up @@ -214,7 +228,7 @@ def freyberg_kl_pp_compare():
ph.pst.parameter_data.loc[ph.pst.parameter_data.pargp == "pp_hk0", "partrans"] = "fixed"
ph.pst.write(os.path.join(new_model_ws, "pest_kl.pst"))

pyemu.os_utils.start_slaves(new_model_ws,"pestpp-ies","pest_pp.pst", num_slaves=10,slave_root='.',
pyemu.os_utils.start_workers(new_model_ws,"pestpp-ies","pest_pp.pst", num_workers=10,worker_root='.',
master_dir="pest_pp")


Expand All @@ -225,7 +239,7 @@ def run_sweep_test():
import pandas as pd
try:
import flopy
except:
except Exception as e:
return
import pyemu

Expand Down Expand Up @@ -282,7 +296,7 @@ def run_sweep_test():
pe = ph.draw(20)
bd = os.getcwd()
try:
oe = pe.run(slave_dir=new_model_ws)
oe = pe.run(worker_dir=new_model_ws)
print(oe.shape)
except Exception as e:
os.chdir(bd)
Expand All @@ -291,7 +305,7 @@ def run_sweep_test():
mc = pyemu.MonteCarlo(pst=ph.pst)
mc.draw(20)
try:
mc.run(slave_dir=new_model_ws)
mc.run(worker_dir=new_model_ws)

except Exception as e:
os.chdir(bd)
Expand All @@ -301,8 +315,8 @@ def run_sweep_test():


if __name__ == "__main__":
freyberg_test()
#freyberg_test()
#freyberg_kl_pp_compare()
#import shapefile
#run_sweep_test()
#fake_run_test()
fake_run_test()
Binary file modified bin/.DS_Store
Binary file not shown.
Binary file modified bin/linux/.DS_Store
Binary file not shown.

0 comments on commit c65b645

Please sign in to comment.