Skip to content

Commit

Permalink
maint: disregard bluesky-adaptvie source
Browse files Browse the repository at this point in the history
  • Loading branch information
maffettone committed Feb 6, 2025
1 parent fcad132 commit b592831
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
7 changes: 0 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ requires-python = ">=3.9"
dependencies = [
"area-detector-handlers",
"bluesky",
"bluesky-adaptive[all]",
"botorch",
"databroker",
"gpytorch",
Expand Down Expand Up @@ -73,12 +72,6 @@ dev = [
"pandoc",
"sphinx-copybutton",
"sphinx_rtd_theme",
"databroker[all]>=2.0.0b1",
"bluesky_tiled_plugins",
"humanize",
"fastapi",
"caproto",
"json-rpc",
]


Expand Down
22 changes: 20 additions & 2 deletions src/blop/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pathlib
import time as ttime
import warnings
from abc import ABC, abstractmethod
from collections import OrderedDict
from collections.abc import Mapping
from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union
Expand All @@ -16,9 +17,7 @@
import numpy as np
import pandas as pd
import scipy as sp
import tiled.client.node # noqa: F401
import torch
from bluesky_adaptive.agents.base import Agent as BlueskyAdaptiveBaseAgent
from botorch.acquisition.objective import ScalarizedPosteriorTransform
from botorch.models.deterministic import GenericDeterministicModel
from botorch.models.model_list_gp_regression import ModelListGP
Expand Down Expand Up @@ -64,6 +63,25 @@ def _validate_dofs_and_objs(dofs: DOFList, objs: ObjectiveList):
)


class BlueskyAdaptiveBaseAgent(ABC):
"""Placeholder for inheritance for clarity, while bluesky-adaptive deps is a moving target.
E.g. some versions of databroker v2 will break the current implementation.
"""

@abstractmethod
def measurement_plan(self, point: ArrayLike) -> Tuple[str, List, dict]: ...

@staticmethod
@abstractmethod
def unpack_run(run) -> Tuple[Union[float, ArrayLike], Union[float, ArrayLike]]: ...

@abstractmethod
def tell(self, x, y) -> Dict[str, ArrayLike]: ...

@abstractmethod
def ask(self, batch_size: int) -> Tuple[Sequence[Dict[str, ArrayLike]], Sequence[ArrayLike]]: ...


class BaseAgent:
def __init__(
self,
Expand Down

0 comments on commit b592831

Please sign in to comment.