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

Some reformatting of eiger_detector.py #19

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

jsouter
Copy link
Collaborator

@jsouter jsouter commented Jun 12, 2024

Small changes, namely removing unnecessary use of getattr/setattr when the attr name is given, replacing some format strings with f strings and naming references to the param tree subtrees to shorten some of the horribly long lines.

Copy link
Collaborator

@GDYendell GDYendell left a comment

Choose a reason for hiding this comment

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

I've had a quick look and this seems to generally improve things.

@ajgdls could you give a review as well?

python/src/eiger_detector/control/eiger_options.py Outdated Show resolved Hide resolved
@GDYendell GDYendell requested review from ajgdls and removed request for OCopping June 12, 2024 11:14
@jsouter
Copy link
Collaborator Author

jsouter commented Jun 12, 2024

Have made that change, the 4 mbbi records in eiger_options_config no longer cast the mbbi index to string unnecessarily.

@GDYendell
Copy link
Collaborator

Sorry maybe I wasn't clear. We do need the cast from int to string because the detector only accepts string (I think?).

With eiger-fastcs, this might be less important, though DAQ have requested that we still use mbb records because they automatically get treated as enums in ophyd.

@jsouter
Copy link
Collaborator Author

jsouter commented Aug 20, 2024

Sorry maybe I wasn't clear. We do need the cast from int to string because the detector only accepts string (I think?).

With eiger-fastcs, this might be less important, though DAQ have requested that we still use mbb records because they automatically get treated as enums in ophyd.

I can look over it again but I believe it doesn't affect what gets sent to the detector, just how python is internally handling the tracking of the state. I believe the int gets cast to a string which is handled by set_value, which casts it back to an int when get_option is called and is replaced by the string at that index in the EigerOption options list.

@ajgdls
Copy link
Collaborator

ajgdls commented Sep 17, 2024

I've checked through this and I can't see why the string values need to be stored, they are indeed converted to integer indexes and then the "real" string value written down to the hardware.
That said, has this change been tested to verify that the options are still working?

@ajgdls
Copy link
Collaborator

ajgdls commented Sep 17, 2024

@jsouter have you been able to test this with a detector? It might be worth adding a couple of debug statements that could be turned on to show what messages are going to the hardware (if that debugging is not already in there somewhere).

@jsouter
Copy link
Collaborator Author

jsouter commented Sep 17, 2024

@jsouter have you been able to test this with a detector? It might be worth adding a couple of debug statements that could be turned on to show what messages are going to the hardware (if that debugging is not already in there somewhere).

I've only tested this against the tickit-devices sim I believe, while that appears to work I can give it a try with a detector soon.

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.

3 participants