Skip to content

Commit

Permalink
pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Morris committed Apr 18, 2024
1 parent 3ad3a0e commit 97c7244
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/blop/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -12,7 +13,6 @@
from blop.dofs import BrownianMotion
from blop.utils import functions

import numpy as np

@pytest.fixture(scope="function")
def db():
Expand Down Expand Up @@ -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

Expand All @@ -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)),
Expand Down
3 changes: 3 additions & 0 deletions src/blop/tests/test_pareto.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 97c7244

Please sign in to comment.