-
Notifications
You must be signed in to change notification settings - Fork 29
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
Rename multiplier to frames_per_event and move to first dim of shape #726
base: main
Are you sure you want to change the base?
Rename multiplier to frames_per_event and move to first dim of shape #726
Conversation
… dataset description" This reverts commit 488d7eb.
@jwlodek, @jennmald , and I did some testing on actual devices and found a few more issues that need to be resolved. We didn't get through all of the testing we planned for so we will continue next week most likely. For ophyd-async (completed in a5b1f27) :
For bluesky:
For tiled:
That covers pretty much everything that we tested a debugged on the devices so far. We will see if changes to tiled are necessary in further testing. |
I'm not sure, I don't think that's a real restriction. If you remove it, what breaks? |
Nothing actually, we removed it and got everything to work as expected, just into separate streams. We're going to make sure they can fit into the same stream this week |
…ts frames_per_event > 1
…ve-multiplier-to-first-dim
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've now tested this and it is working for us, pending the Consolidator
PR.
Actually we decided that it does not work well with tiled just yet. We want tiled to have the Basically, ophyd-async has the descriptor shape with the first dim as The shape of the data from the user perspective should always be |
We tested this again, and we think we are happy to merge this pending the sister PR into bluesky being ready / tested as well. |
src/ophyd_async/core/_detector.py
Outdated
""" | ||
|
||
@computed_field | ||
@cached_property | ||
def total_number_of_triggers(self) -> int: | ||
return ( | ||
sum(self.number_of_triggers) | ||
sum(self.number_of_triggers) * self.frames_per_event |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either we rename number_of_triggers
to number_of_events
and this logic is valid, or we remove the * self.frames_per_event
.
At the moment we have:
- number_of_triggers
- livetime and deadtime of each trigger
- multiplier (which is effectively triggers_per_event)
We could move to:
- number_of_events
- livetime and deadtime of each frame
- frames_per_event
@jwlodek do you have an opinion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the naming you suggest makes sense. number_of_events
is a more accurate way of describing what this value is. I agree that livetime/deadtime should be on a per-frame basis, that's how most people will interpret it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be:
TriggerInfo.number_of_triggers
-> TriggerInfo.number_of_events
TriggerInfo.frames_per_event
-> TriggerInfo.triggers_per_event
This would make the total_number_of_triggers
property meaningful. The word "frame" is really only relevant to detectors that capture 2-D data.
Then we can add that the word "event" here relates to a single StreamDatum
index being emitted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy with that
This might seem like overkill but please help me check my understanding of the terms. Here is what I understand:
The trigger_info = TriggerInfo(number_of_triggers=4, frames_per_event=2)
RE(bps.prepare(det, trigger_info))
RE(bp.count([det], num=10)) This example currently fails to run without error. Is this something that should be possible? I can't even tell what the expected behavior here should be... This may be an unintended consequence of doing a step scan versus a fly scan but I need to dig a bit further. Either way, if there is a real issue here, it should probably be handled in a separate PR. |
My take:
Definitely. There are 3 terms here:
So
This should error with something like "Can only trigger() to contribute to a single event, but detector was prepared with number_of_events=4" |
@coretl Okay I understand now. It makes sense that a step scan can only have 1 trigger, by your definition of trigger. However, the term "trigger" seems overloaded with bluesky's definition in the sense that a I will do the renaming part in this PR and add checks + expected functionality (with tests) in another PR. |
I agree with @coretl 's understanding. One thing I thought of however when mulling this over, is that currently we are missing one thing when operating in step scan mode - namely that if I set I think the easiest solution to this would be to add a property to Thoughts? |
How about we make
I'm not sure whether |
I think this should be handled in a different PR. There is some complexity in doing this. Something like this is already done for the We would basically be doing the following:
So if someone re-uses a |
* add use/set switch (bluesky#780) * add use/set switch * rename to set_use_switch * Remove functions from ADHDFWriter that are exact copies of superclass functions (bluesky#782) * Simpler fix standard det (bluesky#784) * Make sure the capture/arm status coro hasn't already completed before trying to await it * add offset mode switch and other missing motor fields (bluesky#783) * add offset mode switch * add other things in epics motor present in ophyd-sync * remove homf,homr,movn,tdir and make signal names consistent with ophyd * make HLS and LLS int * Testing some ideas * Renamed number_of_triggers -> number_of_events, frames_per_event -> exposures_per_event * Cleanup on expected test failure * Use FailedStatus in test --------- Co-authored-by: Jack Harper <[email protected]> Co-authored-by: Jakub Wlodek <[email protected]>
…mashopkins32/ophyd-async into move-multiplier-to-first-dim
…ve-multiplier-to-first-dim
Agreed.
I think I've got some terminology confused. In my mind we're mapping:
As defined in https://areadetector.github.io/areaDetector/ADCore/ADDriver.html All of those fields in
I think I made a mistake in the current implementation, the passed in TriggerInfo should be immutable and we make a copy with a different deadtime. That would stop any surprises when a |
My understanding of the
Agreed! I think this would be great.
Yes currently it modifies the existing |
This PR does the following:
multiplier
->frames_per_event
frames_per_event
as the first dimension ofDataKey.shape
DetectorWriter.get_indices_written()
andDetectorWriter.observe_indices_written()
is divided byframes_per_event
so that it actually captures the correct amount of exposures in each index (except for PandA which explicitly says it only has 1 "frame" per event)Add unit tests showing that stream resources are actually batches of exposuresself._writer.open()
andself._writer.get_indices_written()
. The writer needs to be opened in order to get the indices written. Otherwise, it has no idea whatframes_per_event
to use when returning the index last written.I could not actually add tests using bluesky plans and inspecting the data afterword because
TriggerInfo
is hardcoded inStandardDetector
. I think it is a separate issue that should be raised since it would enhance the scope of this PR. I will open an issue for this soon and mention it below.Otherwise, I have a few open questions regarding my understanding of ophyd-async as well as the implementation which I will also leave as review comments. Please see below.
Closes #576
Closes #431