qmi.instruments.wavelength.tclab

Instrument driver for the Wavelength Electronics TC Lab temperature controller.

Classes

AutotuneMode(value)

Autotune modes.

TemperatureControllerCondition(...)

Condition status register of the temperature controller.

Wavelength_TC_Lab(context, name, transport)

Instrument driver for the Wavelength Electronics TC Lab temperature controller.

class qmi.instruments.wavelength.tclab.AutotuneMode(value)

Autotune modes.

conjugate()

Returns self, the complex conjugate of any int.

bit_length()

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
bit_count()

Number of ones in the binary representation of the absolute value of self.

Also known as the population count.

>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
to_bytes(length=1, byteorder='big', *, signed=False)

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

classmethod from_bytes(bytes, byteorder='big', *, signed=False)

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.

signed

Indicates whether two’s complement is used to represent the integer.

as_integer_ratio()

Return integer ratio.

Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
real

the real part of a complex number

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

denominator

the denominator of a rational number in lowest terms

class qmi.instruments.wavelength.tclab.TemperatureControllerCondition(current_limit: bool, sensor_limit: bool, temperature_high: bool, temperature_low: bool, sensor_shorted: bool, sensor_open: bool, tec_open: bool, in_tolerance: bool, output_on: bool, laser_shutdown: bool, power_on: bool)

Condition status register of the temperature controller.

current_limit: bool

Alias for field number 0

sensor_limit: bool

Alias for field number 1

temperature_high: bool

Alias for field number 2

temperature_low: bool

Alias for field number 3

sensor_shorted: bool

Alias for field number 4

sensor_open: bool

Alias for field number 5

tec_open: bool

Alias for field number 6

in_tolerance: bool

Alias for field number 7

output_on: bool

Alias for field number 8

laser_shutdown: bool

Alias for field number 9

power_on: bool

Alias for field number 10

count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

class qmi.instruments.wavelength.tclab.Wavelength_TC_Lab(context: QMI_Context, name: str, transport: str)

Instrument driver for the Wavelength Electronics TC Lab temperature controller.

A subset of the instrument functionality is supported. Configuring temperature sensors and sensor parameters is not supported. The auxiliary temperature sensor is not supported.

static list_instruments() List[str]

Return a list of QMI transport descriptors for attached instruments.

open() None

Connect to the instrument hardware.

When this method returns, the instrument must be ready for interaction via calls to instrument-specific methods.

Subclasses can extend this method to implement instrument-specific initialization. If they do, they should call super().open() as a last statement.

close() None

Close the connection to the instrument hardware and release associated resources.

When this method returns, the instrument must not be used again unless it is first re-opened by calling the open() method.

Subclasses can extend this method if they have specific resources to close. If they do, they should call super().close() as a last statement.

reset() None

Reset instrument to factory default settings.

get_idn() QMI_InstrumentIdentification

Read instrument type and version and return QMI_InstrumentIdentification instance.

get_power_on() bool

Return True if the device is powered on, False when in standby.

set_power_on(power_on: bool) None

Switch between power-on and standby mode.

This corresponds to pressing the “power” button on the front panel. While the device is in standby mode, it responds to remote commands but many commands will cause the instrument to report error code 992.

When switching power on, this function returns immediately but it can take a few seconds before the instrument is ready to respond to commands.

Parameters:

power_on – True to switch to power-on mode, False to switch to standby mode.

get_temperature() float

Read the actual temperature.

Returns:

Actual sensor temperature expressed in the selected unit of temperature (see set_unit()).

get_setpoint() float

Return the actual temperature setpoint.

Returns:

Actual temperature setpoint expressed in the selected unit of temperature (see set_unit()).

set_setpoint(setpoint: float) None

Change the temperature setpoint.

It is not possible to set the setpoint outside the temperature limit range (see set_temperature_limit()).

Parameters:

setpoint – New temperature setpoint expressed in the selected unit of temperature (see set_unit()).

get_unit() str

Return the selected physical unit of temperature.

The selected unit is used to report the actual temperature and to set or report the temperature setpoint.

Returns:

Unit, either “CELSIUS”, “KELVIN”, “FAHRENHEIT” or “RAW”.

set_unit(unit: str) None

Change the select physical unit of temperature.

The selected unit is used to report the actual temperature and to set or report the temperature setpoint. The default setting is “CELSIUS”.

Parameters:

unit – Selected unit, either “CELSIUS”, “KELVIN”, “FAHRENHEIT” or “RAW”.

get_tec_current() float

Read the actual current through the thermoelectric element in Ampere.

get_tec_voltage() float

Read the actual voltage on the thermoelectric element in Volt.

get_output_enabled() bool

Return True if the controller output is enabled, False if disabled.

set_output_enabled(enable: bool) None

Enable or disable the controller output.

get_condition_status() TemperatureControllerCondition

Read the current condition of the instrument.

get_pid_parameters() Tuple[float, float, float]

Return the actual PID control parameters.

Returns:

Tuple (p, i, d) of PID parameters.

set_pid_parameters(p: float, i: float, d: float) None

Change the PID control parameters.

Parameters:
  • p – Proportional control parameter, range 0.1 … 1000.

  • i – Integral control parameter, range 0 … 200.

  • d – Derivative control parameter, range 0 … 100.

get_autotune_mode() AutotuneMode

Read the actual autotune mode.

set_autotune_mode(mode: AutotuneMode) None

Change the autotune mode.

In manual mode, the PID parameters must be specified explicitly. In disturbance rejection and setpoint response modes, the instrument automatically adjusts the PID parameters to match the actual setpoint.

A one-time characterization scan must be performed before autotune mode can be used, see start_autotune().

Even in autotune mode, the operator can choose to use a derivative control parameter (D) or to force it to zero. Call set_pid_parameters() to set the D parameter either to zero or to any non-zero value, the call set_autotune_mode() to set the corresponding autotuned parameters.

Parameters:

mode – The new autotune mode (one of the AutotuneMode constants).

start_autotune() None

Start an autotuning characterization scan.

Before calling this function, first turn off the controller output, select one of the autotune modes, and change the setpoint to approximately 5 degrees away from the ambient temperature. For example:

instr.set_output_enabled(False)
instr.set_autotune_mode(AutotuneMode.DISTURB_REJECT)
instr.set_setpoint(ambient_temp + 5.0)
instr.start_autotune()

The characterization scan may take several minutes. Once characterization is complete, get_autotune_valid() will return True. Call abort_autotune() to stop the characterization scan and go back to previous settings. Do not otherwise interact with the instrument while characterization is in progress.

abort_autotune() None

Stop the current autotune characterization scan.

get_autotune_is_valid() bool

Return True if the instrument has valid autotuning characterization data for the current sensor.

This variable becomes True after a successful autotuning characterization scan, and typically stays True until the sensor type is reconfigured.

get_temperature_limit() Tuple[float, float]

Return the temperature limits.

Returns:

Tuple (temp_low, temp_high) representing the temperature limits of the sensor, expressed in the selected unit of temperature (see set_unit()).

set_temperature_limit(temp_low: float, temp_high: float) None

Configure the temperature limits.

When the actual temperature exceeds these limits, the controller output is disabled.

The temperature setpoint is restricted to these limits.

Parameters:
  • temp_low – Low temperature limit, expressed in the selected unit of temperature.

  • temp_high – High temperature limit, expressed in th selected unit of temperature.

get_tec_current_limit() Tuple[float, float]

Read the current limits for the thermoelectric element.

Returns:

Tuple (lim_pos, lim_neg) representing the maximum positive and negative current in Ampere. The maximum negative current is reported as a positive number.

set_tec_current_limit(lim_pos: float, lim_neg: float) None

Configure the current limits for the thermoelectric element.

Warning: Setting incorrect current limits can damage the thermoelectric element and cause safety hazards.

The valid range for these settings is from 0 to the maximum current capability of the instrument, i.e. 5 A for TC5 LAB, etc.

To operate a resistive heater, set one of these limits to zero.

Parameters:
  • lim_pos – Maximum positive current in Ampere.

  • lim_neg – Maximum negative current in Ampere, represented as a positive number.

get_tec_voltage_limit() float

Read the actual voltage limit for the thermoelectric element in Volt.

set_tec_voltage_limit(vlim: float) None

Set the voltage limit for the thermoelectric element.

The autotuning process determines an optimal setting for this parameter.

Parameters:

vlim – New voltage limit in Volt (valid range 9 … 18 for TC5 LAB, TC10 LAB, 10 … 26 for TC15 LAB).

force_unlock() None

Forcefully unlock the remote object.

This unlocks the object, regardless of who owns the lock. This allows you to unlock an object if the locking proxy has been destroyed without unlocking.

Use this with care.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

classmethod get_category() str | None

Return the optional name of the category this object belongs to.

A category name is a free-form string that has no special significance. Its purpose is to distinguish between groups of RPC objects that fulfill similar roles.

get_name() str

Return the name of this object.

Returns:

name attribute.

get_signals() list[SignalDescription]

Return a list of signals that can be published by this object.

Returns:

List consisting of qmi_signals attributes.

is_locked() bool

Query if the remote object is locked.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

is_open() bool

Return True if the instrument is open (ready for interaction).

lock(timeout: float = 0.0, lock_token: str | None = None) bool

Lock the remote object. If timeout is given, try every 0.1s within the given timeout value. The remote object can be locked with an optional custom lock token by giving a string into lock_token keyword argument.

If successful, this proxy is the only proxy that can invoke RPC methods on the remote object; other proxies will receive an “object is locked” response. The return value indicates if the lock was granted; a denied lock means the object was already locked by another proxy.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

release_rpc_object() None

Give a warning if the instrument is removed while still open.

unlock(lock_token: str | None = None) bool

Unlock the remote object.

Without optional parameters, this is only allowed by the proxy that initially locked the object. By giving the lock token as an input parameter, the specific object locked by this token can be unlocked. The return value indicates if the unlocking was successful.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.