Skip to content

1259 test oav plans#1292

Closed
srishtysajeev wants to merge 24 commits into
mainfrom
1259_test_OAV_plans
Closed

1259 test oav plans#1292
srishtysajeev wants to merge 24 commits into
mainfrom
1259_test_OAV_plans

Conversation

@srishtysajeev

Copy link
Copy Markdown
Contributor

Fixes #1259

Link to dodal PR (if required): #1563
(remember to update pyproject.toml with the dodal commit tag if you need it for tests to pass!)

Instructions to reviewer on how to test:

  1. Do thing x
  2. Confirm thing y happens

Checks for reviewer

@codecov

codecov Bot commented Sep 22, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 57.14286% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.02%. Comparing base (04d3d9e) to head (a016677).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1292      +/-   ##
==========================================
- Coverage   90.14%   90.02%   -0.12%     
==========================================
  Files         130      132       +2     
  Lines        7834     7862      +28     
==========================================
+ Hits         7062     7078      +16     
- Misses        772      784      +12     
Components Coverage Δ
i24 SSX 75.27% <ø> (ø)
hyperion 97.79% <ø> (ø)
other 97.58% <57.14%> (-0.40%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@DominicOram DominicOram left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like a good start, thanks! If you merge main in it'll look a bit tidier. Mostly I think the asynchronous nature of bluesky/ophyd is what tripped you up here, put in a few more waits and it'll be all good.

def feedback_check(
device: XBPMFeedback = inject("xbpm_feedback"),
):
yield from bps.trigger(device)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Must: By default, trigger doesn't wait for the thing to finish. You want to do:

Suggested change
yield from bps.trigger(device)
yield from bps.trigger(device, wait=True)


# def oav_automation_test()
def feedback_check(
device: XBPMFeedback = inject("xbpm_feedback"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: device is generic. I would call it something more specific

percentage: float,
attenuator: BinaryFilterAttenuator = inject("attenuator"),
) -> MsgGenerator:
yield from bps.abs_set(attenuator, percentage / 100)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should: As above, be careful with waiting for things to finish. You probably want this to only return when it's done so you should do:

Suggested change
yield from bps.abs_set(attenuator, percentage / 100)
yield from bps.abs_set(attenuator, percentage / 100, wait=True)

or

Suggested change
yield from bps.abs_set(attenuator, percentage / 100)
yield from bps.mv(attenuator, percentage / 100)

Comment on lines +45 to +48
yield from bps.abs_set(shutter.control_mode, ZebraShutterControl.MANUAL)
yield from bps.abs_set(shutter, shutter_state)

yield from bps.abs_set(shutter.control_mode, base_control_mode)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should: As above, careful on waiting. I think you either want to add wait=True to all of these or change them to be mv instead

Comment on lines +56 to +59
group = "path setting"
yield from bps.abs_set(oav.grid_snapshot.filename, file_name, group=group)
yield from bps.abs_set(oav.grid_snapshot.directory, file_path, group=group)
yield from bps.wait(group)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could: You can use mv to change multiple things at the same time if you want:

Suggested change
group = "path setting"
yield from bps.abs_set(oav.grid_snapshot.filename, file_name, group=group)
yield from bps.abs_set(oav.grid_snapshot.directory, file_path, group=group)
yield from bps.wait(group)
yield from bps.mv(oav.grid_snapshot.filename, file_name, oav.grid_snapshot.directory, file_path)

yield from bps.abs_set(oav.grid_snapshot.filename, file_name, group=group)
yield from bps.abs_set(oav.grid_snapshot.directory, file_path, group=group)
yield from bps.wait(group)
yield from bps.trigger(oav.grid_snapshot)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should: I think you want to use oav.snapshot both here and above when setting the filename. The grid_snapshot will try and draw a grid on top (something like https://ispyb.diamond.ac.uk/dc/visit/cm40607-4/dcg/16423891) which I don't think we need.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also, as above, need to add a wait=True

def move_scintillator(
scintillator_state: InOut, scintillator: Scintillator = inject("scintillator")
) -> MsgGenerator:
yield from bps.abs_set(scintillator.selected_pos, scintillator_state)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should: As above, need a wait=True here or use mv

@DominicOram DominicOram added the i04 Changes relating to I04 label Oct 30, 2025
@DominicOram

Copy link
Copy Markdown
Contributor

This looks like it's covered by #1320 now, feel free to re-open if it isn't

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

i04 Changes relating to I04

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test plans on i04 required for OAV automation

3 participants