Skip to main content

ALP4lib

ALP4lib is a Python module to control Vialux DMDs based on ALP4.X and ALP5.X API. This is not an independant open source module, it uses the .dll (Windows) or .so (Linux) files provided by Vialux. This software is experimental, use it at your own risk.

What is it?

This module wraps the basic function of the Vialux libraries to control a digitial micro-mirror device with a Vialux board. Vialux provides dlls (Windows) and shared libraries (Linux), and also modules for Matlab and Labview but not for Python. This code is tested with a device using the 4.3 version of the ALP API on Windows and Linux, other versions may have issues. LED control related functions are not implemented. Please read the ALP API description provided with the Vialux ALP installation.

Requirements

  • Windows 32 or 64, or Linux x86_64,
  • Vialux drivers and the ALP4.X or ALP5.X dll files (Windows) or the ALP shared libraries (Linux) available for download on Vialux website,
  • Compatible Python 2.7 and 3.X.

Citing the code

If the code was helpful to your work, please consider citing it:

DOI

Installation

Manual installation

Just copy the ALP4.py file in the working directory.

Automatic installation

To automatically download and copy the module in the python directory (so it can be available from anywhere), run the command:

pip install ALP4lib

Installation from source (Github)

To install the latest version from Github, clone the repository, and install the package with the following command.

pip install .

Instead of the normal installation, if you want to install ALP4lib in development mode, use:

pip install -e .

Copy the .dll/.so

Windows

The win32 ALPX.dll files could be directly in the working directory and the win64 dll with the same name in a /x64 subfolder. If no directory is given, the module reads the ALP installation path from the Windows registry and looks for the API folder (ALP-4.X high-speed API for ALP 4.X, ALP-5.X API for ALP 5.X, e.g. C:\Program Files\ALP-5.0\ALP-5.0 API\). Alternatively, a different dll directory can be set at the initialization of the DMD handler object with the libDir argument. The dlls have the following names respectively for the 4.1, 4.2, 4.3, 4.4, 5.0 and 5.1 versions of the ALP API: 'alpD41.dll', 'alpV42.dll', 'alp4395.dll', 'Alp44.dll', 'alp50.dll' and 'alp51.dll'.

Linux

Install the Vialux Linux drivers and ALP shared libraries following the Vialux documentation. By default, the module looks for the library in /usr/lib/x86_64-linux-gnu/. A different directory can be set at the initialization of the DMD handler object with the libDir argument. The shared libraries have the following names for the 4.1, 4.2, 4.3, 4.4, 5.0 and 5.1 versions of the ALP API: 'libalp41.so', 'libalp42.so', 'libalp43.so', 'libalp44.so', 'libalp50.so' and 'libalp51.so'.

from ALP4 import *

# Default library directory (/usr/lib/x86_64-linux-gnu/ on Linux)
DMD = ALP4(version = '4.3')

# Custom library directory
DMD = ALP4(version = '4.3', libDir = '/opt/vialux/lib/')

A simple example

import numpy as np
from ALP4 import *
import time

# Load the Vialux library (.dll on Windows, .so on Linux)
DMD = ALP4(version = '4.3')
# Initialize the device
DMD.Initialize()

# Binary amplitude image (0 or 1)
bitDepth = 1    
imgBlack = np.zeros([DMD.nSizeY,DMD.nSizeX])
imgWhite = np.ones([DMD.nSizeY,DMD.nSizeX])*(2**8-1)
imgSeq  = np.concatenate([imgBlack.ravel(),imgWhite.ravel()])

# Allocate the onboard memory for the image sequence
DMD.SeqAlloc(nbImg = 2, bitDepth = bitDepth)
# Send the image sequence as a 1D list/array/numpy array
DMD.SeqPut(imgData = imgSeq)
# Set image rate to 50 Hz
DMD.SetTiming(pictureTime = 20000)

# Run the sequence in an infinite loop
DMD.Run()

time.sleep(10)

# Stop the sequence display
DMD.Halt()
# Free the sequence from the onboard memory
DMD.FreeSeq()
# De-allocate the device
DMD.Free()

Metadata

Release files for ALP4lib 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ALP4lib 1.1.0
File Size Uploaded
alp4lib-1.1.0.tar.gz 19.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ALP4lib 1.1.0
File Interpreter ABI Platform
alp4lib-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 36.9 kB

Release files / alp4lib-1.1.0.tar.gz

Download URL alp4lib-1.1.0.tar.gz
Size 19.4 kB
Tags Source
SHA-256 checksum
How to use checksums
59991c18144961652462b04cc98f4fc83a49c31a719819aa3340dedc2887bb41
BLAKE2b-256 checksum
How to use checksums
b1770de4044a29aca26679b5fb97d0a015cce96459db82f5e0dd81c1b8291601
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release files / alp4lib-1.1.0-py3-none-any.whl

Download URL alp4lib-1.1.0-py3-none-any.whl
Size 17.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b3de04b0c2fa8b1d8cb91accdf37332be4a29d24ebc00f918a33ea896e8e0bc0
BLAKE2b-256 checksum
How to use checksums
a307f16f5053b3f6199ce352d34482806e1611045a8160eb8047ca215828121c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

0.0.5

2 release files

0.0.4.1

1 release file

0.0.3-2

1 release file

0.0.3-1

1 release file

0.0.3

1 release file

0.0.2

1 release file

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