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

add i18 beamline definition #722

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open

add i18 beamline definition #722

wants to merge 35 commits into from

Conversation

stan-dot
Copy link
Contributor

@stan-dot stan-dot commented Aug 1, 2024

Fixes #709

Instructions to reviewer on how to test:

  1. Do `dodal connect i181
  2. Confirm all the devices expected to work, work

Checks for reviewer

  • Would the PR title make sense to a scientist on a set of release notes
  • If a new device has been added does it follow the standards
  • If changing the API for a pre-existing device, ensure that any beamlines using this device have updated their Bluesky plans accordingly
  • Have the connection tests for the relevant beamline(s) been run via dodal connect ${BEAMLINE}

@stan-dot stan-dot added enhancement New feature or request python Pull requests that update Python code i18 labels Aug 1, 2024
@stan-dot stan-dot requested a review from iain-hall August 1, 2024 10:51
@stan-dot stan-dot self-assigned this Aug 1, 2024
Copy link

codecov bot commented Aug 1, 2024

Codecov Report

Attention: Patch coverage is 98.41270% with 2 lines in your changes missing coverage. Please review.

Project coverage is 95.91%. Comparing base (7f7b7a6) to head (135687e).

Files with missing lines Patch % Lines
src/dodal/beamlines/i18.py 96.87% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #722      +/-   ##
==========================================
+ Coverage   95.85%   95.91%   +0.05%     
==========================================
  Files         136      141       +5     
  Lines        5576     5702     +126     
==========================================
+ Hits         5345     5469     +124     
- Misses        231      233       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

Copy link
Contributor

@DominicOram DominicOram left a comment

Choose a reason for hiding this comment

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

Thanks Stan! Why are there so many skipped devices here?

src/dodal/beamlines/i18.py Outdated Show resolved Hide resolved
src/dodal/beamlines/i18.py Outdated Show resolved Hide resolved
src/dodal/beamlines/i18.py Outdated Show resolved Hide resolved
src/dodal/beamlines/i18.py Outdated Show resolved Hide resolved
src/dodal/beamlines/i18.py Outdated Show resolved Hide resolved
src/dodal/beamlines/i18.py Outdated Show resolved Hide resolved
src/dodal/beamlines/i18.py Outdated Show resolved Hide resolved
src/dodal/beamlines/i18.py Outdated Show resolved Hide resolved
src/dodal/beamlines/i18.py Show resolved Hide resolved
@stan-dot
Copy link
Contributor Author

stan-dot commented Aug 1, 2024

@DominicOram the devices are skipped as we don't need all of them at the moment, as we roll out the devices following the plans we make, so it's gradual and agile

@stan-dot stan-dot mentioned this pull request Aug 1, 2024
@DominicOram
Copy link
Contributor

so it's gradual and agile

The more agile way to do it would be don't put the devices in at all until you need them otherwise we now have code in that never runs and we don't know if it works.

@stan-dot
Copy link
Contributor Author

stan-dot commented Aug 1, 2024

we need them for the plans in a different repo. also aren't devices skipped all the time depending if they are off or taken out of a beamline physically?

@stan-dot
Copy link
Contributor Author

stan-dot commented Aug 5, 2024

lint error

found 0 vulnerabilities
/home/runner/work/dodal/dodal/src/dodal/devices/i18/sim_motor_set.py
  /home/runner/work/dodal/dodal/src/dodal/devices/i18/sim_motor_set.py:57:12 - error: Cannot assign to attribute "delay" for class "SynAxis"
    Expression of type "float" cannot be assigned to attribute "delay" of class "SynAxis"
      "float" is incompatible with "int" (reportAttributeAccessIssue)
1 error, 0 warnings, 0 informations 

test error:

FAILED tests/devices/i22/test_dcm.py::test_configuration - AssertionError: Expected dcm to produce
{'dcm-bragg-motor_egu': {'value': '', 'timestamp': , 'alarm_severity': }, 'dcm-bragg-velocity': {'value': 0.0, 'timestamp': , 'alarm_severity': }, 'dcm-energy-motor_egu': {'value': '', 'timestamp': , 'alarm_severity': }, 'dcm-energy-velocity': {'value': 0.0, 'timestamp': , 'alarm_severity': }, 'dcm-crystal_1_roll-motor_egu': {'value': '', 'timestamp': , 'alarm_severity': }, 'dcm-crystal_1_roll-velocity': {'value': 0.0, 'timestamp': , 'alarm_severity': }, 'dcm-offset-motor_egu': {'value': '', 'timestamp': , 'alarm_severity': }, 'dcm-offset-velocity': {'value': 0.0, 'timestamp': , 'alarm_severity': }, 'dcm-crystal_2_pitch-motor_egu': {'value': '', 'timestamp': , 'alarm_severity': }, 'dcm-crystal_2_pitch-velocity': {'value': 0.0, 'timestamp': , 'alarm_severity': }, 'dcm-crystal_2_roll-motor_egu': {'value': '', 'timestamp': , 'alarm_severity': }, 'dcm-crystal_2_roll-velocity': {'value': 0.0, 'timestamp': , 'alarm_severity': }, 'dcm-perp-motor_egu': {'value': '', 'timestamp': , 'alarm_severity': }, 'dcm-perp-velocity': {'value': 0.0, 'timestamp': , 'alarm_severity': }, 'dcm-crystal_2_d_spacing': {'value': 3.13475, 'timestamp': , 'alarm_severity': }, 'dcm-crystal_2_usage': {'value': 'Bragg', 'timestamp': , 'alarm_severity': }, 'dcm-crystal_2_type': {'value': 'silicon', 'timestamp': , 'alarm_severity': }, 'dcm-crystal_1_reflection': {'value': [1, 1, 1], 'timestamp': , 'alarm_severity': }, 'dcm-crystal_2_reflection': {'value': [1, 1, 1], 'timestamp': , 'alarm_severity': }, 'dcm-crystal_1_d_spacing': {'value': 3.13475, 'timestamp': , 'alarm_severity': }, 'dcm-crystal_1_usage': {'value': 'Bragg', 'timestamp': , 'alarm_severity': }, 'dcm-crystal_1_type': {'value': 'silicon', 'timestamp': , 'alarm_severity': }}
but actually got
{'dcm-bragg-motor_egu': {'value': '', 'timestamp': 217.034084231, 'alarm_severity': 0}, 'dcm-bragg-velocity': {'value': 0.0, 'timestamp': 217.034112413, 'alarm_severity': 0}, 'dcm-energy-motor_egu': {'value': '', 'timestamp': 217.034883664, 'alarm_severity': 0}, 'dcm-energy-velocity': {'value': 0.0, 'timestamp': 217.034907609, 'alarm_severity': 0}, 'dcm-crystal_2_pitch-motor_egu': {'value': '', 'timestamp': 217.03565736, 'alarm_severity': 0}, 'dcm-crystal_2_pitch-velocity': {'value': 0.0, 'timestamp': 217.03567862, 'alarm_severity': 0}, 'dcm-offset-motor_egu': {'value': '', 'timestamp': 217.034355621, 'alarm_severity': 0}, 'dcm-offset-velocity': {'value': 0.0, 'timestamp': 217.034377142, 'alarm_severity': 0}, 'dcm-crystal_1_roll-motor_egu': {'value': '', 'timestamp': 217.035143273, 'alarm_severity': 0}, 'dcm-crystal_1_roll-velocity': {'value': 0.0, 'timestamp': 217.035164924, 'alarm_severity': 0}, 'dcm-crystal_2_roll-motor_egu': {'value': '', 'timestamp': 217.035400046, 'alarm_severity': 0}, 'dcm-crystal_2_roll-velocity': {'value': 0.0, 'timestamp': 217.035421566, 'alarm_severity': 0}, 'dcm-perp-motor_egu': {'value': '', 'timestamp': 217.034619808, 'alarm_severity': 0}, 'dcm-perp-velocity': {'value': 0.0, 'timestamp': 217.034641078, 'alarm_severity': 0}, 'dcm-crystal_2_type': {'value': 'silicon', 'timestamp': 217.028304579, 'alarm_severity': 0}, 'dcm-crystal_1_usage': {'value': 'Bragg', 'timestamp': 217.028175165, 'alarm_severity': 0}, 'dcm-crystal_1_reflection': {'value': [1, 1, 1], 'timestamp': 217.028232263, 'alarm_severity': 0}, 'dcm-crystal_2_reflection': {'value': [1, 1, 1], 'timestamp': 217.028327742, 'alarm_severity': 0}, 'dcm-crystal_1_d_spacing': {'value': 0.31356, 'timestamp': 217.028257851, 'alarm_severity': 0}, 'dcm-crystal_2_d_spacing': {'value': 0.31356, 'timestamp': 217.028350996, 'alarm_severity': 0}, 'dcm-crystal_2_usage': {'value': 'Bragg', 'timestamp': 217.028281545, 'alarm_severity': 0}, 'dcm-crystal_1_type': {'value': 'silicon', 'timestamp': 217.028205542, 'alarm_severity': 0}}
=========== 1 failed, 578 passed, 2 skipped, 27 deselected in 21.10s ===========

@iain-hall I'll try tackling the second one

@DiamondJoseph
Copy link
Contributor

lint error

found 0 vulnerabilities
/home/runner/work/dodal/dodal/src/dodal/devices/i18/sim_motor_set.py
  /home/runner/work/dodal/dodal/src/dodal/devices/i18/sim_motor_set.py:57:12 - error: Cannot assign to attribute "delay" for class "SynAxis"

I would not use the Ophyd (i.e. not ophyd-async) SynAxis

@stan-dot
Copy link
Contributor Author

stan-dot commented Aug 5, 2024

the test_dcm error comes from a failure to correctly read in the 'ANY' mock value.

@stan-dot
Copy link
Contributor Author

stan-dot commented Aug 5, 2024

 src/dodal/beamlines/i18.py:17: in <module>
    from dodal.devices.i18.sim_detector import SimDetector
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/dodal/devices/i18/sim_detector.py:2: in <module>
    from ophyd_async.sim import PatternGenerator
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/ophyd_async/sim/__init__.py:1: in <module>
    from .pattern_generator import PatternGenerator
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/ophyd_async/sim/pattern_generator.py:14: in <module>
    import h5py
E   ModuleNotFoundError: No module named 'h5py'
____________ ERROR collecting src/dodal/devices/i18/sim_detector.py ____________
ImportError while importing test module '/home/runner/work/dodal/dodal/src/dodal/devices/i18/sim_detector.py'.

that is because in ophyd-async h5py was added only as a dev dependency

@stan-dot
Copy link
Contributor Author

@DiamondJoseph how do I ask for the ophyd-async to be installed with the [sim] dependencies?

the error in question: ModuleNotFoundError: No module named 'h5py'

@DiamondJoseph
Copy link
Contributor

I'll answer on sSlack to avoid everyone getting emails

@stan-dot
Copy link
Contributor Author

waiting until pydantic 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request i18 python Pull requests that update Python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make i18 - beamlines files
4 participants