Skip to main content

atsbindings

Python bindings for the AlazarTech C API built using ctypes. This library provides a relatively thin layer over the C API, offering direct function mapping. In prinicple, all AlazarTech boards are supported; however, please see the Board Notes section below for tested models and specific quirks.

Developers familiar with the AlazarTech API can get started quickly. For those with limited experience, it is recommended to read the official API Programmer's Guide and review the acquisition.py example to understand how the bindings translate into Python.

PyPI PyPI - Downloads

Design

  • Pythonic Naming Convention:
    C API functions are renamed to follow Python conventions with the leading "Alazar" namespace removed. For example:
    • AlazarSetCaptureClock()set_capture_clock()
  • Board Class:
    Functions requiring a board handle as the first argument are grouped into a Board class. This class automatically manages the board handle.
  • Buffer Class:
    Simplifies configuration for AutoDMA transfer by automatically setting up a ctypes array of the correct type and size. Includes:
    • Methods for converting acquired data to a NumPy array.
    • Support for interleaved channels.
    • Support for 12-bit unpacking (currently slow).
  • Enumerations:
    Enumerations (under the Ats namespace) include helper methods to:
    • Convert to and from string representations.
    • Create values from integer and floating-point inputs.
      Example:
      >>> from atsbindings import Ats
      >>> sample_rate = 250e6
      >>> Ats.SampleRates.from_hertz(2 * sample_rate)
      <SampleRates.SAMPLE_RATE_500MSPS: 48>
      
  • BoardSpecificInfo:
    Provides board-specific parameters and feature details, as described in the API documentation.
    See the get_board_specific_info.py example for usage.
  • System Class:
    Offers system-level information such as:
    • Number of boards detected.
    • DLL versions.
    • Other global properties.

Features Not Included

  • High-Level API:
    A more pythonic interface is beyond the scope of this wrapper package. See the Dirigo plugin for a higher level API.
  • Single-Port Acquisitions:
    Deprecated, lower-performance data transfer method.
  • Linux Support:
    Currently, this library supports Windows only.
  • Miscellaneous Functions:
    Some less commonly used functions have been omitted for clarity. Contact TDW if you need something not currently available.

Limitations

While this library closely wraps the C API, the Python interpreter introduces some overhead that may affect performance in certain scenarios. To minimize this impact:

  • Limit the frequency of wrapper calls.
  • Use relatively large buffer sizes for data transfer. (Alazar documentation suggest setting the buffer size between 1 MB and 16 MB.)

Installation

  1. Install the Digitizer Driver:
    Download and install the appropriate driver from the AlazarTech downloads page.
  2. Install Alazar DSO:
    Download and install the Alazar DSO software to verify hardware functionality.
  3. Install the Digitizer:
    Power down the computer, install the digitizer in an appropriate extension slot, and power up.
  4. Test with Alazar DSO:
    Run Alazar DSO to confirm the card is functioning correctly. If the card does not work in DSO, it will not work with atsbindings!
  5. Install atsbindings:
    Install atsbindings from PyPI (or clone this repository and install it with pip). Using a virtual environment manager such as Conda is recommended.
  6. Run Examples:
    Try the example scripts in the examples folder to validate your installation.

Board Notes

This library has been tested with the following boards:

  • ATS9373:
    • For 2-channel acquisiton, samples must be interleaved.
    • No Traditional AutoDMA mode on this board.
  • ATS9870:
  • ATS9351
  • ATS9350
  • ATS9440
  • ATS460

Not supported:

  • ATS9370
    • No longer listed on Alazar website. Incomplete information in BSI table.

Contributing

Suggestions are welcome! Please message the developer directly. Pull requests will not be accepted.

Legal Disclaimer

This library is provided "as is" without any warranties, express or implied, including but not limited to the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. The authors are not responsible for any damage to hardware, data loss, or other issues arising from the use or misuse of this library. Users are advised to thoroughly test this library with their specific hardware and configurations before deployment.

This library depends on the AlazarTech C API and its associated drivers, which must be installed and configured separately. Compatibility and performance depend on the proper installation and operation of these third-party components.

This library is an independent implementation based on publicly available documentation from AlazarTech. It is not affiliated with, endorsed by, or officially supported by AlazarTech.

Use this library at your own risk. Proper operation of hardware and compliance with applicable laws and regulations is the sole responsibility of the user.

This project is licensed under the MIT License. See the LICENSE file for details.

Funding

Development has been supported in part by the National Cancer Institute of the National Institutes of Health under award number R01CA249151.

The content of this repository is solely the responsibility of the authors and does not necessarily represent the official views of the National Institutes of Health.

Download files

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

Source Distribution

atsbindings-0.2.4.tar.gz (29.8 kB view details)

Uploaded Source

Built Distribution

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

atsbindings-0.2.4-py3-none-any.whl (27.6 kB view details)

Uploaded Python 3

File details

Details for the file atsbindings-0.2.4.tar.gz.

File metadata

  • Download URL: atsbindings-0.2.4.tar.gz
  • Upload date:
  • Size: 29.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for atsbindings-0.2.4.tar.gz
Algorithm Hash digest
SHA256 083196972e8fb24e5065830cdcd346f6d050f67100f164a97b54ae44974f73c1
MD5 1c159cd19eb15c6b74b7b179fc1ff2ee
BLAKE2b-256 7b196744f91de6f9e5be0df82f8671063bf38f6cadb99ffddd2f02d3b3580b71

See more details on using hashes here.

File details

Details for the file atsbindings-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: atsbindings-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 27.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for atsbindings-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8801147893ba6d241afb584bb35e54de526fcd564b9e4ade3cd0b925a8d9b44d
MD5 d9d268d42779e0fffe2955bbba432935
BLAKE2b-256 b726f2bb9db1d8741535dac2d44e94ef03b028359f198517e00e9f1867257549

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.4 This release

2 files

0.2.3

2 files

0.2.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page