Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalize the writing of labeled streams #244

Open
prjemian opened this issue Aug 25, 2023 · 3 comments
Open

Generalize the writing of labeled streams #244

prjemian opened this issue Aug 25, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@prjemian
Copy link
Contributor

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.

try:
# feature new in apstools 1.6.14
from apstools.plans import label_stream_wrapper
def motor_start_preprocessor(plan):
return label_stream_wrapper(plan, "motor", when="start")
RE.preprocessors.append(motor_start_preprocessor)
except Exception:
logger.warning("Could load support to log motors positions.")

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! (aps-8id-dys/bluesky@d201249)

@prjemian prjemian added the enhancement New feature or request label Aug 25, 2023
@prjemian prjemian added this to the v1.0.2 milestone Aug 25, 2023
@prjemian prjemian self-assigned this Aug 25, 2023
@qzhang234
Copy link

@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
Copy link
Contributor Author

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
Copy link
Contributor Author

Actually, responded in the new issue just created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants