Skip to main content

Specify step and flyscan paths in a serializable, efficient and Pythonic way

Project description

CI Coverage PyPI License

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

Serialize the Spec rather than the expanded Path and reconstruct it on the server. It can then 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 Ellipse, Fly

spec = Fly(0.4 @ Ellipse(x, 1, 1, 1/9, y, 2.8, y_step=1.7/11, snake=True))

Which when plotted looks like:

plot

Scan points can be iterated through directly for convenience:

for point in spec.midpoints():
    print(point)
# ...
# {'y': 3.1818181818181817, 'x': 0.8333333333333333}
# {'y': 3.1818181818181817, 'x': 0.7222222222222222}

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']

path = Path(stack, start=5, num=30)
chunk = path.consume(10)
chunk.midpoints  # {'x': <ndarray len=10>, 'y': <ndarray len=10>}
chunk.upper  # bounds are same dimensionality as positions
chunk.duration # duration of each frame

See https://bluesky.github.io/scanspec for more detailed documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scanspec-0.10.0.tar.gz (266.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scanspec-0.10.0-py3-none-any.whl (37.7 kB view details)

Uploaded Python 3

File details

Details for the file scanspec-0.10.0.tar.gz.

File metadata

  • Download URL: scanspec-0.10.0.tar.gz
  • Upload date:
  • Size: 266.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for scanspec-0.10.0.tar.gz
Algorithm Hash digest
SHA256 8d0d93c4b5a3c74d983a38c6f6001d3cc574429a7a26604a31a61b82c373f0a9
MD5 14f11b393bda1c7d3c86a87e2b327e27
BLAKE2b-256 7b7c9d9de144ca0e0be895caf824f30e2c8d809c032b248fb3a6c92a4df30660

See more details on using hashes here.

File details

Details for the file scanspec-0.10.0-py3-none-any.whl.

File metadata

  • Download URL: scanspec-0.10.0-py3-none-any.whl
  • Upload date:
  • Size: 37.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for scanspec-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0979cdcf9790573478f863c36844e1446e87996f945b1bd9c1dcbd7fb663ad92
MD5 b758ee893e716aaba41b9de174cfd116
BLAKE2b-256 f86d8500f4bece0aa7cd2af374739f2944c9fa52f0fc5e1d9e65a366f37f494a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page