API Reference¶
CoBrite(address='cobrite.local', port=2000, timeout=10, max_retries=3, open=False, _transport=None)
¶
Driver for an ID Photonics CoBrite tunable laser controller.
Connect with open(), control lasers with port commands (explicit CSD or
property API), and disconnect with close(). Level-1 commands require a
password; supply it via login(1) or login_from_file(path).
CSD addressing — most port commands accept chassis, slot, and
device integers. Passing 0 (the default) expands to every known port
at that level, so set_state(True) enables all lasers on the unit.
Multi-port queries return a tuple of (chassis, slot, device, value)
tuples, one per matched port.
Property API — call set_active_port(c, s, d) once, then read and
write laser parameters as plain Python attributes (cb.wavelength,
cb.power, etc.).
Example
Create a CoBrite driver instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
address
|
str
|
Hostname or IP address of the CoBrite unit. |
'cobrite.local'
|
port
|
int
|
TCP port number exposed by the unit (default 2000). |
2000
|
timeout
|
int
|
Socket timeout in seconds. Must be longer than the maximum laser tuning time (typically 10-30 s). |
10
|
max_retries
|
int
|
How many times to retry a command when the device
returns an unparsable response before raising |
3
|
open
|
bool
|
When |
False
|
_transport
|
Transport | None
|
For testing only. Inject a custom |
None
|
Example
actual_power
property
¶
Actual measured output power of the active port in dBm.
CSD equivalent: get_actual_power.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no active port has been set. |
dither
property
writable
¶
Dither enable state of the active port.
CSD equivalents: get_dither /
set_dither.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no active port has been set. |
frequency
property
writable
¶
Target frequency of the active port in THz.
CSD equivalents: get_frequency /
set_frequency.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no active port has been set. |
frequency_limits
property
¶
Frequency range of the active port as {"min": float, "max": float} in THz.
CSD equivalent: get_frequency_limits.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no active port has been set. |
laser_alarm
property
¶
Laser alarm code of the active port. 0 = no alarm.
CSD equivalent: get_laser_alarm.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no active port has been set. |
laser_config
property
writable
¶
Full laser configuration of the active port.
CSD equivalents: get_config /
set_config.
Keys: frequency (THz), offset (GHz), power (dBm),
state (bool), busy (bool), dither (int).
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no active port has been set. |
limits
property
¶
All tuning limits of the active port.
CSD equivalent: get_limits.
Returns a dict with keys freq_min, freq_max (THz),
offset_range (GHz), pow_min, pow_max (dBm).
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no active port has been set. |
monitor
property
¶
Thermal and current monitor readings of the active port.
CSD equivalent: get_monitor.
Keys: ld_chip_temp (°C), base_temp (°C), ld_current_ma,
tec_current_ma.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no active port has been set. |
offset
property
writable
¶
Frequency offset of the active port in GHz.
CSD equivalents: get_offset /
set_offset.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no active port has been set. |
offset_limits
property
¶
Symmetric offset limit of the active port in GHz.
CSD equivalent: get_offset_limits.
The allowed range is [-offset_limits, +offset_limits].
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no active port has been set. |
power
property
writable
¶
Target output power of the active port in dBm.
CSD equivalents: get_power /
set_power.
For the actual measured power use actual_power.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no active port has been set. |
power_limits
property
¶
Power range of the active port as {"min": float, "max": float} in dBm.
CSD equivalent: get_power_limits.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no active port has been set. |
state
property
writable
¶
Enable state of the active port.
CSD equivalents: get_state /
set_state.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no active port has been set. |
trigger_config
property
writable
¶
Buffered trigger configuration of the active port.
CSD equivalents: get_trigger_config /
set_trigger_config.
Same keys as laser_config. Applied when the hardware
trigger input fires.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no active port has been set. |
trigger_out_active
property
writable
¶
Whether the active port contributes to the hardware trigger output.
CSD equivalents: get_trigger_out_active /
set_trigger_out_active.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no active port has been set. |
wavelength
property
writable
¶
Target wavelength of the active port in nm.
CSD equivalents: get_wavelength /
set_wavelength.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no active port has been set. |
wavelength_limits
property
¶
Wavelength range of the active port as {"min": float, "max": float} in nm.
CSD equivalent: get_wavelength_limits.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no active port has been set. |
abort()
¶
Abort the current operation (ABOR).
busy_wait(chassis=0, slot=0, device=0)
¶
Send a server-side blocking wait command (BWAI).
The device holds the TCP connection open until the laser finishes
tuning, avoiding the round-trip overhead of client-side BUSY?
polling. Prefer this over wait() for single-port workflows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
clear_status()
¶
Clear all status and alarm registers (*CLS).
Requires level 1.
close(disable=True)
¶
Close the TCP connection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
disable
|
bool
|
When |
True
|
connect_guard(_func=None, *, value='call open() to connect.', exception=True)
staticmethod
¶
Decorator that raises ConnectionError if the socket is not open.
Can be used bare (@connect_guard) or with keyword arguments
(@connect_guard(exception=False)).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
_func
|
F | None
|
The function being decorated when used bare. |
None
|
value
|
str
|
Message for the |
'call open() to connect.'
|
exception
|
bool
|
When |
True
|
Returns:
| Type | Description |
|---|---|
F | Callable[[F], F]
|
Decorated function or decorator factory. |
default_ip_config()
¶
Reset network configuration to factory defaults (IPCDEF).
Changes take effect after the next reboot. Requires level 1.
default_settings()
¶
Reset all laser settings to factory defaults (DEFAULT).
Network configuration is not affected. Requires level 1.
format_layout(indent=2)
¶
full_info(indent=2)
¶
Return identification, layout, and per-port laser state as a string.
Queries frequency, wavelength, power, and enable state for every port in the cached layout.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
indent
|
int
|
Number of spaces per indentation level. |
2
|
Returns:
| Type | Description |
|---|---|
str
|
Multi-line string suitable for console display. |
get_active_port()
¶
get_actual_power(chassis=0, slot=0, device=0)
¶
Return the actual measured output power in dBm (APOW?).
Property equivalent: actual_power.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
Returns:
| Type | Description |
|---|---|
tuple[tuple[int, int, int, float], ...]
|
Tuple of |
get_alarm()
¶
Return the system alarm register (ALAR?).
Returns:
| Type | Description |
|---|---|
int
|
Integer alarm code; |
get_card_info(chassis, slot)
¶
get_config(chassis=0, slot=0, device=0)
¶
Return the full laser configuration in one query (CONF?).
Property equivalent: laser_config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
Returns:
| Type | Description |
|---|---|
tuple[int, int, int, dict[str, float | bool | int]]
|
Tuple of |
...
|
with keys: |
tuple[tuple[int, int, int, dict[str, float | bool | int]], ...]
|
|
tuple[tuple[int, int, int, dict[str, float | bool | int]], ...]
|
|
tuple[tuple[int, int, int, dict[str, float | bool | int]], ...]
|
|
tuple[tuple[int, int, int, dict[str, float | bool | int]], ...]
|
|
tuple[tuple[int, int, int, dict[str, float | bool | int]], ...]
|
|
tuple[tuple[int, int, int, dict[str, float | bool | int]], ...]
|
|
get_dhcp()
¶
Return the DHCP setting for the Ethernet interface (DHCP?).
Returns:
| Type | Description |
|---|---|
str
|
|
get_dither(chassis=0, slot=0, device=0)
¶
Return the dither enable state (DIT?).
Property equivalent: dither.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
Returns:
| Type | Description |
|---|---|
tuple[tuple[int, int, int, bool], ...]
|
Tuple of |
get_dns_ip()
¶
Return the primary DNS server IP address (DNSIP?).
Returns:
| Type | Description |
|---|---|
str
|
Dotted-decimal DNS IP string. |
get_echo()
¶
get_enable_autostart()
¶
Return True if laser on/off state is preserved across reboots (ENABAUTOSTA?).
Returns:
| Type | Description |
|---|---|
bool
|
|
get_error()
¶
Return the last error string (ERR?).
Returns:
| Type | Description |
|---|---|
str
|
Error description string from the device. |
get_fan()
¶
Return the current fan level as a percentage string (FAN?).
Returns:
| Type | Description |
|---|---|
str
|
Fan level string (device-dependent format). |
get_frequency(chassis=0, slot=0, device=0)
¶
Return the target frequency in THz (FREQ?).
Property equivalent: frequency.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
Returns:
| Type | Description |
|---|---|
tuple[tuple[int, int, int, float], ...]
|
Tuple of |
get_frequency_limits(chassis=0, slot=0, device=0)
¶
Return the tunable frequency range in THz (FREQ:LIM?).
Property equivalent: frequency_limits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
Returns:
| Type | Description |
|---|---|
tuple[int, int, int, dict[str, float]]
|
Tuple of |
...
|
|
get_gateway_ip()
¶
Return the gateway IP address (GATEWAYIP?). DX and DX2 only.
For MX: get_gateway_ip_1 /
get_gateway_ip_2.
Returns:
| Type | Description |
|---|---|
str
|
Dotted-decimal gateway IP string. |
get_gateway_ip_1()
¶
Return the front-panel gateway IP address (GATEWAYIP1?). MX only.
For DX/DX2: get_gateway_ip.
Returns:
| Type | Description |
|---|---|
str
|
Dotted-decimal gateway IP string. |
get_gateway_ip_2()
¶
Return the rear-panel gateway IP address (GATEWAYIP2?). MX only.
For DX/DX2: get_gateway_ip.
Returns:
| Type | Description |
|---|---|
str
|
Dotted-decimal gateway IP string. |
get_interlock()
¶
get_ip_address()
¶
Return the Ethernet IP address (IPADDR?). DX and DX2 only.
For MX: get_ip_address_1 /
get_ip_address_2.
Returns:
| Type | Description |
|---|---|
str
|
Dotted-decimal IP address string. |
get_ip_address_1()
¶
Return the front-panel Ethernet IP address (IPADDR1?). MX only.
For DX/DX2: get_ip_address.
Returns:
| Type | Description |
|---|---|
str
|
Dotted-decimal IP address string. |
get_ip_address_2()
¶
Return the rear-panel Ethernet IP address (IPADDR2?). MX only.
For DX/DX2: get_ip_address.
Returns:
| Type | Description |
|---|---|
str
|
Dotted-decimal IP address string. |
get_ip_config_changed()
¶
Return True if network config has changed since last reboot (IPCCH?).
Returns:
| Type | Description |
|---|---|
bool
|
|
get_laser_alarm(chassis=0, slot=0, device=0)
¶
Return the per-port laser alarm code (LALAR?).
Property equivalent: laser_alarm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
Returns:
| Type | Description |
|---|---|
tuple[int, int, int, int]
|
Tuple of |
...
|
|
get_limits(chassis=0, slot=0, device=0)
¶
Return all tuning limits in one query (LIM?).
Property equivalent: limits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
Returns:
| Type | Description |
|---|---|
tuple[int, int, int, dict[str, float]]
|
Tuple of |
...
|
with keys: |
tuple[tuple[int, int, int, dict[str, float]], ...]
|
|
tuple[tuple[int, int, int, dict[str, float]], ...]
|
|
tuple[tuple[int, int, int, dict[str, float]], ...]
|
|
get_lockout()
¶
Return the write-lockout state (LOCK?).
Returns:
| Type | Description |
|---|---|
bool
|
|
get_mac_address()
¶
Return the Ethernet MAC address (MACADDRESS?). DX and DX2 only.
For MX: get_mac_address_1 /
get_mac_address_2.
Returns:
| Type | Description |
|---|---|
str
|
MAC address string. |
get_mac_address_1()
¶
Return the front-panel Ethernet MAC address (MACADDRESS1?). MX only.
For DX/DX2: get_mac_address.
Returns:
| Type | Description |
|---|---|
str
|
MAC address string. |
get_mac_address_2()
¶
Return the rear-panel Ethernet MAC address (MACADDRESS2?). MX only.
For DX/DX2: get_mac_address.
Returns:
| Type | Description |
|---|---|
str
|
MAC address string. |
get_monitor(chassis=0, slot=0, device=0)
¶
Return thermal and current monitor readings (MON?).
Property equivalent: monitor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
Returns:
| Type | Description |
|---|---|
tuple[int, int, int, dict[str, float]]
|
Tuple of |
...
|
dict with keys: |
tuple[tuple[int, int, int, dict[str, float]], ...]
|
|
tuple[tuple[int, int, int, dict[str, float]], ...]
|
|
tuple[tuple[int, int, int, dict[str, float]], ...]
|
|
tuple[tuple[int, int, int, dict[str, float]], ...]
|
|
get_netmask()
¶
Return the Ethernet netmask (NETMASK?). DX and DX2 only.
For MX: get_netmask_1 /
get_netmask_2.
Returns:
| Type | Description |
|---|---|
str
|
Dotted-decimal netmask string. |
get_netmask_1()
¶
Return the front-panel Ethernet netmask (NETMASK1?). MX only.
For DX/DX2: get_netmask.
Returns:
| Type | Description |
|---|---|
str
|
Dotted-decimal netmask string. |
get_netmask_2()
¶
Return the rear-panel Ethernet netmask (NETMASK2?). MX only.
For DX/DX2: get_netmask.
Returns:
| Type | Description |
|---|---|
str
|
Dotted-decimal netmask string. |
get_offset(chassis=0, slot=0, device=0)
¶
Return the current frequency offset in GHz (OFF?).
Property equivalent: offset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
Returns:
| Type | Description |
|---|---|
tuple[tuple[int, int, int, float], ...]
|
Tuple of |
get_offset_limits(chassis=0, slot=0, device=0)
¶
Return the symmetric frequency offset limit in GHz (OFF:LIM?).
Property equivalent: offset_limits.
The allowed offset range is [-limit, +limit].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
Returns:
| Type | Description |
|---|---|
tuple[tuple[int, int, int, float], ...]
|
Tuple of |
get_param_refresh()
¶
Return the parameter-refresh change counter (PREF?).
The counter increments each time any parameter changes on the device. Poll this to detect changes without querying every parameter.
Returns:
| Type | Description |
|---|---|
int
|
Integer change counter. |
get_power(chassis=0, slot=0, device=0)
¶
Return the target output power in dBm (POW?).
Property equivalent: power.
For the actual measured power, use get_actual_power.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
Returns:
| Type | Description |
|---|---|
tuple[tuple[int, int, int, float], ...]
|
Tuple of |
get_power_limits(chassis=0, slot=0, device=0)
¶
Return the output power range in dBm (POW:LIM?).
Property equivalent: power_limits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
Returns:
| Type | Description |
|---|---|
tuple[int, int, int, dict[str, float]]
|
Tuple of |
...
|
|
get_remote()
¶
Return True if the unit is in remote control mode (REMO?).
Returns:
| Type | Description |
|---|---|
bool
|
|
get_start_default()
¶
Return True if the unit starts with factory defaults on boot (STADEF?).
Returns:
| Type | Description |
|---|---|
bool
|
|
get_state(chassis=0, slot=0, device=0)
¶
Return the enable state of matched laser ports (STAT?).
Property equivalent: state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
Returns:
| Type | Description |
|---|---|
tuple[tuple[int, int, int, bool], ...]
|
Tuple of |
get_temp()
¶
get_time()
¶
Return the system time as a Unix timestamp (TIME?).
The clock is volatile; it must be set after each cold start.
Returns:
| Type | Description |
|---|---|
int
|
Unix timestamp (seconds since epoch). |
get_trigger_config(chassis=0, slot=0, device=0)
¶
Return the buffered trigger configuration (TRICONF?).
Property equivalent: trigger_config.
The trigger config is applied when the hardware trigger input fires.
It has the same structure as the regular laser config from get_config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
Returns:
| Type | Description |
|---|---|
tuple[int, int, int, dict[str, float | bool | int]]
|
Tuple of |
...
|
See |
get_trigger_delay()
¶
Return the hardware trigger delay in milliseconds (TRIDEL?).
Returns:
| Type | Description |
|---|---|
int
|
Trigger delay in ms. |
get_trigger_out_active(chassis=0, slot=0, device=0)
¶
Return whether a port contributes to the hardware trigger output (TRIOUTACT?).
Property equivalent: trigger_out_active.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
Returns:
| Type | Description |
|---|---|
tuple[tuple[int, int, int, bool], ...]
|
Tuple of |
get_trigger_polarity()
¶
get_usb_ip_address()
¶
Return the IP address of the virtual Ethernet interface over USB (USBIPADDR?).
Returns:
| Type | Description |
|---|---|
str
|
Dotted-decimal IP address string. |
get_usb_netmask()
¶
Return the netmask of the virtual Ethernet interface over USB (USBNETMASK?).
Returns:
| Type | Description |
|---|---|
str
|
Dotted-decimal netmask string. |
get_wavelength(chassis=0, slot=0, device=0)
¶
Return the target wavelength in nm (WAV?).
Property equivalent: wavelength.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
Returns:
| Type | Description |
|---|---|
tuple[tuple[int, int, int, float], ...]
|
Tuple of |
get_wavelength_limits(chassis=0, slot=0, device=0)
¶
Return the tunable wavelength range in nm (WAV:LIM?).
Property equivalent: wavelength_limits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
Returns:
| Type | Description |
|---|---|
tuple[int, int, int, dict[str, float]]
|
Tuple of |
...
|
|
identify(enable)
¶
Blink a visible indicator to identify the unit in a multi-unit setup (IDENT).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enable
|
bool
|
|
required |
idn()
¶
Return the identification string of the unit (*IDN?).
Returns:
| Type | Description |
|---|---|
str
|
Identification string, e.g. |
info()
¶
Return the system information string (INFO?).
Returns the same identification and version information as idn() but
via the system-level INFO? command.
Returns:
| Type | Description |
|---|---|
str
|
System type and software version string. |
init_interface()
¶
Reset session parameters to defaults (INTI).
Resets ECHO, PASS, FORMAT, LINLOG, and EVENT to their default values.
Also resets the cached user level to 0. Called automatically by
open().
layout()
¶
Fetch and cache the device layout.
Queries LAY? and then TYP? for every discovered port. The result
is cached internally and used to expand wildcard (0) CSD addresses.
Called automatically by open().
Returns:
| Type | Description |
|---|---|
dict[int, dict[int, dict[int, str]]]
|
Nested dict |
login(level=0, password='IDP')
¶
Authenticate with the device.
The granted level is cached for the session; subsequent level-1 calls
succeed without re-authenticating until close() or
init_interface() resets it. For non-interactive scripts prefer
login_from_file().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level
|
int
|
Target user level. |
0
|
password
|
str
|
Password string (default |
'IDP'
|
Returns:
| Type | Description |
|---|---|
int
|
The user level confirmed by the device after authentication. |
login_from_file(path, level=1)
¶
Authenticate using a password stored in a file.
Reads the first non-empty line of path and uses it as the password.
The granted level is cached exactly as with login().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Path to a plain-text file whose first line is the password. |
required |
level
|
int
|
Target user level (default 1). |
1
|
Returns:
| Type | Description |
|---|---|
int
|
The user level confirmed by the device after authentication. |
manual()
staticmethod
¶
Open the CoBrite user manual in the default web browser.
opc()
¶
Return True when all pending operations are complete (*OPC?).
Returns:
| Type | Description |
|---|---|
bool
|
|
opc_wait()
¶
Block until all pending operations complete (*WAI).
The device holds the TCP connection open until *OPC? would return
1, eliminating the need for a client-side polling loop.
open()
¶
Open the TCP connection to the CoBrite unit.
Resolves address to an IP, opens a PyVISA TCPIP socket, fetches the
device layout, and resets session parameters with INTI. When a
_transport was injected at construction time, the PyVISA step is
skipped and the injected transport is used directly.
Raises:
| Type | Description |
|---|---|
gaierror
|
If |
VisaIOError
|
If the socket cannot be opened (real transport only). |
query(command)
¶
Send a SCPI command and return the raw response string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
str
|
SCPI command string (without terminator). |
required |
Returns:
| Type | Description |
|---|---|
str
|
Stripped response string from the device. |
Raises:
| Type | Description |
|---|---|
ConnectionError
|
If |
RuntimeError
|
If the response contains |
requires_level(level)
staticmethod
¶
Decorator that raises PermissionError if the session user level is insufficient.
Call login(1) or login_from_file(path) before invoking level-1 methods.
Can be used on subclass methods: @CoBrite.requires_level(1).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level
|
int
|
Minimum required user level. |
required |
Returns:
| Type | Description |
|---|---|
Callable[[F], F]
|
Decorator factory. |
reset()
¶
Perform a warm restart of the controller (*RST).
All open sessions are closed. Requires level 1.
retry(_func=None, *, max_retries=None)
staticmethod
¶
Decorator that retries the wrapped function on any exception.
Reads self.max_retries unless max_retries is given explicitly.
Can be used bare (@CoBrite.retry) or with a keyword argument
(@CoBrite.retry(max_retries=5)).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
_func
|
F | None
|
The function being decorated when used bare. |
None
|
max_retries
|
int | None
|
Override for |
None
|
Returns:
| Type | Description |
|---|---|
F | Callable[[F], F]
|
Decorated function or decorator factory. |
set_active_port(chassis, slot, device)
¶
set_config(frequency, offset, power, state, dither, chassis=0, slot=0, device=0, wait=True)
¶
Set all laser parameters atomically in a single command (CONF).
Property equivalent: laser_config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frequency
|
float
|
Target frequency in THz. |
required |
offset
|
float
|
Frequency offset in GHz. |
required |
power
|
float
|
Target output power in dBm. |
required |
state
|
bool
|
|
required |
dither
|
int
|
Dither state ( |
required |
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
wait
|
bool
|
When |
True
|
set_dhcp(enable)
¶
Enable or disable DHCP on the Ethernet interface (DHCP).
Requires level 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enable
|
bool
|
|
required |
set_dither(enable, chassis=0, slot=0, device=0, wait=True)
¶
Enable or disable dither on matched laser ports (DIT).
Property equivalent: dither.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enable
|
bool
|
|
required |
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
wait
|
bool
|
When |
True
|
set_dns_ip(ip)
¶
Set the primary DNS server IP address (DNSIP).
Requires level 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ip
|
str
|
Dotted-decimal DNS server IP string. |
required |
set_echo(enable)
¶
Enable or disable command echo (ECHO).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enable
|
bool
|
|
required |
set_enable_autostart(enable)
¶
Enable or disable preservation of laser on/off state across reboots (ENABAUTOSTA).
Requires level 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enable
|
bool
|
|
required |
set_frequency(frequency, chassis=0, slot=0, device=0, wait=True)
¶
Set the target frequency in THz (FREQ).
Property equivalent: frequency.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frequency
|
float
|
Target frequency in terahertz. |
required |
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
wait
|
bool
|
When |
True
|
set_gateway_ip(ip)
¶
Set the gateway IP address (GATEWAYIP). DX and DX2 only.
For MX: set_gateway_ip_1/
set_gateway_ip_2.
Requires level 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ip
|
str
|
Dotted-decimal gateway IP string. |
required |
set_gateway_ip_1(ip)
¶
Set the front-panel gateway IP address (GATEWAYIP1). MX only.
For DX/DX2: set_gateway_ip.
Requires level 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ip
|
str
|
Dotted-decimal gateway IP string. |
required |
set_gateway_ip_2(ip)
¶
Set the rear-panel gateway IP address (GATEWAYIP2). MX only.
For DX/DX2: set_gateway_ip.
Requires level 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ip
|
str
|
Dotted-decimal gateway IP string. |
required |
set_ip_address(ip)
¶
Set the Ethernet IP address (IPADDR). DX and DX2 only.
For MX: set_ip_address_1/
set_ip_address_2.
Requires level 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ip
|
str
|
Dotted-decimal IP address string. |
required |
set_ip_address_1(ip)
¶
Set the front-panel Ethernet IP address (IPADDR1). MX only.
For DX/DX2: set_ip_address.
Requires level 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ip
|
str
|
Dotted-decimal IP address string. |
required |
set_ip_address_2(ip)
¶
Set the rear-panel Ethernet IP address (IPADDR2). MX only.
For DX/DX2: set_ip_address.
Requires level 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ip
|
str
|
Dotted-decimal IP address string. |
required |
set_lockout(enable)
¶
Lock or unlock other sessions from performing write commands (LOCK).
Requires level 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enable
|
bool
|
|
required |
set_netmask(mask)
¶
Set the Ethernet netmask (NETMASK). DX and DX2 only.
For MX: set_netmask_1/
set_netmask_2.
Requires level 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mask
|
str
|
Dotted-decimal netmask string. |
required |
set_netmask_1(mask)
¶
Set the front-panel Ethernet netmask (NETMASK1). MX only.
For DX/DX2: set_netmask.
Requires level 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mask
|
str
|
Dotted-decimal netmask string. |
required |
set_netmask_2(mask)
¶
Set the rear-panel Ethernet netmask (NETMASK2). MX only.
For DX/DX2: set_netmask.
Requires level 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mask
|
str
|
Dotted-decimal netmask string. |
required |
set_offset(offset, chassis=0, slot=0, device=0, wait=True)
¶
Set the frequency offset in GHz (OFF).
Property equivalent: offset.
The offset is added to the nominal frequency set by set_frequency.
Use get_offset_limits for the allowed range (symmetric, ±limit).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
offset
|
float
|
Frequency offset in GHz. |
required |
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
wait
|
bool
|
When |
True
|
set_password(password)
¶
Change the password for the current user level (SPASS).
Requires level 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
password
|
str
|
New password string. |
required |
set_power(power, chassis=0, slot=0, device=0, wait=True)
¶
Set the target output power in dBm (POW).
Property equivalent: power.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
power
|
float
|
Target output power in dBm. |
required |
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
wait
|
bool
|
When |
True
|
set_start_default(enable)
¶
Control whether the unit applies factory defaults on the next boot (STADEF).
Requires level 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enable
|
bool
|
|
required |
set_state(state=False, chassis=0, slot=0, device=0, wait=True)
¶
Enable or disable laser output (STAT).
Property equivalent: state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
bool
|
|
False
|
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
wait
|
bool
|
When |
True
|
set_time(t)
¶
Set the system time (TIME).
Stored in volatile memory; must be set after each cold start.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
int
|
Unix timestamp (seconds since epoch). |
required |
set_trigger_config(frequency, offset, power, state, dither, chassis=0, slot=0, device=0, wait=True)
¶
Buffer a configuration to apply when the hardware trigger input fires (TRICONF).
Property equivalent: trigger_config.
Parameters have the same meaning as set_config.
Requires level 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frequency
|
float
|
Target frequency in THz. |
required |
offset
|
float
|
Frequency offset in GHz. |
required |
power
|
float
|
Target output power in dBm. |
required |
state
|
bool
|
|
required |
dither
|
int
|
Dither state ( |
required |
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
wait
|
bool
|
When |
True
|
set_trigger_delay(ms)
¶
Set the hardware trigger delay in milliseconds (TRIDEL).
Requires level 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ms
|
int
|
Trigger delay in milliseconds. |
required |
set_trigger_out_active(active, chassis=0, slot=0, device=0, wait=True)
¶
Enable or disable a port's contribution to the hardware trigger output (TRIOUTACT).
Property equivalent: trigger_out_active.
Requires level 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
active
|
bool
|
|
required |
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
wait
|
bool
|
When |
True
|
set_trigger_polarity(in_out, polarity)
¶
set_wavelength(wavelength, chassis=0, slot=0, device=0, wait=True)
¶
Set the target wavelength in nm (WAV).
Property equivalent: wavelength.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wavelength
|
float
|
Target wavelength in nanometres. |
required |
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
wait
|
bool
|
When |
True
|
wait(chassis=0, slot=0, device=0)
¶
Poll BUSY? until all matched ports finish tuning.
Called automatically by set methods unless wait=False is passed.
For a server-side blocking wait without polling, use busy_wait().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chassis
|
int
|
Chassis number, or |
0
|
slot
|
int
|
Slot number, or |
0
|
device
|
int
|
Device number, or |
0
|
wait_ms(ms)
¶
Insert a server-side delay before processing the next buffered command (WAITMS).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ms
|
int
|
Delay in milliseconds. |
required |
write(command)
¶
Send a SCPI command and discard the response.
Internally calls query(), so the same error checking applies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
str
|
SCPI command string (without terminator). |
required |
Raises:
| Type | Description |
|---|---|
ConnectionError
|
If |
RuntimeError
|
If the device returns an error response. |