bluesky / ophyd-async

Hardware abstraction for bluesky written using asyncio
https://blueskyproject.io/ophyd-async
BSD 3-Clause "New" or "Revised" License
8 stars 24 forks source link

Change Pmac Trajectory calculation to numpy operations #494

Open tomtrafford opened 1 month ago

tomtrafford commented 1 month ago
          Eventually we should make these numpy operations so we get some speed, but this will do for now.

We also need to make sure that we put lower and midpoint points in here, but that can also be a point for later.

_Originally posted by @coretl in https://github.com/bluesky/ophyd-async/pull/440#discussion_r1687608566_

coretl commented 1 month ago

The whiteboard scribbling:

# Need to do this for each gap
start, stop = calculate_next_gap_from(frames)
positions[0] = frames.lower[axis][start]
positions[1:(stop-start)*2+1:2] = frames.midpoints[axis][start:stop]
positions[2:(start-stop)*2+2:2] = frames.upper[axis][start:stop]
velocities = positions[axis][1:] - positions[axis][:-1] / frames.midpoints["DURATION"]  # This isn't right as the arrays are the wrong length, but it gives the gist...