-
Notifications
You must be signed in to change notification settings - Fork 0
Adds our own CoM callback #106
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
base: main
Are you sure you want to change the base?
Conversation
|
||
|
||
@make_class_safe(logger=logger) # pyright: ignore (pyright doesn't understand this decorator) | ||
class PeakStats(_DefaultPeakStats): |
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 should use this in our standard callbacks class - if this ticket is merged before #104 i will add it in, if not i think this PR should
#108 Will fix the above errors |
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 going to push some stuff to a trapeze
branch and we should probably chat tomorrow... I found some extra-fun edge cases that I hadn't previously considered...
e.g. this case:
def test_tricky_non_constant_spacing():
ps.start({})
ps.event({"data": {"x": 0, "y": 1}})
ps.event({"data": {"x": 0.1, "y": 1}})
ps.event({"data": {"x": 4, "y": 1}})
ps.event({"data": {"x": 5, "y": 0}})
ps.event({"data": {"x": 6, "y": 1}})
ps.event({"data": {"x": 10, "y": 1}})
ps.stop({})
assert ps["com"] == 5.0
|
||
|
||
@make_class_safe(logger=logger) # pyright: ignore (pyright doesn't understand this decorator) | ||
class PeakStats(_DefaultPeakStats): |
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.
Sorry I know I've gone back and forth on this, but I'm not fully convinced it's a good idea to subclass _DefaultPeakStats
here actually - the upstream one has __slots__
defined and some other potential traps.
Maybe here it is better to just make a standalone callback... subclassing CollectThenCompute
or similar.
We could not use Bluesky's centre of mass callback as it was not suited for the way we would want to use it, so this is our implementation for one.
To test: