This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
General condition is a feature used successfully at DESY for some years already.
It allows the users to easily repeat the acquisitions if certain conditions are not satisfactory.
The user simply writes a macro which return value decides if the acquisition should be repeated and set it via
GeneralCondition
environment variable. You can find the original implementation authored by @teresanunez in https://github.com/desy-fsec/sardana (mainlygscan.py
module).Today with @teresanunez we had a pair-programming session in which we came with the following ideas:
pre-step
,pre-move
orpre-acq
hooks.This PR changes the approach from the original implementation and moves the condition execution to the step scan generator of the built-in scan macros (for the moment only
aNscan
) which we believe fits better to the current design of the scan framework - theSScan
simply obeys what the generator ask it for.Even if the PR is marked as WIP it is already operational but it will keep moving the motors to the same position in case of repeating the acquisition - again see #1159 (comment).
Before integrating it, apart from adding the documentation, I propose that we also clarify the following points:
repeat-acq
(still executed from the generator) wouldn't be simpler instead of adding a new environment variablerepeat-step
GeneralHooks
. We could still keep the environment variable for the backwards compatibility for DESY. This is more about recommendations for the new users of this feature.fscan
andmesh
macros as well?It would be greate to hear your opinions about these points and this feature in general.
One important thing is that using the general condition automatically disables the deterministic scans optimizations.
Thanks @teresanunez for your patience! Sorry you had to wait so long until we finally found some time to deeply analyze the requirements and review your great work!