Coherent module
This module contains drivers for Coherent CUBE and Sapphire lasers.
The API for these is identical, only their backends are different.
Simply instantiate the correct class for your laser.
The class CoherentLaser contains the complete user-facing API,
but it should not be used as it cannot intercafe with anything.
Examples
Below is a minimum working example showing how to use a Coherent CUBE laser.
import pyvisa
import time
from Devices.Coherent import CUBE
rm = pyvisa.ResourceManager()
cube = CUBE(rm, 'ASRL3::INSTR') # Assuming the serial link is on COM3
print(f'Serial number: {cube.getID()}')
cube.on() # Turn on the laser
cube.power = 50 # Set to 50 mW
time.sleep(5) # Wait for it to reach the target
print(f'Current power: {cube.power} mw') # Read back the power
cube.off() # Turn off the laser
- class Coherent.CUBE(rm, address, config=PosixPath('Config/Coherent.json'), maxOverride=None)[source]
Bases:
CoherentLaserDriver class for Coherent CUBE lasers.
Please refer to
CoherentLaseron usage.- Parameters:
rm (pyvisa.ResourceManager) – The VISA resource manager instance.
address (str) – The VISA resource address for the laser (e.g., ‘ASRL3::INSTR’).
config (str, default: "Config/CUBE_limits.csv") – Path to the CSV configuration file containing user-defined power limits.
maxOverride (float, optional) – A hard override for the maximum allowed power in mW. Overrides the config file.
- allowUnderpower = True
Sets whether or not the given type of laser accepts power settings under its nominal rating.
- Type:
bool
- getID()[source]
Get the serial number of the laser head.
- Returns:
id – Serial number prefixed with the laser type.
- Return type:
str
- class Coherent.CoherentLaser(rm, address, config=PosixPath('Config/Coherent.json'), maxOverride=None)[source]
Bases:
objectParent driver class for Coherent lasers. Handles the common API commands and limits.
- Parameters:
rm (pyvisa.ResourceManager) – The VISA resource manager instance.
address (str) – The VISA resource address for the laser (e.g., ‘ASRL3::INSTR’).
config (str, default: "Config/CUBE_limits.csv") – Path to the CSV configuration file containing user-defined power limits.
maxOverride (float, optional) – A hard override for the maximum allowed power in mW. Overrides the config file.
- allowUnderpower = True
Sets whether or not the given type of laser accepts power settings under its nominal rating.
- Type:
bool
- getExternal()[source]
Query whether external modulation is enabled.
- Returns:
ext – True if external modulation is enabled, False otherwise.
- Return type:
bool
- getHours()[source]
Get the power-on hours of the laser.
- Returns:
hours – Numer of operational hours.
- Return type:
float
- getID()[source]
Get the serial number of the laser head.
- Returns:
id – Serial number prefixed with the laser type.
- Return type:
str
- getMaxPower()[source]
Get the maximum rated power of the laser.
- Returns:
max – Maximum power in mW.
- Return type:
float
- getMinPower()[source]
Get the minimum rated power of the laser.
- Returns:
min – Minimum power in mW.
- Return type:
float
- getPower()[source]
Get the current output power of the laser in mW.
- Returns:
pow – Current output power in mW.
- Return type:
float
- getPowerSetpoint()[source]
Get the power setpoint of the laser. This should read back the value given in the last
setPower(target)call. For the actual output power, usepowerorgetPower().- Returns:
setpoint – Power setpoint in mW.
- Return type:
bool
- getServo()[source]
Query whether servo control is enabled (what even is that?)
- Returns:
servo – True if servo is enabled, False otherwise.
- Return type:
bool
- getState()[source]
Query whether the laser is turned on.
- Returns:
ext – True if the laser is on, False otherwise.
- Return type:
bool
- off(blocking=True)[source]
Turn the laser head off. If blocking is enabled, wait for it to actually turn off before returning.
- Parameters:
blocking (bool, default: True) – Whether or not to block execution until the laser turns off.
- on(blocking=True)[source]
Turn the laser head on. If blocking is enabled, wait for it to actually turn on before returning.
- Parameters:
blocking (bool, default: True) – Whether or not to block execution until the laser turns on.
- property power
Get or set the laser’s output power in mW.
- Type:
float
- query(cmd)[source]
Send a string to the device and get the response.
- Parameters:
cmd (str) – The command to be sent to the device.
- Returns:
resp – Response to the query.
- Return type:
str
- property safety
Sets or gets whether the turn-on safety delay is enabled.
- Type:
bool
- setPower(target)[source]
Set the power target for the laser. Value will be clamped according to laser capabilities and user-defined limits.
- Parameters:
target (float) – Target power in mW.
- setState(state, blocking=True)[source]
Turn the laser head off. If blocking is enabled, wait for it to actually turn off before returning.
- Parameters:
state (bool) – Target state of the laser. Use True to turn on and False to turn off.
blocking (bool, default: True) – Whether or not to block execution until the laser is in the desired state.
- property wavelength
Wavelength of the laser.
- Type:
float
- class Coherent.SapphireLP(rm, address, config=PosixPath('Config/Coherent.json'), maxOverride=None)[source]
Bases:
CoherentLaserDriver class for Coherent Sapphire LP lasers. Includes custom buffer clearing to account for non-disableable command echo.
Please refer to
CoherentLaseron usage.- Parameters:
rm (pyvisa.ResourceManager) – The VISA resource manager instance.
address (str) – The VISA resource address for the laser (e.g., ‘ASRL3::INSTR’).
config (str, default: "Config/CUBE_limits.csv") – Path to the CSV configuration file containing user-defined power limits.
maxOverride (float, optional) – A hard override for the maximum allowed power in mW. Overrides the config file.
- allowUnderpower = False
Sets whether or not the given type of laser accepts power settings under its nominal rating.
- Type:
bool
- getID()[source]
Get the serial number of the laser head.
- Returns:
id – Serial number prefixed with the laser type.
- Return type:
str