qmi.instruments.digilent.analog_discovery
QMI driver for the Digilent Analog Discovery 2 board.
Classes
|
QMI driver for the Analog Discovery 2 board. |
|
Analog acquisition filter |
|
On close behaviour of the device. |
- class qmi.instruments.digilent.analog_discovery.OnClose(value)
On close behaviour of the device.
- class qmi.instruments.digilent.analog_discovery.Filter(value)
Analog acquisition filter
- class qmi.instruments.digilent.analog_discovery.AnalogDiscovery2(context: QMI_Context, name: str, serial_number: str)
QMI driver for the Analog Discovery 2 board.
- 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.
- prepare_analog_output_channel_for_static_output(channel: int, voltage: float) None
Prepare analog output channel for static output.
- Parameters:
channel – Channel to prepare for static output.
voltage – Initial voltage.
- Raises:
QMI_UsageException – Raised when a device is used before it is opened.
QMI_InstrumentException – Raised when an unexpected instrument error occurs.
- set_analog_output_voltage_output(channel: int, voltage: float) None
Set analog output channel to a target voltage.
- Parameters:
channel – Target channel.
voltage – Target voltage level.
- Raises:
QMI_UsageException – Raised when a device is used before it is opened.
QMI_InstrumentException – Raised when an unexpected instrument error occurs.
- get_analog_output_voltage_output(channel: int) float
Get the set voltage level for the analog output.
- Parameters:
channel – The target channel to query.
- Returns:
The set voltage level of the specified channel.
- Return type:
voltage_setpoint
- Raises:
QMI_UsageException – Raised when a device is used before it is opened.
QMI_InstrumentException – Raised when an unexpected instrument error occurs.
- set_device_on_close(on_close: OnClose) None
Set on close behaviour.
- Parameters:
on_close – OnClose enum: either CONTINUE, STOP or SHUTDOWN after closing the device.
- Raises:
QMI_UsageException – Raised when a device is used before it is opened.
QMI_InstrumentException – Raised when an unexpected instrument error occurs.
- reset_analog_input()
Resets and configures analog input parameters to default values.
- Raises:
QMI_UsageException – Raised when a device is used before it is opened.
QMI_InstrumentException – Raised when an unexpected instrument error occurs.
- prepare_analog_input_sample(channel: int, voltage_range: float, acquisition_frequency: float, adc_filter: Filter = Filter.AVERAGE, voltage_offset: float = 0.0, buffer_size: int | None = None) None
Prepare readout voltage on specified channel.
- Parameters:
channel – The channel to prepare.
voltage_offset – Offset in volts.
voltage_range – Range in voltage defined as peak to peak value centered around the offset value.
acquisition_frequency – Acquisition frequency in Hz. The device samples ADC operates at 100 MHz. If an acquisition frequency lower than 100 MHz is provided. The samples will be filtered using the provided filter rule. Note that the acquisition is set for both channels.
adc_filter – Filter rule to apply to ADC samples. See analog_discovery.Filter for documentation.
buffer_size – Adjust the buffer size of the analog in instrument: 16 <= buffer_size <= 8192.
- Raises:
QMI_UsageException – Raised when a device is used before it is opened.
QMI_InstrumentException – Raised when an unexpected instrument error occurs.
- get_analog_input_sample(channel: int) float
Readout voltage on specified channel.
- Parameters:
channel – the target channel to query.
- Raises:
QMI_UsageException – Raised when a device is used before it is opened.
QMI_InstrumentException – QMI_InstrumentException is raised when an unexpected instrument error occurs.
- get_analog_input_acquire_samples(channel: int, timeout: float | None = None) ndarray
Acquire analog input samples.
- Parameters:
channel – The target channel to acquire samples from.
timeout – Time before timeout exception is raised while waiting on sampling acquisition to finish. This method blocks indefinitely if ‘None’ is provided and the measurement is not finished.
- Raises:
QMI_UsageException – Raised when a device is used before it is opened.
QMI_TimeoutException – Raised when a timeout occurs while waiting for the sampling acquisition to finish.
QMI_InstrumentException – Raised when an unexpected instrument error occurs.
- prepare_analog_input_record(channel: int, voltage_range: float, record_length: float, acquisition_frequency: float, voltage_offset: float = 0.0, adc_filter: Filter = Filter.AVERAGE) None
Prepare an analog input record for specified channel.
- Raises:
QMI_UsageException – Raised when a device is used before it is opened.
QMI_InstrumentException – QMI_InstrumentException is raised when an unexpected instrument error occurs.
- get_analog_input_record(channel: int, amount_samples: int | None = None) list[float]
Obtain a record of input voltages from specified channel.
- Parameters:
channel – The target channel to query.
amount_samples – The amount of samples to take. Only relevant when record length is set to -1.
- Returns:
A record of input voltages.
- Return type:
sample_record
- Raises:
QMI_UsageException – Raised when a device is used before it is opened.
QMI_InstrumentException – Raised when data is corrupt or lost or when an unexpected instrument error occurs.
- 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.