Skip to main content

Hardware interfacing code for the Autonomous Formulation Lab

Project description

NIST Autonomous Formulation Laboratory - Automation Software

This package contains the core laboratory automation software used in the NIST AFL platform.

Its core is the 'DeviceServer' API, a simple way of exposing functionality in simple Python classes to the outside world via HTTP servers. It includes robust item queueing support, output rendering, and hooks to allow for 'smart' generation of user interfaces automatically.

Specific deviceserver instances are provided for a variety of hardware used in the AFL platform: syringe pumps, valves, multiposition flow selectors, UV-Vis spectrometers, x-ray and neutron scattering instruments/beamlines. There are further deviceserver classes that integrate these base devices to perform higher-level functions, e.g. "loading". These classes aim to specify instructions for running a particular protocol in a hardware-agnostic way.

Virtual servers for offline testing

Several stub modules are provided so you can launch the AFL stack without any physical hardware. Running one of these modules the first time creates ~/.afl/config.json containing the Tiled server URL, API key and port bindings. Update this file as needed.

Example commands to start the dummy services:

# start a dummy OT2 robot
python -m AFL.automation.prepare.Dummy_OT2_Driver

# start a virtual sample loader
python server_scripts/virtual_instrument/DummyLoader.py

# optional virtual detectors
python server_scripts/virtual_instrument/VirtualSANS_data.py
python server_scripts/virtual_instrument/VirtualSpec_Data.py

For a full offline demo you can start everything at once:

python server_scripts/virtual_instrument/AllDummy.py

These stub servers expose the same HTTP API as the real hardware allowing you to test an AFL workflow entirely in software.

Production deployment

By default the APIServer will use the waitress WSGI server if it is installed. To fall back to Flask's built-in server pass --no-waitress to AFL.automation.shared.launcher.

Running tests

This repository uses pytest for unit tests. A GitHub Actions workflow runs the tests automatically on every push and pull request using .github/workflows/test.yaml. The workflow installs the package along with the dependencies listed in pyproject.toml.

To execute the tests locally, install the package in editable mode and run pytest. If the installation fails because the package version cannot be determined from Git tags, set SETUPTOOLS_SCM_PRETEND_VERSION=0.0.0 as in the CI workflow:

SETUPTOOLS_SCM_PRETEND_VERSION=0.0.0 pip install -e .
pytest

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

afl_automation-1.2.0.tar.gz (18.9 MB view details)

Uploaded Source

Built Distribution

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

afl_automation-1.2.0-py3-none-any.whl (19.6 MB view details)

Uploaded Python 3

File details

Details for the file afl_automation-1.2.0.tar.gz.

File metadata

  • Download URL: afl_automation-1.2.0.tar.gz
  • Upload date:
  • Size: 18.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for afl_automation-1.2.0.tar.gz
Algorithm Hash digest
SHA256 a0c20dbad4c83c53a22c85044bef8e65a3bf0244df533d21d1fa88b279d21d94
MD5 03a036f947c24a677323d9ca1b72ecbe
BLAKE2b-256 40eab9d573341510af8f5675ae7d9c3312eaefcd7bb1a895b095fdf6e336f164

See more details on using hashes here.

Provenance

The following attestation bundles were made for afl_automation-1.2.0.tar.gz:

Publisher: publish-to-pypi.yml on usnistgov/AFL-automation

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file afl_automation-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: afl_automation-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 19.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for afl_automation-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 083fc705b03a34e471668eaa2206d48314e0ca6335f5e814b2b5dc3f040d74b7
MD5 9762a4a6e9768bf79720b15b9d417476
BLAKE2b-256 2614b76847ac147550f21a3572586e7883985ac2c486b303c27fcd76e6a0d9d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for afl_automation-1.2.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on usnistgov/AFL-automation

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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