Support being able to configure baseline data with DeviceManager

Ouverte
#1,784 6 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 2 jours

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
56/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
python
Domaine
backend

Piste de recherche

Start by reading DeviceManager and BlueskyContext, which the issue identifies as the integration points; compare how BlueskyContext currently creates its RunEngine with the proposed DeviceManager-provided configuration. Check the existing tests for those components and add coverage for applying baseline metadata to runs. Done means a configured RunEngine can add baseline metadata to each run through Blueapi.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

c: context enhancement needs investigation

Within Bluesky, you are able to record baseline data. This is so that whenever a plan is ran which collects data, these devices will always record data at start and end of scan. This currently done in GDA with before_scan metadata. There are currently two ways (I think) to achieve this

  1. via a plan decorator e.g baseline_decorator
  2. Add preprocessor SupplementalData to RunEngine (doc string below)
   Create an instance of SupplementalData and apply it to a RunEngine.

    >>> sd = SupplementalData(baseline=[some_motor, some_detector]),
    ...                       monitors=[some_signal],
    ...                       flyers=[some_flyer])
    >>> RE = RunEngine({})
    >>> RE.preprocessors.append(sd)

    Now all plans executed by RE will be modified to add baseline readings
    (before and after each run), monitors (during each run), and flyers
    (kicked off before each run and collected afterward).

Currently, the only way for us to add metadata is via option 1. The issue with this is we are now forced to wrap ever single plan we have with this decorator. It would much easier and simpler if we can add global metadata to be added to each run via option 2. The issue is Blueapi has no way of exposing this utils to us.

I've had a thought how we could do this. The first option is to have DeviceManager have an instance of RunEngine inside which blueapi then pulls out. This allows us to then add our own configuration to the RunEngine. My thinking was something like this

devices = DeviceManager()

@devices.factory
def my_device1() -> Device:
     return MyDevice(...)

@devices.factory
def my_device2() -> Device:
     return MyDevice(...)

...
@devices.run_engine
def configure_run_engine(beamline: dict[str: Device]) -> RunEngine:
   run_engine = RunEngine()
   sd = SupplementalData(
        baseline=[beamline["my_device1"]],
        monitors=[beamline["my_device2"]],
        flyers=[beamline["my_device3"]]
    )
    run_engine.preprocessors.append(sd)
    return run_engine

Then on Blueapi side, you update DeviceManager to support a run_engine method and then in BlueskyContext, you update to use the one we provided rather than your own. You then reuse what we have then add your additional blueapi configuration.

Acceptance Criteria

  • We can configure run engine with baseline metadata
Langage dominant
Python
Étoiles
14
Forks
15
Merge moyen
3 j 2 h
PR mergées (30 j)
35

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de DiamondLightSource/blueapi

Toutes les issues de DiamondLightSource/blueapi

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.