DiamondLightSource / DiamondLightSource/dodal

Remove usage of zebra.RotationDirection from the mx-bluesky parameter model

Open
#2,162 1 comment 0 reactions 0 assignees View on GitHub
Design Developer Experience
Dominant language
Python
Stars
5
Forks
13
Avg merge
3d 2h
Merged PRs (30d)
10

Description

** Background **
1: At the moment the rotation direction functionality lives inside "devices zebra"
which is an odd home for it

2: Also odd is the way the functionality behaves / is used.
A client class with some knowledge of an angle change ( for a rotation axis, say a common-or-garden omega )
has to ask zebra.rotation "Please tell me the multiplier for this sense of rotation [ POS or NEG ] .. and I'll use that multiplier to modify the number I first thought of ..."

** Suggested improvments **
1: Move the rotation stuff out of zebra and into maths or somewhere equally more general

2: Remove the twofold overkill
a) don't have client consumers of the POS and NEG do all the manipulation work in a roll your own
for each and every use case - do it once centrally

b) stop using multiplication to achieve a sign flip

Or in more words:
It would be much better if the rotation mechanics had a function - you pass in a change of angle relative to the direction definition and it reported back what that means in absolute change terms

eg POS should have a convert(delta: float) -> float which is basically lamba x : x
and NEG should have a convert(delta: float) -> float which is basically lambda x : -x

note that inside the interpret -x is not multiplying anything ( see "Computers don't do arithmetic they simulate it" )
it is just flipping the sign bit on the number stored in a register which is way less expensive than multiplying by some float that is 1 plus or minus epsilon

** Task **
Implement the above and make corresponding changes in blue sky libraries that hang off dodal
before it is too late and becomes too late to inject this common sense into the situation

## Acceptance Criteria
* that the above changes are implemented - or something very simiar

Contributor guide

Open the contributing guide

Research direction

Start by locating zebra.RotationDirection and the mx-bluesky parameter model, then trace its consumers in the blue sky libraries that hang off dodal. Define the shared rotation conversion behavior and update each identified consumer; done means the zebra dependency is removed from the parameter model and the affected tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.