From 97c724424af56dd13d569e13afb7c142b0fea63b Mon Sep 17 00:00:00 2001 From: Thomas Morris Date: Thu, 18 Apr 2024 13:45:12 -0700 Subject: [PATCH] pre-commit --- src/blop/tests/conftest.py | 12 ++++++------ src/blop/tests/test_pareto.py | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/blop/tests/conftest.py b/src/blop/tests/conftest.py index 49c046e..33d8dbc 100644 --- a/src/blop/tests/conftest.py +++ b/src/blop/tests/conftest.py @@ -2,6 +2,7 @@ import datetime import databroker +import numpy as np import pytest from bluesky.callbacks import best_effort from bluesky.run_engine import RunEngine @@ -12,7 +13,6 @@ from blop.dofs import BrownianMotion from blop.utils import functions -import numpy as np @pytest.fixture(scope="function") def db(): @@ -114,10 +114,10 @@ def digestion(db, uid): products = db[uid].table() for index, entry in products.iterrows(): - products.loc[index, "f1"] = (entry.x1 - 2)**2 + (entry.x2 - 1) + 2 - products.loc[index, "f2"] = 9 * entry.x1 - (entry.x2 - 1) + 2 - products.loc[index, "c1"] = entry.x1**2 + entry.x2**2 - products.loc[index, "c2"] = entry.x1 - 3*entry.x2 + 10 + products.loc[index, "f1"] = (entry.x1 - 2) ** 2 + (entry.x2 - 1) + 2 + products.loc[index, "f2"] = 9 * entry.x1 - (entry.x2 - 1) + 2 + products.loc[index, "c1"] = entry.x1**2 + entry.x2**2 + products.loc[index, "c2"] = entry.x1 - 3 * entry.x2 + 10 return products @@ -127,7 +127,7 @@ def digestion(db, uid): ] objectives = [ - Objective(description="f1", name="f1", target="min"), + Objective(description="f1", name="f1", target="min"), Objective(description="f2", name="f2", target="min"), Objective(description="c1", name="c1", target=(-np.inf, 225)), Objective(description="c2", name="c2", target=(-np.inf, 0)), diff --git a/src/blop/tests/test_pareto.py b/src/blop/tests/test_pareto.py index 158412e..75f1fb6 100644 --- a/src/blop/tests/test_pareto.py +++ b/src/blop/tests/test_pareto.py @@ -6,16 +6,19 @@ def test_pareto(mo_agent, RE): RE(mo_agent.learn("qr", n=16)) mo_agent.plot_pareto_front() + @pytest.mark.parametrize("acq_func", ["qnehvi"]) def test_monte_carlo_pareto_acq_funcs(mo_agent, RE, acq_func): RE(mo_agent.learn("qr", n=16)) RE(mo_agent.learn(acq_func, n=2)) + @pytest.mark.test_func def test_constrained_pareto(constrained_agent, RE): RE(constrained_agent.learn("qr", n=16)) constrained_agent.plot_pareto_front() + @pytest.mark.parametrize("acq_func", ["qnehvi"]) def test_constrained_monte_carlo_pareto_acq_funcs(constrained_agent, RE, acq_func): RE(constrained_agent.learn("qr", n=16))