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

ENH: add a "busy" device #1028

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Conversation

tacaswell
Copy link
Contributor

We had a request for a way to set a sleep in the RE that would give a
progress bar.

You can get an interuptable sleep via bps.sleep, but that provides no
feedback. Rather than trying to invent another way to do progress bars, re-use
the progress bar machinery for hardware motion.

This still needs tests, but @bruceravel is using this at his beamline so I wanted to get a PR for ASAP.

We had a request for a way to set a sleep in the RE that would give a
progress bar.

You can get an interuptable sleep via `bps.sleep`, but that provides no
feedback.  Rather than trying to invent another way to do progress bars, re-use
the progress bar machinery for hardware motion.
@prjemian
Copy link
Contributor

prjemian commented Feb 9, 2022

Different than support for the EPICS busy record from synApps. https://github.com/BCDA-APS/apstools/blob/main/apstools/synApps/busy.py

@tacaswell
Copy link
Contributor Author

Correct, it was inspired by the busy record, but re-using the name is a probably a terrible idea. I think this is a very good idea and I can see it being used both as a way to provide a delay on its own and as a way to put a "time box" around some other activity (because it is a "settable" it can be set in parallel with either other sets or a trigger!). \

What should we call this instead?

  • SleepWithProgressBar
  • TimeMover
  • TimeTraveler
  • Delay
  • SleepMachine
  • ??

@prjemian
Copy link
Contributor

prjemian commented Feb 9, 2022 via email

@bruceravel
Copy link
Contributor

@tacaswell : The word current is misspelled at curent in two places in this PR. I suspect that is the reason for the failed tests.

Copy link
Member

@mrakitin mrakitin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea! Below are a few comments/suggestions to address what Bruce pointed to.

Total delay in seconds

tick : float, default=0.1
Time between updating the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incomplete description here

ophyd/busy.py Outdated Show resolved Hide resolved
ophyd/busy.py Outdated Show resolved Hide resolved
ophyd/busy.py Outdated Show resolved Hide resolved
ophyd/busy.py Outdated Show resolved Hide resolved
"""

def set(self, delay):
return BusyStatus(self, delay, tick=max(1, min(0.1, delay / 100)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this max(..., min(...)) condition even needed? With delay=100, it'll pick the min=0.1, and the tick will be 1. With delay=0, it'll pick min=0, but the tick will still be 1. Why not hard-code the tick=1?

Did you have another corner case in mind?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I messed the logic up here. The goal was to never tick faster that 10hz (people can not see much faster and no need to stress the system) and never slower than 1hz (1s is about as long as I want to when I watch something to see if it is dead or not) and to get as close as possible to 100 updates as possible in between (because that felt like a "nice" number).

@tacaswell
Copy link
Contributor Author

I am not sure when I will have time to work on this again, I would be very 💯 👍🏻 if someone was motivated and wanted to take this PR over!

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

Successfully merging this pull request may close these issues.

4 participants