Skip to content
PVSensors

Using the ASEQ Spectrometer Python Driver on macOS, Linux and Windows

How to install our open-source Python driver for ASEQ Instruments USB spectrometers (LR1 / HR1 series) on macOS, Linux and Windows, configure the acquisition and record your first spectrum.

September 13, 2025·3 min read

ASEQ Instruments (Vancouver, Canada) makes compact fiber-input USB spectrometers - the broad-range LR1 and high-resolution HR1, also as thermoelectrically cooled LR1-T / HR1-T versions. The manufacturer ships examples for LabVIEW and Visual C++. To use the spectrometers from Python, we wrote an open-source driver: ASEQSpectrometer on GitHub (MIT licence).

The driver is a thin Python wrapper around the vendor library libspectr, which the repository includes for all three operating systems:

OSLibrary in lib/
Windowslibspectr64bit.dll (64-bit Python) or libspectr.dll (32-bit)
macOSlibspectr.dylib
Linuxlibspectr.so

Updated November 2026: the driver and this post now use the correct manufacturer name, ASEQ.


1. Installation

Clone the repository and install the dependencies (NumPy, Matplotlib):

git clone https://github.com/PVSensors/ASEQSpectrometer.git
cd ASEQSpectrometer
pip install -r requirements.txt

Connect the spectrometer by USB before running the scripts.

  • macOS: if macOS refuses to load the library ("cannot be opened because the developer cannot be verified"), allow it once in System Settings → Privacy & Security, or run xattr -d com.apple.quarantine lib/libspectr.dylib.
  • Linux: if the device is found only with sudo, add a udev rule that gives your user access to the spectrometer's USB device.
  • Windows: use the 64-bit library with 64-bit Python (the default today).

2. Connect and record a spectrum

import matplotlib.pyplot as plt
from libspectr import ASEQSpectrometer

spec = ASEQSpectrometer()          # open the first connected spectrometer
spec.configure_acquisition()       # send the default settings to the device

wavelength, intensity = spec.normalize_spectrum()

plt.plot(wavelength, intensity)
plt.xlabel("Wavelength (nm)")
plt.ylabel("Intensity (a.u.)")
plt.title("ASEQ spectrometer")
plt.show()

Save it as test_spectrum.py and run python test_spectrum.py - a window with the measured spectrum opens.

3. Change the exposure time and averaging

Default settings: 1 scan, no blank scans, exposure_time = 1000 (10 ms), scan mode 3 (frame averaging), all 3648 CCD pixels, no pixel binning. Change any of them and re-configure:

spec.set_parameters(exposure_time=2500, num_of_scans=10)   # 25 ms, average 10 frames
spec.configure_acquisition()
ParameterRangeMeaning
num_of_scans1-137spectra averaged per measurement
num_of_blank_scans0-137background (dark) frames
exposure_time≥ 1000integration time (1000 = 10 ms)
scan_mode0-30 continuous with trigger, 1 wait for trigger, 2 idle between frames, 3 frame averaging
num_of_start_element, num_of_end_element0-3647CCD pixel range
reduction_mode0-3pixel binning 1:1, 2:1, 4:1, 8:1

4. Raw, background-subtracted, normalised or calibrated data

raw = spec.get_spectrum()                              # raw counts per pixel
dark_corrected = spec.subtract_background()            # background subtracted
wavelength, intensity = spec.normalize_spectrum()      # normalised, vs wavelength
wavelength, power = spec.get_calibrated_spectrum()     # irradiance, µW/cm²/nm

5. Live view

The repository has three ready scripts that update a plot in real time (press q to stop):

python spectrum.py          # raw counts vs pixel
python spectrum_norm.py     # normalised spectrum
python spectrum_calib.py    # calibrated (power) spectrum

With the driver, ASEQ spectrometers fit into Python workflows for photovoltaics, LED and light-source testing, absorption and Raman measurements. Questions, bug reports and pull requests are welcome on GitHub.

ASEQ, LR1 and HR1 are names of ASEQ Instruments. This driver is developed by PV Sensors and is not an official ASEQ Instruments product.