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-1.0.0.tar.gz (285.0 kB view details)

Uploaded Source

Built Distribution

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

scanspec-1.0.0-py3-none-any.whl (37.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for scanspec-1.0.0.tar.gz
Algorithm Hash digest
SHA256 31d297861978e56bb6cfcaa15527bad5ba3dc158b3fc52142ecb5611a22e1b5a
MD5 3022306c68100056baca09931c13d8e4
BLAKE2b-256 03c37b3621a0eec53b7e348457de68a33a93314c5626523ab1481395811aa09e

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for scanspec-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4ad6dccd6ac19dbd8af888c80c5db53c70d6b8aee9d26c0ca174cebd3c396730
MD5 7a4d9819734e06d12180fa5549ab15d0
BLAKE2b-256 68b9f44b139096467996b4d85589d9880fd55f0c80a204d298a1b73d0adc2654

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