A real-time laser beam profiler for Thorlabs DCC1545M-GL cameras, built with PySide6 and pyqtgraph. When no hardware is connected, it falls back to a synthetic Gaussian beam for testing.
- Live 2D beam image with selectable colormaps (Gray, Viridis, Inferno, Plasma, Magma, Cividis, Turbo) and linear/log intensity scale
- Axes in µm using the camera sensor geometry
- Projection modes: sum projection, slice at cursor, slice at peak intensity (default)
- ROI selection with zoom-to-ROI (applies to main image and projections)
- Centroid and FWHM tracking with live trend plots
- Auto-exposure
- Fluence calculator (µJ/cm²) with selectable beam-area model:
FWHM/2or1/eradii - Draggable crosshair markers
- Simple mode (default) for maximum frame rate; full mode adds trends and advanced metrics
- Multi-camera support — when multiple cameras are connected, a dialog lets you choose by serial number; run the script twice to use two cameras simultaneously
- Export snapshots as PNG, HDF5 (.h5), or ASCII (.txt)
- Analysis snapshot figure with Gaussian fits for integral and slice projections including FWHM values in the legend
- Synthetic camera fallback when no hardware is available
- Python 3.11+ (tested with 3.13)
- DCx / uc480 SDK for the Thorlabs DCC1545M-GL.
This repository includes the legacy SDK files under
dcx_camera_interfaces_2018_09/. The driver DLL (uc480_64.dll) is loaded viactypes— no additional pip package is required.
# Clone the repository
git clone <repo-url>
cd beamprofiler-main
# Create a virtual environment (recommended)
python -m venv .venv
# Activate the virtual environment
# Windows PowerShell:
.venv\Scripts\Activate.ps1
# Windows cmd:
.venv\Scripts\activate.bat
# Install dependencies
pip install -r requirements.txtpython beamprofiler_qt_Thorcam.pyIf multiple Thorlabs cameras are connected, a dialog will appear letting you select one by serial number. To open a second camera, run the script again in a separate terminal and pick the other serial number.
If no camera hardware is detected, the application starts in synthetic mode with a simulated Gaussian beam.
| File | Description |
|---|---|
beamprofiler_qt_Thorcam.py |
Main application — Thorlabs DCx beam profiler with full Qt UI |
requirements.txt |
Python dependencies |
run_demo.bat |
Windows batch launcher |
dcx_camera_interfaces_2018_09/ |
Legacy DCx / uc480 SDK (drivers, headers, firmware) |
The fluence panel offers two selectable models:
- Top-hat with FWHM/2 radii (default)
- Top-hat with 1/e radii
The active formula is shown directly in the UI so the current calculation model is always visible.
Using the Snapshot button stores:
- A rendered
.pngimage - A
.h5file containing a Python-readable xarray dataset withx_umandy_umcoordinates and image/projection data in counts - An analysis figure (
.png) with Gaussian fits for both integral and slice projections, including FWHM values in the legends - An ASCII
.txtexport of the raw image data