Skip to main content

Code for use in lab environment: experiment automation, data acquisition, device communication

Project description

Overview

PyLabLib aims to provide support for device control and experiment automation. It interfaces with lots of different of devices, including several different camera interfaces, translational stages, oscilloscopes, AWGs, sensors, and more. The interface is implemented in a natural way through Python objects, and is easy to understand. For example, here is a complete script which steps Thorlabs KDC101 stage by 10000 steps ten times, and each time grabs a frame with Andor iXon camera:

from pylablib.devices import Thorlabs, Andor  # import the device libraries
import numpy as np  # import numpy for saving

# connect to the devices
with Thorlabs.KinesisMotor("27000000") as stage, Andor.AndorSDK2Camera() as cam:
    # change some camera parameters
    cam.set_exposure(50E-3)
    cam.set_roi(0, 128, 0, 128, hbin=2, vbin=2)
    # start the stepping loop
    images = []
    for _ in range(10):
        stage.move_by(10000)  # initiate a move
        stage.wait_move()  # wait until it's done
        img = cam.snap()  # grab a single frame
        images.append(img)

np.array(images).astype("<u2").tofile("frames.bin")  # save frames as raw binary

The list of the devices is constantly expanding.

Additional utilities are added to simplify data acquisition, storage, and processing:

  • Simplified data processing utilities: convenient fitting, filtering, feature detection, FFT (mostly wrappers around NumPy and SciPy).

  • Universal multi-level dictionaries which are convenient for storing heterogeneous data and settings in human-readable format.

  • Assorted functions for dealing with file system (creating, moving and removing folders, zipping/unzipping, path normalization), network (simplified interface for client and server sockets), strings (conversion of various Python objects to and from string), and more.

The most recent version of the library is available on GitHub (https://github.com/AlexShkarin/pyLabLib), and the documentation can be found at https://pylablib.readthedocs.io/ .

Requirements

  • Python 3 (tested with 3.6+)

  • Most extensively tested with Windows 10 and 64-bit Python. Linux is, in principle, supported, but devices which require manufacturer-provided DLLs (mostly cameras) might, potentially, have problems.

  • Basic version only needs numpy, SciPy and pandas. Advanced device communication packages (such as PyVISA and pySerial) are automatically installed, but can be avoided if necessary.

  • Some devices might require additional software. If this is the case, the requirements are mentioned on the corresponding page.

Installation

You can install the library from PyPi:

pip install pylablib

More options are described in the 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

pylablib-lightweight-1.3.2.tar.gz (1.2 MB view details)

Uploaded Source

Built Distribution

pylablib_lightweight-1.3.2-py3-none-any.whl (1.4 MB view details)

Uploaded Python 3

File details

Details for the file pylablib-lightweight-1.3.2.tar.gz.

File metadata

  • Download URL: pylablib-lightweight-1.3.2.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.6.5

File hashes

Hashes for pylablib-lightweight-1.3.2.tar.gz
Algorithm Hash digest
SHA256 50bceebea86cd00f42358d556ae28b2b17784b83b6d0e738ec71f4f01e345216
MD5 f8891119159b55c4059e43c8a3ac4a6d
BLAKE2b-256 a3dd4640d00ade6cfa1a921925166d2fdefa0e51b63be89f26cd3f9211994464

See more details on using hashes here.

File details

Details for the file pylablib_lightweight-1.3.2-py3-none-any.whl.

File metadata

  • Download URL: pylablib_lightweight-1.3.2-py3-none-any.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.6.5

File hashes

Hashes for pylablib_lightweight-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 58a9136033d2509961d5a2a71c463784855e747ba7b5e8ca2a656033e2d9153f
MD5 a80d08249a6ae68f4738e66d4ace9cbc
BLAKE2b-256 0a8501067ec27ccbd294d74bd8d8799ca6b6a93d9a7ca5a7b6488bd03600c84e

See more details on using hashes here.

Supported by

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