qmi.instruments.newport.newport_843r

Instrument driver for the Newport 843-R optical power meter.

This driver depends on PyUSB and works only on Linux.

Classes

Newport_843R(context, name, serial_number)

Instrument driver for the Newport 843-R optical power meter.

class qmi.instruments.newport.newport_843r.Newport_843R(context: QMI_Context, name: str, serial_number: str)

Instrument driver for the Newport 843-R optical power meter.

static list_instruments() List[str]

Return a list of serial numbers for attached Newport 843-R 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.

ask(cmd: str) str

Send command to instrument and return response from instrument.

reset() None

Reset the instrument, returning (most) settings to their defaults.

get_idn() QMI_InstrumentIdentification

Read instrument type and version and return QMI_InstrumentIdentification instance.

get_sensor_info() Tuple[str, str, str, str]

Get sensor type and return information.

Returns:

Tuple (sensor_type, serial_number, sensor_name, capabilities).

get_filter_mode() bool

Return True if the power meter is configured to work with a filter.

set_filter_mode(filter_in: bool) None

Configure the power meter to work with or without filter.

If the filter configuration of the power meter does not match the actual presence of an attenuation filter, the meter will return wildly incorrect power measurements.

Parameters:

filter_in – True to configure the meter with filter; False to configure the meter without a filter.

get_power() float

Return result of next power measurement (Watt).

If the power meter sends an over-range response, this function returns +inf.

This function is part of a generic power meter API and must be supported by all power meter implementations.

get_timestamped_power() Tuple[float, float]

Return a tuple of (unix_timestamp, measured_power).

The timestamp is determined on the computer and may deviate from the actual time of the measurement.

do_zero() None

Perform a zeroing of internal circuits.

Zeroing may take approximately 30 seconds. This function waits until zeroing is finished before returning.

zero_save() None

Save the result of the preceding zero operation to device memory.

get_available_ranges() List[str]

Return a list of available range settings.

Each range is formatted as a number with unit, e.g. “3.00uW”.

get_range() int

Return the currently configured measuring range.

The value -1 is returned if the instrument is in auto-range mode. Otherwise, this function returns an index into the list of available range settings, where 0 refers to the first available range.

get_range_in_use() int

Return the currently used measuring range.

This function returns an index into the list of available range setting, where 0 refers to the first available range.

When the instrument is in auto-range mode, this function returns the index of the automatically selected range.

This function is part of a generic power meter API and must be supported by all power meter implementations. Other implementations may return the range as a floating point value in Watt.

set_range(range_index: int) None

Set the measurement range.

Specify the value -1 to set the instrument to auto-range mode. Otherwise, specify an index into the list of available range settings, where 0 refers to the first available range.

set_autorange(enable: bool) None

Enable or disable auto range mode.

When autoranging is switched from enabled to disabled, the power meter will hold its last auto-selected range.

This function is part of a generic power meter API and must be supported by all power meter implementations.

get_wavelength_range() Tuple[int, int]

Return the range of available wavelengths.

Returns a tuple (min_wavelength, max_wavelength). Wavelengths are expressed in nanometers.

This command assumes that a continous-wavelength sensor is used.

get_wavelength() int

Return the current configured wavelength (nm).

This command assumes that a continous-wavelength sensor is used.

set_wavelength(wavelength: int) None

Configure the wavelength in nm.

This function is part of a generic power meter API and must be supported by all power meter implementations.

get_available_averaging() List[str]

Return a list of available averaging modes.

The first available mode is “NONE”, i.e. no averaging. All other modes are formatted as a duration with unit, e.g. “3sec”.

get_averaging_mode() int

Return the current averaging mode.

This function returns an index into the list of available averaging modes, where 1 refers to the first available mode (which is “NONE”).

set_averaging_mode(averaging_mode: int) None

Set the averaging mode.

Mode 1 is “NONE”, i.e. no averaging. Otherwise, the specified value is an index into the list of available averaging modes, where 1 refers to the first available mode.

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.