Specify step and flyscan paths in a serializable, efficient and Pythonic way
Project description
scanspec
Specify step and flyscan paths in a serializable, efficient and Pythonic way using combinations of:
- Specs like Line or Spiral
- Optionally Snaking
- Zip, Product and Concat to compose
- Masks with multiple Regions to restrict
Serialize the Spec rather than the expanded Path and reconstruct it on the server. It can them be iterated over like a cycler, or a stack of scan Frames can be produced and expanded Paths created to consume chunk by chunk.
Source | https://github.com/bluesky/scanspec |
---|---|
PyPI | pip install scanspec |
Docker | docker run ghcr.io/bluesky/scanspec:latest |
Documentation | https://bluesky.github.io/scanspec |
Releases | https://github.com/bluesky/scanspec/releases |
An example ScanSpec of a 2D snaked grid flyscan inside a circle spending 0.4s at each point:
from scanspec.specs import Line, fly
from scanspec.regions import Circle
grid = Line(y, 2.1, 3.8, 12) * ~Line(x, 0.5, 1.5, 10)
spec = fly(grid, 0.4) & Circle(x, y, 1.0, 2.8, radius=0.5)
Which when plotted looks like:
Scan points can be iterated through directly for convenience:
for point in spec.midpoints():
print(point)
# ...
# {'y': 3.1818181818181817, 'x': 0.8333333333333333, 'DURATION': 0.4}
# {'y': 3.1818181818181817, 'x': 0.7222222222222222, 'DURATION': 0.4}
or a Path created from the stack of Frames and chunks of a given length consumed from it for performance:
from scanspec.core import Path
stack = spec.calculate()
len(stack[0]) # 44
stack[0].axes() # ['y', 'x', 'DURATION']
path = Path(stack, start=5, num=30)
chunk = path.consume(10)
chunk.midpoints # {'x': <ndarray len=10>, 'y': <ndarray len=10>, 'DURATION': <ndarray len=10>}
chunk.upper # bounds are same dimensionality as positions
See https://bluesky.github.io/scanspec for more detailed documentation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file scanspec-0.7.6.tar.gz
.
File metadata
- Download URL: scanspec-0.7.6.tar.gz
- Upload date:
- Size: 141.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf462b0b1481c22804372448044ceab50a9d5f6e84760c89699228f8e0eef3ec |
|
MD5 | ea8e0248db6263fd927225fb7e65db39 |
|
BLAKE2b-256 | 214746943c20fbb78fee75b56b36ad805dcf42b880861b4fa840b8c302fb528c |
File details
Details for the file scanspec-0.7.6-py3-none-any.whl
.
File metadata
- Download URL: scanspec-0.7.6-py3-none-any.whl
- Upload date:
- Size: 37.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a934b31f08f24ba5fd44f925300645266c9adb1ee07df9bb6cf076ffc64f8c40 |
|
MD5 | 3fc9b4d3edb2861876e63c2d9930fa88 |
|
BLAKE2b-256 | e7141ea5a5c431c97d9e3838fe14eca11771387b09f672760560ae5d3f3d8453 |