Skip to content

Conversation

@danielmaclaren
Copy link
Contributor

Description of work

Three wrapper functions have been written to simplie DAE clean up:

with_num_periods(n)
with_time_channels(tcbs)
with_dae_tables(wiring, spectra, detector)

testing and documentation has also been updated for the functions.

Ticket

Link to Ticket

Acceptance criteria

  • Pull request title is understandable for a user (e.g. scientist) reading the release notes. The PR title should be a short description of the change from a user perspective.
  • Pull request has appropriate labels for automatic release-notes generation
  • Functionality of wrapper works as expected i.e. original values are restored after a plan as been run within the wrapper
  • Tests pass

@danielmaclaren danielmaclaren added the bluesky-Semver-Minor New functionality / back-compatible changes label Oct 13, 2025
@danielmaclaren danielmaclaren linked an issue Oct 13, 2025 that may be closed by this pull request
1 task
@Tom-Willemsen
Copy link
Member

Acceptance criteria

Pull request title is understandable for a user (e.g. scientist) reading the release notes. The PR title should be a short description of the change from a user perspective.

This is not currently achieved.

Copy link
Member

@Tom-Willemsen Tom-Willemsen left a comment

Choose a reason for hiding this comment

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

Quick non-functional review - please ask if any of my comments don't make sense. Will do a more thorough functional review when these initial API comments have been addressed.

Comment on lines +7 to +9
['dae_table_wrapper](ibex_bluesky_core.plan_stubs.dae_table_wrapper)
['num_periods_wrapper](ibex_bluesky_core.plan_stubs.num_periods_wrapper)
['time_channels_wrapper](ibex_bluesky_core.plan_stubs.time_channels_wrapper)
Copy link
Member

Choose a reason for hiding this comment

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

just as an fyi, using the py:obj syntax renders slightly nicer. I also think it would be good to give a short description of that each one does here, rather than just dumping them as an unformatted list.

@@ -0,0 +1,39 @@
# Plan Wrappers

Plan wrappers that temporarily modify DAE (Data Acquisition Electronics) settings during a plan, automatically restoring the original values afterwards. This ensures that your experiments don't permanently change instrument configuration.
Copy link
Member

Choose a reason for hiding this comment

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

Link to DAE pages?

Comment on lines +29 to +35
RE(
with_num_periods(
example_plan(),
dae=dae,
)
)

Copy link
Member

Choose a reason for hiding this comment

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

I think the example we provide should be at the plan level, not a direct RE call.

Comment on lines +30 to +33
with_num_periods(
example_plan(),
dae=dae,
)
Copy link
Member

Choose a reason for hiding this comment

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

Hmm since with_num_periods doesn't actually change num_periods here, maybe it should be restore_num_periods instead.

The alternative is for the API to be:

with_num_periods(some_plan(), dae=dae, num_periods=10)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Tom, are you suggesting that we make another wrapper function?

restore_num_periods and with_num_periods?

Copy link
Member

Choose a reason for hiding this comment

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

No, I think we should only have one...

But it should either be:

  • with_num_periods(some_plan(), dae=dae, num_periods=10)
    OR
  • restore_num_periods(some_plan(), dae=dae)

The difference between these two is basically API; in the bottom one someone has to manually call yield from bps.mv(dae.number_periods) themselves, in the top one it's just one call.


UNUSED = 0
DAQ = 1
DWEll = 2
Copy link
Member

Choose a reason for hiding this comment

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

Is it really DWEll capitalised like that?

Copy link
Member

Choose a reason for hiding this comment

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

-> _dae_table_wrapper.py

same for the others

"motor_scan",
"polling_plan",
"scan",
"with_num_periods",
Copy link
Member

Choose a reason for hiding this comment

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

I think this is a plan stub, not a plan, so shouldn't be re-exported here, but in plan_stubs/__init__.py instead.

RE(
with_num_periods(
_dummy_plan_which_sets_periods(dae),
dae=dae, # type: ignore
Copy link
Member

Choose a reason for hiding this comment

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

Why does this fail type-checking?

Comment on lines +1051 to +1052
result = await dae.number_of_periods.read()
assert result["DAE-number_of_periods-signal"]["value"] == original_settings
Copy link
Member

Choose a reason for hiding this comment

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

I think .get_value() may be cleaner here.

Comment on lines +1119 to +1121
assert after.wiring_filepath.endswith(expected_wiring) # type: ignore
assert after.spectra_filepath.endswith(expected_spectra) # type: ignore
assert after.detector_filepath.endswith(expected_detector) # type: ignore
Copy link
Member

Choose a reason for hiding this comment

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

Why were these type-ignores needed?

@danielmaclaren danielmaclaren changed the title Ticket164wrapper Plan wrappers function to allow for easier cleanup of DAE setup changes Oct 17, 2025
@danielmaclaren danielmaclaren changed the title Plan wrappers function to allow for easier cleanup of DAE setup changes Plan wrapper functions to allow for easier cleanup of DAE setup changes Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bluesky-Semver-Minor New functionality / back-compatible changes size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plan wrappers for DAE setup changes with cleanup

2 participants