Skip to content

Commit

Permalink
Update docstring tests for np.array behaviour in numpy 2
Browse files Browse the repository at this point in the history
  • Loading branch information
DiamondJoseph committed Aug 6, 2024
1 parent ee67653 commit a5632ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions docs/how-to/iterate-a-spec.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ frame. You can get these by using the `Spec.midpoints()` method to produce a
>>> for d in spec.midpoints():
... print(d)
...
{'x': 1.0}
{'x': 1.5}
{'x': 2.0}
{'x': np.float64(1.0)}
{'x': np.float64(1.5)}
{'x': np.float64(2.0)}

This is simple, but not particularly performant, as the numpy arrays of
points are unpacked point by point into point dictionaries
Expand Down
8 changes: 4 additions & 4 deletions src/scanspec/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,10 +613,10 @@ class Midpoints(Generic[Axis]):
>>> fy = Frames({"y": np.array([3, 4])})
>>> mp = Midpoints([fy, fx])
>>> for p in mp: print(p)
{'y': 3, 'x': 1}
{'y': 3, 'x': 2}
{'y': 4, 'x': 2}
{'y': 4, 'x': 1}
{'y': np.int64(3), 'x': np.int64(1)}
{'y': np.int64(3), 'x': np.int64(2)}
{'y': np.int64(4), 'x': np.int64(2)}
{'y': np.int64(4), 'x': np.int64(1)}
"""

def __init__(self, stack: List[Frames[Axis]]):
Expand Down

0 comments on commit a5632ed

Please sign in to comment.