GithubHelp home page GithubHelp logo

bluesky / bluesky-adaptive Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 9.0 615 KB

Reference implementation for tightly integrated adaptive scans.

License: BSD 3-Clause "New" or "Revised" License

Python 99.17% Dockerfile 0.51% Shell 0.32%

bluesky-adaptive's Introduction

CI Coverage PyPI License

Bluesky โ€” An Experiment Specification & Orchestration Engine

Source https://github.com/bluesky/bluesky
PyPI pip install bluesky
Documentation https://bluesky.github.io/bluesky
Releases https://github.com/bluesky/bluesky/releases

Bluesky is a library for experiment control and collection of scientific data and metadata. It emphasizes the following virtues:

  • Live, Streaming Data: Available for inline visualization and processing.
  • Rich Metadata: Captured and organized to facilitate reproducibility and searchability.
  • Experiment Generality: Seamlessly reuse a procedure on completely different hardware.
  • Interruption Recovery: Experiments are "rewindable," recovering cleanly from interruptions.
  • Automated Suspend/Resume: Experiments can be run unattended, automatically suspending and resuming if needed.
  • Pluggable I/O: Export data (live) into any desired format or database.
  • Customizability: Integrate custom experimental procedures and commands, and get the I/O and interruption features for free.
  • Integration with Scientific Python: Interface naturally with numpy and Python scientific stack.

Bluesky Documentation.

The Bluesky Project enables experimental science at the lab-bench or facility scale. It is a collection of Python libraries that are co-developed but independently useful and may be adopted a la carte.

Bluesky Project Documentation.

See https://bluesky.github.io/bluesky for more detailed documentation.

bluesky-adaptive's People

Contributors

danielballan avatar dmgav avatar jklynch avatar maffettone avatar padraic-shafer avatar tacaswell avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bluesky-adaptive's Issues

ENH: K-d tree based adjudicator for redundant points in discretized space.

Expected Behavior

It is commonly needed to split space up by the resolution of the measurement/device. Binning is not a completely effective way to do this, as two neighboring points can be in different bins.

Current Behavior

Current redundant adjudicators are built off hashing approaches that will consider similar, but not identical, points in a space unique.

Possible Solution

Use https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.KDTree.html instead of hashing.

Assumption of sorting data for sklearn agents is too strong.

Decomposition general preforms stronger and appears more intuitive if the data is sorted. The current assumptions for DecompositionAgentBase
and [for ClusterAgentBase] will also only work for 1-d independent data.

Expected Behavior

  • Work for n-d independent vars
  • Potentially don't sort for clustering?

Current Behavior

Sorting higher dims causes value errors.

Possible Solution

partial solution for 2D that needs extension:

try:
    sorted_independents, sorted_observables = zip(
        *sorted(zip(self.independent_cache, self.observable_cache))
    )
except ValueError:
    # Multidimensional case
    sorted_independents, sorted_observables = zip(
        *sorted(zip(self.independent_cache, self.observable_cache), key=lambda x: (x[0][0], x[0][1]))
    )

Agent base class is out of date with Tiled

The abstract base classes for Agents utilize the deprecated Node feature of Tiled.

Expected Behavior

Expect adaptive agent base classes to be interoperable with current version of tiled and/or have tiled as an optional dependency to allow for 'closed loop' control flow experiments to utilize them.

Current Behavior

Current agent base class utilizes the deprecated Node object in tiled.

Proposed Solution

Update code to rely on the current Container structure instead.

Context

Currently building a bluesky-adatpive dependent framework to control ALS's MAESTRO beamline and cannot leverage current code without this change.

Restore intersphinx in docs config

#21 removed the interphinx extension because it was failing with miss-configured external references. The task is

  1. restore using intersphinx
  2. fix the URLs for any inventories we need

Tiled deprecation in type hints

tiled.client.node.Node should be changed to tiled.client.container.Container
https://github.com/bluesky/tiled/blob/ecc232b86a17f48509f89ed6fc94076bb6c55bd3/tiled/client/node.py#L3-L8

Current Behavior

    179 class Agent(ABC):
    180     """Abstract base class for a single plan agent. These agents should consume data, decide where to measure next,
    181     and execute a single type of plan (something akin to move and count).
    182     Alternatively, these agents can be used for soley reporting.
   (...)
    242         For example, this could be a beamline three letter acronym or other distinct key.
    243     """
    245     def __init__(
    246         self,
    247         *,
    248         kafka_consumer: AgentConsumer,
--> 249         tiled_data_node: tiled.client.node.Node,
    250         tiled_agent_node: tiled.client.node.Node,
    251         qserver: API_Threads_Mixin,
    252         kafka_producer: Optional[Publisher],
    253         agent_run_suffix: Optional[str] = None,
    254         metadata: Optional[dict] = None,
    255         ask_on_tell: Optional[bool] = True,
    256         direct_to_queue: Optional[bool] = True,
    257         report_on_tell: Optional[bool] = False,
    258         default_report_kwargs: Optional[dict] = None,
    259         queue_add_position: Optional[Union[int, Literal["front", "back"]]] = None,
    260         endstation_key: Optional[str] = "",
    261     ):
    262         logger.debug("Initializing agent.")
    263         self.kafka_consumer = kafka_consumer

AttributeError: module 'tiled.client' has no attribute 'node'

Possible Solution

Find and replace

Your Environment

2024-1.0-py310-tiled

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.