BCDA-APS / bluesky_training

Bluesky training, including instrument package
https://bcda-aps.github.io/bluesky_training/
Other
11 stars 0 forks source link

Generalize the writing of labeled streams #244

Open prjemian opened 10 months ago

prjemian commented 10 months ago

When the SPEC callback is used, any ophyd object labeled as "motor" will be written to a separate stream at the start or a run and/or a separate stream at the end of a run. https://github.com/BCDA-APS/bluesky_training/blob/46a4dfeb718f03aafb3defc75c5fbdd31a0a40a4/bluesky/instrument/callbacks/spec_data_file_writer.py#L34-L43

While SPEC data file writing needs the label_start_motor stream (so as to write the values of all motors into each scan's heading lines), the idea is not unique to SPEC files.

Move this code out of the SPEC support and generalize such that configuration is directed by a list of labels in the (iconfig.yml) file:

LABELED_STREAMS:
  start:
    - ad_metadata
    - motor

@qzhang234, @sureshnaps Thanks for the suggestion! (https://github.com/aps-8id-dys/bluesky/commit/d2012497d67811d331081cbc9e9d8ff0d5c6fd7b)

qzhang234 commented 10 months ago

@prjemian I'm a bit confused about how to use this with the Run Engine. Should I create a plan just like the one shown above, but replace motor_start_preprocessor with bp.count([lambda2m])), and then the plan would execute the count command and create the Nexus file?

Also, could you add Suresh and Eric to this issue as well?

prjemian commented 10 months ago

Comment is not related directly to this issue. The code shown above (in this GitHub issue) is for configuration of the bluesky instrument. I'll respond to the question you asked in the Teams conversation.

prjemian commented 10 months ago

Actually, responded in the new issue just created.