-
Notifications
You must be signed in to change notification settings - Fork 5
MXDGA-3724: Added the MVP for the fast grid scan motion #2
Conversation
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.
Made a couple of comments, but these are just opinions on scanning the code.
Do we use black
for formatting?
I don't know what the "house style" is for blue sky so I don't know if set_params(1, 2, 3, 4, 5)
is good practice or no...
from ophyd.sim import make_fake_device | ||
from src.artemis.devices.fast_grid_scan import FastGridScan, time | ||
|
||
from mockito import * |
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.
Personally I prefer to import what you use rather than from thing import *
- so for example when I wonder what when()
is below, I can see where it comes from
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.
Agreed, I wouldn't use import *
in the actual production code so I shouldn't in the test code.
# Kickoff timeout in seconds | ||
KICKOFF_TIMEOUT: float = 5.0 | ||
|
||
def set_program_data(self, nx, ny, width, height, exptime, startx, starty, startz): |
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.
Kinda feel like more structured API here would help? set_program_data
call in the test just looks like pushing a bunch of random numbers
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.
Yh, I left this in as a bit of a placeholder until I had a better feel for how we would actually be using the Device upstream but I'll think about improving it now.
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.
I borrowed some of the work of @callumforrester for this, which also included some checking against motor limits.
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.
Didn't spot this chain, I think this needs updating to reflect this thread: #2 (comment)
I've been using |
We already have |
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.
Looks great, Dom. Code is very clear and well-documented. I particularly like the studious use of type annotations! Have added a few minor comments for things I spotted here and there.
except ZeroDivisionError: | ||
fraction = 1 | ||
time_remaining = 0 | ||
except Exception: |
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.
If there is some unknown exception I think we should pass it upwards with self.set_exception()
.
@graeme-winter and @DominicOram
I prefer both because unknown agents can get around pre-commit, but pre-commit covers the 90% case so probably okay. However I suggest making a CI job for the tests regardless. |
I'm going to put a plug in for how we do things in Controls, feel free to adopt whatever is useful:
None of this depends on internal DLS infrastructure so will still work if you unset the PYPI mirror. We've captured this setup in a skeleton module that you can either copy/paste from or git pull changes from: Here's an example of a module that uses it: |
Done the rework from both @callumforrester and @graeme-winter, thanks! CI issues will be addressed in https://jira.diamond.ac.uk/browse/MXGDA-3761 |
After discussing with @graeme-winter today I think this is just waiting on review from @bentom08, if you have any thoughts? |
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.
Everything looks fine to me, happy for this to be merged in as is.
…rce/MXGDA_3724 MXDGA-3724: Added the MVP for the fast grid scan motion NOTE: Commit originally came from https://github.com/DiamondLightSource/python-artemis
…rce/MXGDA_3724 MXDGA-3724: Added the MVP for the fast grid scan motion NOTE: Commit originally came from https://github.com/DiamondLightSource/python-artemis
(#2) Move devices in from Artemis
See https://jira.diamond.ac.uk/browse/MXDGA-3724
To review: