Skip to content

Comments

Adds our own CoM callback#106

Closed
jackbdoughty wants to merge 9 commits intomainfrom
com_callback
Closed

Adds our own CoM callback#106
jackbdoughty wants to merge 9 commits intomainfrom
com_callback

Conversation

@jackbdoughty
Copy link
Contributor

@jackbdoughty jackbdoughty commented Feb 10, 2025

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:

  • Make sure that all tests pass.
  • Run the following scans and check that you get sensible CoMs for each. (Send me a message if you need to know how to set up to scan blocks against eachother / create fake data):
    • A scan with non constant point spacing.
    • A scan where some of the values are negative / have a background.
    • The "there-and-back" scan so x points would be like: -2 -1 0 1 2 1 0 -1 -2. (Non continuous points)

@jackbdoughty jackbdoughty mentioned this pull request Feb 10, 2025
1 task
@jackbdoughty
Copy link
Contributor Author

#108 Will fix the above errors

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.

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

@jackbdoughty jackbdoughty deleted the com_callback branch June 27, 2025 10:19
@jackbdoughty jackbdoughty restored the com_callback branch June 27, 2025 11:59
@jackbdoughty jackbdoughty deleted the com_callback branch June 27, 2025 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants