Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion autotest/autotest_notebooks.py
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this notebook wrapper is no longer hit -- at some point, we should check and remove,

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


def get_notebooks():
return [f for f in os.listdir(nbdir) if f.endswith('.ipynb') and not "notest" in f]
return [f for f in os.listdir(nbdir) if f.endswith('.ipynb') and "notest" not in f]

def run_notebook(fn):
#pth = os.path.join(nbdir, fn)
Expand Down
12 changes: 10 additions & 2 deletions autotest/emulator_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
mou_exe_path = get_exe_path("pestpp-mou")

def dsi_freyberg(tmp_d,transforms=None,tag=""):
if not ies_exe_path:
pytest.skip("missing ies_exe_path")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assume we will throw a fail elsewhere in the CI if bins are missing -- might be worth checking this.


test_d = "ends_master"
test_d = setup_tmp(test_d, tmp_d)
Expand Down Expand Up @@ -92,6 +94,8 @@ def test_dsi_mixed(tmp_path):

# @pytest.mark.timeout(method="thread", timeout=1000)
def test_dsivc(tmp_path):
if not mou_exe_path:
pytest.skip("missing mou_exe_path")
# basic quick as so can re-run here
dsi_freyberg(tmp_path, transforms=None)
# now test dsicv
Expand Down Expand Up @@ -205,6 +209,7 @@ def plot_freyberg_dsi():


def lpfa_freyberg(tmp_d="temp",transforms=None):
pytest.importorskip("sklearn")

test_d = "ends_master"
test_d = setup_tmp(test_d, tmp_d)
Expand Down Expand Up @@ -331,6 +336,8 @@ def test_lpfa_std(tmp_path):


def gpr_compare_invest():
if not mou_exe_path:
pytest.skip("missing mou_exe_path")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These "invest" funcs shouldn't be collected by pytest in the first place, so the "skip" probs ineffective.

import numpy as np
from sklearn.gaussian_process import GaussianProcessRegressor
case = "zdt1"
Expand Down Expand Up @@ -492,6 +499,8 @@ def gpr_compare_invest():


def gpr_constr_invest():
if not mou_exe_path:
pytest.skip("missing mou_exe_path")
import numpy as np
from sklearn.gaussian_process import GaussianProcessRegressor
case = "constr"
Expand Down Expand Up @@ -812,14 +821,13 @@ def gpr_zdt1_test():
gpr_t_d = os.path.join(case + "_gpr_template")

data, input_names, output_names = collate_training_data(pst,m_d,case)
from pyemu.emulators.gpr import GPR
gpr = GPR(data=data.copy(),
input_names=input_names,
output_names=output_names,
#transforms=transforms,
#kernel=gp_kernel,
n_restarts_optimizer=20,
);
)
gpr.fit()
gpr.prepare_pestpp(m_d,case,gpr_t_d=gpr_t_d)

Expand Down
5 changes: 2 additions & 3 deletions autotest/en_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@ def from_parfiles_test(tmp_path):

def triangular_draw_test():
import os
import matplotlib.pyplot as plt
import pyemu

pst = pyemu.Pst(os.path.join("pst","pest.pst"))
Expand Down Expand Up @@ -577,7 +576,6 @@ def emp_cov_draw_test():

def mixed_par_draw_test():
import os
import matplotlib.pyplot as plt
import pandas as pd
import pyemu

Expand All @@ -591,6 +589,7 @@ def mixed_par_draw_test():
pe2 = pyemu.ParameterEnsemble.from_mixed_draws(pst, {},default="uniform",num_reals=num_reals)
pe3 = pyemu.ParameterEnsemble.from_mixed_draws(pst, {}, default="triangular", num_reals=num_reals)

# import matplotlib.pyplot as plt
# ax = plt.subplot(111)
# pe1.loc[:,pname].hist(ax=ax,alpha=0.5,bins=25)
# pe2.loc[:, pname].hist(ax=ax,alpha=0.5,bins=25)
Expand Down Expand Up @@ -697,7 +696,6 @@ def binary_test(tmp_path):

def mixed_par_draw_2_test():
import os
import matplotlib.pyplot as plt
import pandas as pd
import pyemu

Expand All @@ -711,6 +709,7 @@ def mixed_par_draw_2_test():
pe2 = pyemu.ParameterEnsemble.from_mixed_draws(pst, {},default="uniform",num_reals=num_reals)
pe3 = pyemu.ParameterEnsemble.from_mixed_draws(pst, {}, default="triangular", num_reals=num_reals)

# import matplotlib.pyplot as plt
# ax = plt.subplot(111)
# pe1.loc[:,pname].hist(ax=ax,alpha=0.5,bins=25)
# pe2.loc[:, pname].hist(ax=ax,alpha=0.5,bins=25)
Expand Down
6 changes: 3 additions & 3 deletions autotest/full_meal_deal_tests_ignore.py
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is also mostly legacy func testing -- at some point we should check and remove

Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def _get_port():
def freyberg_spinup(tmp_path):
try:
import flopy
except Exception as e:
except Exception:
return
import pyemu

Expand Down Expand Up @@ -248,7 +248,7 @@ def freyberg_kl_pp_compare():
import pandas as pd
try:
import flopy
except Exception as e:
except Exception:
return
import pyemu

Expand Down Expand Up @@ -319,7 +319,7 @@ def freyberg_diff_obs_test(tmp_path):
import pandas as pd
try:
import flopy
except Exception as e:
except Exception:
return
import pyemu

Expand Down
34 changes: 8 additions & 26 deletions autotest/plot_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
import numpy as np
import pandas as pd
import pyemu
import pytest


def plot_summary_test(tmp_path):

try:
import matplotlib.pyplot as plt
except:
return
plt = pytest.importorskip("matplotlib.pyplot")
par_df_fname = os.path.join("utils","freyberg_pp.par.usum.csv")
shutil.copy(par_df_fname, tmp_path)
par_df_fname = os.path.join(tmp_path, "freyberg_pp.par.usum.csv")
Expand Down Expand Up @@ -38,10 +35,7 @@ def plot_summary_test(tmp_path):


def pst_plot_test(tmp_path):
try:
import matplotlib.pyplot as plt
except:
return
plt = pytest.importorskip("matplotlib.pyplot")
pstfile = os.path.join("pst", "pest.pst")
shutil.copy(pstfile,
os.path.join(tmp_path, "pest.pst"))
Expand Down Expand Up @@ -98,10 +92,7 @@ def pst_plot_test(tmp_path):


def ensemble_plot_test(tmp_path):
try:
import matplotlib.pyplot as plt
except:
return
plt = pytest.importorskip("matplotlib.pyplot")
pstfile = os.path.join("pst", "pest.pst")
shutil.copy(pstfile,
os.path.join(tmp_path, "pest.pst"))
Expand Down Expand Up @@ -165,10 +156,7 @@ def ensemble_plot_test(tmp_path):


def ensemble_1to1_test(tmp_path):
try:
import matplotlib.pyplot as plt
except:
return
plt = pytest.importorskip("matplotlib.pyplot")
shutil.copy(os.path.join("pst","pest.pst"),
os.path.join(tmp_path, "pest.pst"))
shutil.copy(os.path.join("pst","pest.rei"),
Expand Down Expand Up @@ -259,10 +247,7 @@ def ensemble_1to1_test(tmp_path):


def ensemble_summary_test(tmp_path):
try:
import matplotlib.pyplot as plt
except:
return
plt = pytest.importorskip("matplotlib.pyplot")

shutil.copy(os.path.join("pst", "pest.pst"),
os.path.join(tmp_path, "pest.pst"))
Expand Down Expand Up @@ -295,10 +280,7 @@ def ensemble_summary_test(tmp_path):
)

# def cov_test():
# try:
# import matplotlib.pyplot as plt
# except:
# return
# plt = pytest.importorskip("matplotlib.pyplot")
#
# import os
# import numpy as np
Expand All @@ -323,7 +305,7 @@ def ensemble_summary_test(tmp_path):


def ensemble_change_test(tmp_path):
import matplotlib.pyplot as plt
plt = pytest.importorskip("matplotlib.pyplot")
os.chdir(tmp_path)
pst = pyemu.Pst.from_par_obs_names(par_names=["p1","p2"])
cov = pyemu.Cov(np.array([[1.0,0.0],[0.0,1.0]]),names=["p1","p2"])
Expand Down
Loading
Loading