Python interface for the Gentec Beamage 4M IR beam profiling camera, providing programmatic access to beam capture and analysis capabilities.
This package provides a Python wrapper for the Gentec Beamage SDK, enabling automated beam profiling and data acquisition for infrared laser characterization. The interface supports:
- Automated beam capture with configurable exposure settings
- Real-time beam analysis (4-sigma diameter, centroid position, FPS)
- FITS file output with comprehensive metadata headers
- NumPy array integration for seamless data processing
- Matplotlib visualization with automatic beam analysis plots
Developed for the CREOL Astrophotonics Lab at the University of Central Florida.
-
PC-BEAMAGE Software (Gentec-EO)
- Download and install from Gentec-EO website
- Includes necessary USB drivers for camera communication
- Verify camera connectivity using the PC-BEAMAGE GUI before using this tool
-
Beamage SDK (C# DLL)
- Obtain SDK from Gentec-EO (typically provided via email or download link)
- Extract to a known location (default:
./Example_Beamage_SDK_CSharp_V1.02.02/)
pip install pythonnet numpy matplotlib astropyPackage Versions:
pythonnet- .NET interoperability for Pythonnumpy- Array operations and data handlingmatplotlib- Visualization and plottingastropy- FITS file I/O with proper astronomical data formats
git clone <repository-url>
cd gentec-camerapip install pythonnet numpy matplotlib astropyWindows blocks execution of DLLs downloaded from the internet by default. Unblock the SDK DLL using PowerShell:
Unblock-File -Path ".\Example_Beamage_SDK_CSharp_V1.02.02\3. DLL File\BeamageSDK.dll"This grants execution permissions for the SDK library.
Test camera connectivity:
python main.py --auto-exposure --frames 1The main script provides a comprehensive CLI for beam capture:
# Auto-exposure, capture 10 frames
python main.py --auto-exposure --frames 10
# Manual exposure (50.5 ms), save to custom file
python main.py --exposure 50.5 --output beam_profile.fits
# Single frame capture without visualization
python main.py --exposure 100 --frames 1 --no-plot
# Specify camera by serial number
python main.py --serial 228451 --auto-exposure| Option | Description | Default |
|---|---|---|
--exposure MS |
Manual exposure time in milliseconds (0.06-5000 ms) | Auto |
--auto-exposure |
Enable automatic exposure control | - |
--frames N |
Number of frames to capture | 5 |
--delay SEC |
Delay between frame captures (seconds) | 0.5 |
--output FILE |
Output filename (.fits, .npy, or .png) | beamage_capture.fits |
--no-plot |
Skip matplotlib visualization | - |
--save-all |
Save all captured frames (creates 3D array) | False |
--serial SN |
Camera serial number (for multi-camera setups) | First detected |
--dll PATH |
Custom path to BeamageSDK.dll | Auto-detected |
--timeout SEC |
Frame capture timeout | 5.0 |
--quiet, -q |
Suppress informational messages | - |
--verbose, -v |
Enable debug output | - |
For programmatic control, import the BeamageCamera class:
from main import BeamageCamera
from pathlib import Path
# Initialize camera
dll_path = Path("./Example_Beamage_SDK_CSharp_V1.02.02/3. DLL File/BeamageSDK.dll")
cam = BeamageCamera(dll_path=dll_path)
# Connect and configure
cam.connect()
cam.set_exposure(50.0) # 50 ms exposure
cam.start()
# Capture frame
image = cam.capture(timeout=5.0) # Returns numpy array (2048 × 2048)
# Get beam statistics
stats = cam.get_beam_stats()
print(f"Beam diameter: {stats['diameter_x']:.2f} µm × {stats['diameter_y']:.2f} µm")
print(f"Centroid: ({stats['centroid_x']:.1f}, {stats['centroid_y']:.1f})")
# Cleanup
cam.stop()
cam.disconnect()with BeamageCamera(dll_path=dll_path) as cam:
cam.connect()
cam.set_auto_exposure(True)
cam.start()
image = cam.capture()
# Camera automatically disconnects on exitFITS output includes comprehensive metadata headers:
- Acquisition parameters: exposure time, detector type, serial number
- Beam analysis: 4-sigma diameter (X/Y), centroid position
- Statistical data: min/max/mean/std of pixel values
- Wavelength calibration: nominal 1550 nm, range 1495-1595 nm
- Provenance: capture timestamp, lab information, software version
Raw array data saved in .npy format for direct processing in Python/MATLAB.
Auto-generated plots include:
- Full sensor view with percentile-based scaling
- Zoomed region around beam peak
- Crosshair markers at peak intensity location
| Parameter | Value |
|---|---|
| Sensor Resolution | 2048 × 2048 pixels |
| Pixel Size | 5.5 µm × 5.5 µm |
| Wavelength Range | 1495-1595 nm (optimized for 1550 nm) |
| Exposure Range | 0.06-5000 ms |
| Data Type | 32-bit integer |
| SDK Version | 1.2.0.2 |
- Verify USB connection
- Confirm PC-BEAMAGE GUI can access the camera
- Check Windows Device Manager for driver issues
- Restart USB hub or computer if necessary
FileNotFoundError: BeamageSDK.dll not found
Solution: Verify DLL path in script or use --dll flag to specify location manually.
System.IO.FileLoadException: Operation is not supported
Solution: Run the Unblock-File PowerShell command (see Installation step 3).
TimeoutError: No image received within 5 seconds
Solution:
- Increase timeout with
--timeout 10 - Check if camera is receiving light (exposure may be too short)
- Verify camera is not in use by another application
If using Conda environments, ensure proper activation:
conda activate your-environment-name
python main.py --helpgentec-camera/
├── main.py # Main CLI and BeamageCamera class
├── README.md # This file
├── beamage_capture.fits # Example FITS output
├── beamage_capture.npy # Example NumPy output
├── beamage_capture.png # Example visualization
├── Beamage_.Net_Example_V1.00.08/ # C# named pipe example
└── Example_Beamage_SDK_CSharp_V1.02.02/
└── 3. DLL File/
└── BeamageSDK.dll # Gentec SDK library
This tool was developed for the Dr. Eikenberry Research Group at CREOL, University of Central Florida. Contributions and issue reports are welcome via the repository issue tracker.
Refer to Gentec-EO licensing terms for SDK usage. This wrapper code is provided as-is for academic research purposes.
- CREOL Astrophotonics Lab - University of Central Florida
- Gentec-EO - Beamage SDK and hardware support
- Dr. Eikenberry Research Group - Research infrastructure and guidance