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

Add fly scan plan stub #293

Merged
merged 34 commits into from
May 23, 2024
Merged

Add fly scan plan stub #293

merged 34 commits into from
May 23, 2024

Conversation

abbiemery
Copy link
Collaborator

Fixes #278.

This adds a plan stub for the current fly scanning flow we have. That being:

- Stage devices and open a run
- Set up the flyer with a static sequence table and detectors with a trigger
- Declare the stream and kickoff the scan
- Collect while completing
- Close run and unstage devices.

This does the middle three points, so all you should need to do outside this is instantiate devices, stage and open a run.

@abbiemery abbiemery force-pushed the flyscan-stub branch 3 times, most recently from c270f9d to f9e8cf0 Compare May 10, 2024 12:35
from ophyd_async.panda._trigger import SeqTableInfo


def fly_and_collect(
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should probably have a more specific name.

Something like time_resolved_trigger_detectors?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree, I just wanted to call it something and figured i'd ask for opinions before merging.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Perhaps rewording your suggestion to improve clarity? Not sure what it should be though.

@coretl
Copy link
Collaborator

coretl commented May 17, 2024

Requires:

Test script:

# Import bluesky and ophyd
import bluesky.plans as bp
import bluesky.preprocessors as bpp
from bluesky import RunEngine
from bluesky.utils import ProgressBarManager, register_transform
from dodal.beamlines import p45
from dodal.beamlines.beamline_utils import set_directory_provider

from ophyd_async.core import HardwareTriggeredFlyable, StaticDirectoryProvider
from ophyd_async.panda._trigger import StaticSeqTableTriggerLogic
from ophyd_async.planstubs import fly_and_collect

# Create a run engine, with plotting, progressbar and transform
RE = RunEngine({}, call_returns_result=True)
RE.waiting_hook = ProgressBarManager()
register_transform("RE", prefix="<")

# Create ophyd-async devices
set_directory_provider(StaticDirectoryProvider("/dls/p45/data/2024/cm37283-2/tmp"))
det = p45.diff()
panda = p45.panda1()
flyer = HardwareTriggeredFlyable(StaticSeqTableTriggerLogic(panda.seq[1]))


@bpp.stage_decorator([panda, det])
@bpp.run_decorator()
def my_custom_plan():
    yield from fly_and_collect(
        "primary", [panda, det], flyer, 10, 0.1, 0.5, repeats=2, period=1
    )


RE(my_custom_plan(), lambda n, d: print(n, d))

@abbiemery
Copy link
Collaborator Author

@coretl I have had to change the collect_while_completing stub call back to the code used for the i22 experiment. An issue that was raised back then has not been addressed and as such the new stub is not compatible yet. The issue and following discussion is here bluesky/bluesky#1630.

@abbiemery
Copy link
Collaborator Author

abbiemery commented May 22, 2024

I have also had to change back the complete_all and kickoff_all to just bare kickoff and complete as this are not in the latest alpha of bluesky. I have made an issue to go through ophyd-async and update these once we get the next bluesky alpha.

#328

@abbiemery
Copy link
Collaborator Author

I have also dropped the patch to 90% as it was up at 98 and was starting to get prohibitive. This will not effect the catching of overall coverage.

@abbiemery abbiemery requested a review from coretl May 22, 2024 15:46
@abbiemery
Copy link
Collaborator Author

Made an issue to investgate the stub. #329

@abbiemery abbiemery merged commit 11fc4cc into main May 23, 2024
18 checks passed
@abbiemery abbiemery deleted the flyscan-stub branch May 23, 2024 12:25
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.

Write planstub for the current standard fly-scan
2 participants