Skip to content

Commit

Permalink
Changes to step_to_num to match expected behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
DiamondJoseph committed Oct 12, 2023
1 parent 7c2724b commit d6f48fa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/dls_bluesky_core/core/maths.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ def step_to_num(start: float, stop: float, step: float) -> Tuple[float, float, i
"""
# Make step be the right direction
step = abs(step) if stop > start else -abs(step)
step = abs(step) if stop >= start else -abs(step)
# If stop is within 1% of a step then include it
num = int((stop - start) / step + 0.01)
return start, start + num * step, num
steps = int((stop - start) / step + 0.01)
return start, start + steps * step, steps + 1 # include 1st point


def in_micros(t: float) -> int:
Expand All @@ -44,4 +44,4 @@ def in_micros(t: float) -> int:
t (int): A time in seconds rounded up to the nearest whole second,
or other measurement in units of U, rounded up to the nearest whole U.
"""
return np.ceil(t / 1e6)
return int(np.ceil(t / 1e6))

0 comments on commit d6f48fa

Please sign in to comment.