-
Notifications
You must be signed in to change notification settings - Fork 52
Fix #1471: add pre-move & post-move hook places to mv-macro #1480
Fix #1471: add pre-move & post-move hook places to mv-macro #1480
Conversation
please let me know, if you have a better idea for the name of the |
According to the dicussion in #1472 I would simply add a
to the Do I have to put in the |
I would say that in the |
Hi, I have tested it and it works nicely. The only point, I think we have decided to put True as default. |
Thanks @teresanunez for the review!
See my reasoning in #1471 (comment), I already talked with @teresanunez privatelly about it and she agrees on using Many thanks to all! |
change default value of PRE_POST_MOVE_HOOK_IN_MV from False to True
Just changed the default from False to True. |
Hi Daniel, thanks. Do you mean to change the comments in the file sardanacustomsettings.py ?. Yes, please change that. |
Hi Teresa, I think I added the correct comments in the file sardanacustomsettings.py |
Hi Daniel, let´s see what Zibi says, but I think the idea is that by default the pre/post-move hooks will run with |
So the default behaviour has to be True (not only the default value in the sardanacustomsettings) |
udpate comment of PRE_POST_MOVE_HOOK_IN_MV for True as default value
add default value True to PRE_POST_MOVE_HOOK_IN_MV sardanacustomsettings value
thanks for the hint, I added the default value |
Thanks, IMO is fine now. The documentation would be great. But I think it could |
okay, then do it in another PR and first merge this one here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks to both for working on this PR!
I agree to add documentation in another PR. I can start working on that in parallel.
I have still one cooment about this one, where umv
macro is not Hookable
and does not announce allowsHooks
hint. I've not checked it but I suspect that it won't be possible to:
- Attach sequencer hooks hooks to it
- Attach programmatic hooks to it
- In the future, whenever we add more granular configuration of general hooks as described in pre- and post-move hooks not available in mv macro #1471 (comment), it won't be possible to attach general hooks only to the
umv
macro.
I think we would overcome all these points if wee make it inherit from Hookable
, add the allowsHooks
hint and then in the run()
first create the mv
macro and then transfer to it the hooks from the umv
. What do you think? Should that work?
One should try and test, I think. |
…ardana into fix1471-pre-post-move-hook-places
…m/dschick/sardana into fix1471-pre-post-move-hook-places
… fix1471-pre-post-move-hook-places
I have merged all of your changes as well as #1526 I also added the This is maybe anther issue, but how about the Other wise everythin is working fine now for me with |
Very good, I missed that when reviewing it. Yes, the scan macros deposit the moveables objects in
From the point of view of the |
I was actually about to ask about that. If I ask for the So is this still a bug or do I use the wrong syntax to access the corret ancestor? |
Sorry about my previous message which created confusion. I was speaking without actually testing it. If it already works as you explain, then I think it is correct. As I mentioned somewhere earlier, the fact that the |
thanks for clarification, however, it would be much nicer for the future if the hooks from the internally called Still it will be more difficult for I also wrote simple |
I tested and updated |
I think it is fine only with the physical motors. |
Thanks to both @dschick and @teresanunez for reviewing the HKL part!
This is a very interesting point. For example, if we execute a scan or a This is just my way of interpreting it, I may be wrong (I've not made any tests of that) and I rely on your decission cause you have much more experience with the HKL. |
@dschick, just a side comment/question on the PRs. I think it would be more clear to the reviewer if we avoid merging other PRs, let's call them dependency PRs, into the one of the PR, let's call it dependent PR. Whenever the dependency PRs are getting merged into the develop branch, then we could update the dependent PR with the changes from the develop branch. This way the list of the commits will only include the ones from the dependent PR, and the list of the changes as well. I understand the need to reflect on this kind of dependencies. So, what we could do instead, is to keep an updated list of dependency PRs in the dependent PR description (initial comment) and make comments in the dependent PR discussion whenever this list changes (so we get notifications on the updates). Or maybe there are better mechanisms/policies to solve this? What you, and others, think about it? |
Hi Zibi, the macros br and ubr do not move the pseudomotors but the real motors directly. This is why I agree with |
Yes, this is what happens inside of the macro. But from the user point of view, the parameters that you pass are the H, K and L positions, so pseudo motors' positions. Now, let's put aside the |
Hi @reszelaz
that is a very good idea, to keep the dependencies listed in the header. And I am sorry for the mess I produce sometimes, when fighting with git :) I am just not so sure about, how I should use the dependencies in my PR branch without merging them from another PR branch?
I actually used the physical motors just because of what @teresanunez said, as the
I am happy with it. if you have tested it, it can be merged |
Don't worry! It happens to all of us:) IMHO, the best thing about Git is that it is so easy to redo things when something goes wrong.
I'm not an expert here, but I would keep two branches: the one for the PR needs. And another one where I would put it together with the dependencies just for doing tests. There may be other ways, like for example isaacs/github#959 (comment), but I think it may need that all the branches are in the upstream repo and not in the forks. Anyway, from the Sardana point of view, it is not worth to explore it since we will be moving to GitLab soon.
Not directly, but the following should work : @macro()
def pre_move_hook(self):
motors = []
for moveable in self.parent_macro.motors:
if moveable.type == "PseudoMotor":
motors.extend([self.getMotor(name) for name in moveable.physical_elements])
else:
motors.append(moveable) You could also use Again, I'm happy with your decission. I just wanted to share with you this observations. Thanks again @teresanunez and @dschick ! |
Hi Zibi, the point is that the macro br does not use the pseudomotors at all ... As Daniel and myself said, the moveables |
in addition what @teresanunez said, you cannot move only |
@teresanunez many thanks again for the clarification. I see the point about the implementation. If possible, I still would like to ask you some questions about it (just to understand better how the diffractometers are being used by the users), but since it is not urgent let's postpone it to the follow-up meeting. Could you please remind me about it if I forget to ask the next time we meet:) I'm merging, thanks to all involved in this work! |
Hi Zibi, yes, no problem (I hope I remember that ... one of us should do). |
Just a note: gitlab already has a specific field for dependencies in MRs. I am just mentioning it in case you prefer waiting for migration instead of deciding on an ad hoc solution
On 29 March 2021 13:06:05 CEST, reszelaz ***@***.***> wrote:
***@***.***, just a side comment/question on the PRs.
…
I think it would be more clear to the reviewer if we avoid merging
other PRs, let's call them dependency PRs, into the one of the PR,
let's call it dependent PR. Whenever the dependency PRs are getting
merged into the develop branch, then we could update the dependent PR
with the changes from the develop branch.
This way the list of the commits will only include the ones from the
dependent PR, and the list of the changes as well.
I understand the need to reflect on this kind of dependencies. So, what
we could do instead, is to keep an updated list of dependency PRs in
the dependent PR description (initial comment) and make comments in the
dependent PR discussion whenever this list changes (so we get
notifications on the updates). Or maybe there are better
mechanisms/policies to solve this?
What you, and others, think about it?
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#1480 (comment)
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
|
Very good news! Thanks for letting us know. Yes, it is better to wait for the GitLab. |
This PR adds the
pre-move
&post-move
hook places tomv
macro.A new
sardanacustomsetting
parameter namedPRE_POST_MOVE_HOOK_IN_MV
is introduced to disable thepre-move
andpost-move
hook places in themv
macro by default.